Skip to content

Commit

Permalink
fix formatting, update lock file and generated idl versions
Browse files Browse the repository at this point in the history
  • Loading branch information
StanChe committed Aug 22, 2024
1 parent 8f9d3e6 commit f343436
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
6 changes: 3 additions & 3 deletions account-compression/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion account-compression/sdk/idl/spl_account_compression.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.0",
"version": "0.3.1",
"name": "spl_account_compression",
"instructions": [
{
Expand Down
20 changes: 10 additions & 10 deletions account-compression/sdk/tests/accountCompression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('Account Compression', () => {
assert(false, 'Double finalizing should have failed');
} catch {}
});

it('Should be able to close a prepared tree', async () => {
let payerInfo = await provider.connection.getAccountInfo(payer, 'confirmed')!;
let treeInfo = await provider.connection.getAccountInfo(cmt, 'confirmed')!;
Expand All @@ -189,12 +189,12 @@ describe('Account Compression', () => {

const closeIx = createCloseEmptyTreeIx(cmt, payer, payer);
await execute(provider, [closeIx], [payerKeypair]);

payerInfo = await provider.connection.getAccountInfo(payer, 'confirmed')!;
const finalLamports = payerInfo!.lamports;
assert(
finalLamports === payerLamports + treeLamports - 5000,
'Expected payer to have received the lamports from the closed tree account'
'Expected payer to have received the lamports from the closed tree account',
);

treeInfo = await provider.connection.getAccountInfo(cmt, 'confirmed');
Expand Down Expand Up @@ -499,7 +499,7 @@ describe('Account Compression', () => {
});
it('Should be able to close a prepared tree after setting the canopy', async () => {
const merkleTreeRaw = new MerkleTree(leaves);

const appendIx = createAppendCanopyNodesIx(
cmt,
payer,
Expand All @@ -518,12 +518,12 @@ describe('Account Compression', () => {

const closeIx = createCloseEmptyTreeIx(cmt, payer, payer);
await execute(provider, [closeIx], [payerKeypair]);

payerInfo = await provider.connection.getAccountInfo(payer, 'confirmed')!;
const finalLamports = payerInfo!.lamports;
assert(
finalLamports === payerLamports + treeLamports - 5000,
'Expected payer to have received the lamports from the closed tree account'
'Expected payer to have received the lamports from the closed tree account',
);

treeInfo = await provider.connection.getAccountInfo(cmt, 'confirmed');
Expand Down Expand Up @@ -565,7 +565,7 @@ describe('Account Compression', () => {
'confirmed',
);
});

it('Should be able to finalize an empty tree with empty canopy and close it afterwards', async () => {
const merkleTreeRaw = new MerkleTree(leaves);
const root = merkleTreeRaw.root;
Expand All @@ -588,12 +588,12 @@ describe('Account Compression', () => {

const closeIx = createCloseEmptyTreeIx(cmt, payer, payer);
await execute(provider, [closeIx], [payerKeypair]);

payerInfo = await provider.connection.getAccountInfo(payer, 'confirmed')!;
const finalLamports = payerInfo!.lamports;
assert(
finalLamports === payerLamports + treeLamports - 5000,
'Expected payer to have received the lamports from the closed tree account'
'Expected payer to have received the lamports from the closed tree account',
);

treeInfo = await provider.connection.getAccountInfo(cmt, 'confirmed');
Expand Down Expand Up @@ -1054,7 +1054,7 @@ describe('Account Compression', () => {
payerKeypair,
0,
{ maxBufferSize: 8, maxDepth: DEPTH },
DEPTH // Store full tree on chain
DEPTH, // Store full tree on chain
);
cmt = cmtKeypair.publicKey;
const appendIx = createAppendCanopyNodesIx(cmt, payer, [crypto.randomBytes(32)], 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function assertCMTProperties(
}
assert(
onChainCMT.getIsBatchInitialized() === expectedIsBatchInitialized,
'On chain isBatchInitialized does not match expected value'
'On chain isBatchInitialized does not match expected value',
);
}

Expand Down Expand Up @@ -153,20 +153,24 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
// The account data was generated by running:
// $ solana account 27QMkDMpBoAhmWj6xxQNYdqXZL5nnC8tkZcEtkNxCqeX \
// --output-file tests/fixtures/pre-batch-init-tree-account.json \
// --output json
// --output json
const deployedAccount = new PublicKey('27QMkDMpBoAhmWj6xxQNYdqXZL5nnC8tkZcEtkNxCqeX');
const cmt = await ConcurrentMerkleTreeAccount.fromAccountAddress(
connection,
deployedAccount,
'confirmed'
);
const cmt = await ConcurrentMerkleTreeAccount.fromAccountAddress(connection, deployedAccount, 'confirmed');
const expectedMaxDepth = 10;
const expectedMaxBufferSize = 32;
const expectedCanopyDepth = 0;
const expectedAuthority = new PublicKey('BFNT941iRwYPe2Js64dTJSoksGCptWAwrkKMaSN73XK2');
const expectedRoot = new PublicKey('83UjseEuEgxyVyDTmrJCQ9QbeksdRZ7KPDZGQYc5cAgF').toBuffer();
const expectedIsBatchInitialized = false;
await assertCMTProperties(cmt, expectedMaxDepth, expectedMaxBufferSize, expectedAuthority, expectedRoot, expectedCanopyDepth, expectedIsBatchInitialized);
await assertCMTProperties(
cmt,
expectedMaxDepth,
expectedMaxBufferSize,
expectedAuthority,
expectedRoot,
expectedCanopyDepth,
expectedIsBatchInitialized,
);
});
});
});

0 comments on commit f343436

Please sign in to comment.