Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit f1fc030

Browse files
committed
regenerated sdk
1 parent c551072 commit f1fc030

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

account-compression/sdk/idl/spl_account_compression.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,22 @@
5454
{
5555
"name": "prepareTree",
5656
"docs": [
57-
"In order to initialize a tree with a root, we need to create the tree on-chain first with the proper authority.",
58-
"The tree might contain a canopy, which is a cache of the uppermost nodes.",
59-
"The canopy is used to decrease the size of the proof required to update the tree.",
57+
"In order to initialize a tree with a root, we need to create the tree on-chain first with",
58+
"the proper authority. The tree might contain a canopy, which is a cache of the uppermost",
59+
"nodes. The canopy is used to decrease the size of the proof required to update the tree.",
6060
"If the tree is expected to have a canopy, it needs to be prefilled with the necessary nodes.",
6161
"There are 2 ways to initialize a merkle tree:",
6262
"1. Initialize an empty tree",
6363
"2. Initialize a tree with a root and leaf",
64-
"For the former case, the canopy will be empty which is expected for an empty tree. The expected flow is `init_empty_merkle_tree`.",
65-
"For the latter case, the canopy should be filled with the necessary nodes to render the tree usable.",
66-
"Thus we need to prefill the canopy with the necessary nodes.",
67-
"The expected flow for a tree without canopy is `prepare_tree` -> `init_merkle_tree_with_root`.",
68-
"The expected flow for a tree with canopy is `prepare_tree` -> `append_canopy_nodes` (multiple times until all of the canopy is filled) -> `init_merkle_tree_with_root`.",
69-
"This instruction initializes the tree header while leaving the tree itself uninitialized. This allows distinguishing between an empty tree and a tree prepare to be initialized with a root."
64+
"For the former case, the canopy will be empty which is expected for an empty tree. The",
65+
"expected flow is `init_empty_merkle_tree`. For the latter case, the canopy should be",
66+
"filled with the necessary nodes to render the tree usable. Thus we need to prefill the",
67+
"canopy with the necessary nodes. The expected flow for a tree without canopy is",
68+
"`prepare_tree` -> `init_merkle_tree_with_root`. The expected flow for a tree with canopy",
69+
"is `prepare_tree` -> `append_canopy_nodes` (multiple times until all of the canopy is",
70+
"filled) -> `init_merkle_tree_with_root`. This instruction initializes the tree header",
71+
"while leaving the tree itself uninitialized. This allows distinguishing between an empty",
72+
"tree and a tree prepare to be initialized with a root."
7073
],
7174
"accounts": [
7275
{
@@ -105,7 +108,8 @@
105108
"name": "appendCanopyNodes",
106109
"docs": [
107110
"This instruction pre-initializes the canopy with the specified leaf nodes of the canopy.",
108-
"This is intended to be used after `prepare_tree` and in conjunction with the `init_merkle_tree_with_root` instruction that'll finalize the tree initialization."
111+
"This is intended to be used after `prepare_tree` and in conjunction with the",
112+
"`init_merkle_tree_with_root` instruction that'll finalize the tree initialization."
109113
],
110114
"accounts": [
111115
{

account-compression/sdk/tests/accountCompression.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ describe('Account Compression', () => {
250250
const root = merkleTreeRaw.root;
251251
const leaf = leaves[leaves.length - 1];
252252

253-
const appendIx = createAppendCanopyNodesIx(cmt, payer, [merkleTreeRaw.leaves[0].parent?.node!], 0);
253+
const appendIx = createAppendCanopyNodesIx(cmt, payer, [merkleTreeRaw.leaves[0].parent!.node!], 0);
254254
await execute(provider, [appendIx], [payerKeypair]);
255255
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
256256

@@ -265,7 +265,7 @@ describe('Account Compression', () => {
265265
const leaf = leaves[leaves.length - 1];
266266

267267
// take every second leaf and append it's parent node to the canopy
268-
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 0);
268+
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 0);
269269
await execute(provider, [appendIx], [payerKeypair]);
270270
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
271271
await execute(provider, [finalize], [payerKeypair]);
@@ -275,10 +275,10 @@ describe('Account Compression', () => {
275275
const root = merkleTreeRaw.root;
276276
const leaf = leaves[leaves.length - 1];
277277
// take every second leaf of the first half of a tree and append it's parent node to the canopy
278-
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 0);
278+
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 0);
279279
await execute(provider, [appendIx], [payerKeypair]);
280280
// take every second leaf of the second half of a tree and append it's parent node to the canopy
281-
const appendIx2 = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 2);
281+
const appendIx2 = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 2);
282282
await execute(provider, [appendIx2], [payerKeypair]);
283283
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
284284
await execute(provider, [finalize], [payerKeypair]);
@@ -288,9 +288,9 @@ describe('Account Compression', () => {
288288
const root = merkleTreeRaw.root;
289289
const leaf = leaves[leaves.length - 1];
290290

291-
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 2);
291+
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 2);
292292
await execute(provider, [appendIx], [payerKeypair]);
293-
const appendIx2 = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 0);
293+
const appendIx2 = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 0);
294294
await execute(provider, [appendIx2], [payerKeypair]);
295295
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
296296
await execute(provider, [finalize], [payerKeypair]);
@@ -300,11 +300,11 @@ describe('Account Compression', () => {
300300
const root = merkleTreeRaw.root;
301301
const leaf = leaves[leaves.length - 1];
302302

303-
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 0);
303+
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(0, leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 0);
304304
await execute(provider, [appendIx], [payerKeypair]);
305305
const appendIx2 = createAppendCanopyNodesIx(cmt, payer, [crypto.randomBytes(32)], 2);
306306
await execute(provider, [appendIx2], [payerKeypair]);
307-
const replaceIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 2);
307+
const replaceIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.slice(leaves.length / 2).filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 2);
308308
await execute(provider, [replaceIx], [payerKeypair]);
309309
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
310310
await execute(provider, [finalize], [payerKeypair]);
@@ -314,7 +314,7 @@ describe('Account Compression', () => {
314314
const root = merkleTreeRaw.root;
315315
const leaf = leaves[leaves.length - 1];
316316

317-
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.filter((_, i) => i % 2 === 0).map(leaf => leaf.parent?.node!), 0);
317+
const appendIx = createAppendCanopyNodesIx(cmt, payer, merkleTreeRaw.leaves.filter((_, i) => i % 2 === 0).map(leaf => leaf.parent!.node!), 0);
318318
await execute(provider, [appendIx], [payerKeypair]);
319319
const finalize = createFinalizeMerkleTreeWithRootIx(cmt, payer, root, leaf, leaves.length - 1, merkleTreeRaw.getProof(leaves.length - 1).proof);
320320
await execute(provider, [finalize], [payerKeypair]);

0 commit comments

Comments
 (0)