@@ -18,6 +18,7 @@ import { buildTree, Tree } from "./merkle-tree";
18
18
import {
19
19
decodeMerkleRoll ,
20
20
getMerkleRollAccountSize ,
21
+ assertOnChainMerkleRollProperties ,
21
22
} from "../sdk/gummyroll" ;
22
23
import NodeWallet from "@project-serum/anchor/dist/cjs/nodewallet" ;
23
24
import {
@@ -148,31 +149,8 @@ describe("bubblegum", () => {
148
149
await Bubblegum . provider . send ( tx , [ payer , merkleRollKeypair ] , {
149
150
commitment : "confirmed" ,
150
151
} ) ;
151
- const merkleRoll = await Bubblegum . provider . connection . getAccountInfo (
152
- merkleRollKeypair . publicKey
153
- ) ;
154
-
155
- let onChainMerkle = decodeMerkleRoll ( merkleRoll . data ) ;
156
-
157
- // Check header bytes are set correctly
158
- assert (
159
- onChainMerkle . header . maxDepth === MAX_DEPTH ,
160
- `Max depth does not match ${ onChainMerkle . header . maxDepth } , expected ${ MAX_DEPTH } `
161
- ) ;
162
- assert (
163
- onChainMerkle . header . maxBufferSize === MAX_SIZE ,
164
- `Max buffer size does not match ${ onChainMerkle . header . maxBufferSize } , expected ${ MAX_SIZE } `
165
- ) ;
166
-
167
- assert (
168
- onChainMerkle . header . authority . equals ( authority ) ,
169
- "Failed to write auth pubkey"
170
- ) ;
171
-
172
- assert (
173
- onChainMerkle . roll . changeLogs [ 0 ] . root . equals ( new PublicKey ( tree . root ) ) ,
174
- "On chain root does not match root passed in instruction"
175
- ) ;
152
+
153
+ await assertOnChainMerkleRollProperties ( Bubblegum . provider . connection , MAX_DEPTH , MAX_SIZE , authority , new PublicKey ( tree . root ) , merkleRollKeypair . publicKey ) ;
176
154
177
155
return [ merkleRollKeypair , tree , authority , nonce ] ;
178
156
}
0 commit comments