@@ -21,8 +21,10 @@ import {
21
21
decodeMerkleRoll ,
22
22
getMerkleRollAccountSize ,
23
23
createVerifyLeafIx ,
24
+ assertOnChainMerkleRollProperties
24
25
} from '../sdk/gummyroll' ;
25
26
import { execute } from "./utils" ;
27
+ import NodeWallet from "@project-serum/anchor/dist/cjs/nodewallet" ;
26
28
27
29
// @ts -ignore
28
30
let Gummyroll ;
@@ -114,31 +116,8 @@ describe("gummyroll", () => {
114
116
await Gummyroll . provider . send ( tx , [ payer , merkleRollKeypair ] , {
115
117
commitment : "confirmed" ,
116
118
} ) ;
117
- const merkleRoll = await Gummyroll . provider . connection . getAccountInfo (
118
- merkleRollKeypair . publicKey
119
- ) ;
120
-
121
- let onChainMerkle = decodeMerkleRoll ( merkleRoll . data ) ;
122
-
123
- // Check header bytes are set correctly
124
- assert (
125
- onChainMerkle . header . maxDepth === maxDepth ,
126
- `Max depth does not match ${ onChainMerkle . header . maxDepth } , expected ${ maxDepth } `
127
- ) ;
128
- assert (
129
- onChainMerkle . header . maxBufferSize === maxSize ,
130
- `Max buffer size does not match ${ onChainMerkle . header . maxBufferSize } , expected ${ maxSize } `
131
- ) ;
132
-
133
- assert (
134
- onChainMerkle . header . authority . equals ( payer . publicKey ) ,
135
- "Failed to write auth pubkey"
136
- ) ;
137
-
138
- assert (
139
- onChainMerkle . roll . changeLogs [ 0 ] . root . equals ( new PublicKey ( tree . root ) ) ,
140
- "On chain root does not match root passed in instruction"
141
- ) ;
119
+
120
+ await assertOnChainMerkleRollProperties ( Gummyroll . provider . connection , maxDepth , maxSize , payer . publicKey , new PublicKey ( tree . root ) , merkleRollKeypair . publicKey ) ;
142
121
143
122
return [ merkleRollKeypair , tree ]
144
123
}
0 commit comments