Skip to content

Commit

Permalink
[account compression] add height: 6-9 @ buffer: 16, height: 10-13 @ b…
Browse files Browse the repository at this point in the history
…uffer: 32 (#5438)
  • Loading branch information
ngundotra authored Oct 11, 2023
1 parent fe2c82d commit e619e4d
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 24 deletions.
114 changes: 90 additions & 24 deletions account-compression/Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ macro_rules! _merkle_tree_apply_fn {
match ($header.get_max_depth(), $header.get_max_buffer_size()) {
(3, 8) => _merkle_tree_depth_size_apply_fn!(3, 8, $($arg)*),
(5, 8) => _merkle_tree_depth_size_apply_fn!(5, 8, $($arg)*),
(6, 16) => _merkle_tree_depth_size_apply_fn!(6, 16, $($arg)*),
(7, 16) => _merkle_tree_depth_size_apply_fn!(7, 16, $($arg)*),
(8, 16) => _merkle_tree_depth_size_apply_fn!(8, 16, $($arg)*),
(9, 16) => _merkle_tree_depth_size_apply_fn!(9, 16, $($arg)*),
(10, 32) => _merkle_tree_depth_size_apply_fn!(10, 32, $($arg)*),
(11, 32) => _merkle_tree_depth_size_apply_fn!(11, 32, $($arg)*),
(12, 32) => _merkle_tree_depth_size_apply_fn!(12, 32, $($arg)*),
(13, 32) => _merkle_tree_depth_size_apply_fn!(13, 32, $($arg)*),
(14, 64) => _merkle_tree_depth_size_apply_fn!(14, 64, $($arg)*),
(14, 256) => _merkle_tree_depth_size_apply_fn!(14, 256, $($arg)*),
(14, 1024) => _merkle_tree_depth_size_apply_fn!(14, 1024, $($arg)*),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ pub fn merkle_tree_get_size(header: &ConcurrentMerkleTreeHeader) -> Result<usize
match (header.get_max_depth(), header.get_max_buffer_size()) {
(3, 8) => Ok(size_of::<ConcurrentMerkleTree<3, 8>>()),
(5, 8) => Ok(size_of::<ConcurrentMerkleTree<5, 8>>()),
(6, 16) => Ok(size_of::<ConcurrentMerkleTree<6, 16>>()),
(7, 16) => Ok(size_of::<ConcurrentMerkleTree<7, 16>>()),
(8, 16) => Ok(size_of::<ConcurrentMerkleTree<8, 16>>()),
(9, 16) => Ok(size_of::<ConcurrentMerkleTree<9, 16>>()),
(10, 32)=> Ok(size_of::<ConcurrentMerkleTree<10, 32>>()),
(11, 32)=> Ok(size_of::<ConcurrentMerkleTree<11, 32>>()),
(12, 32)=> Ok(size_of::<ConcurrentMerkleTree<12, 32>>()),
(13, 32)=> Ok(size_of::<ConcurrentMerkleTree<13, 32>>()),
(14, 64) => Ok(size_of::<ConcurrentMerkleTree<14, 64>>()),
(14, 256) => Ok(size_of::<ConcurrentMerkleTree<14, 256>>()),
(14, 1024) => Ok(size_of::<ConcurrentMerkleTree<14, 1024>>()),
Expand Down
16 changes: 16 additions & 0 deletions account-compression/sdk/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export type DepthSizePair = {
const allPairs: number[][] = [
[3, 8],
[5, 8],
[6, 16],
[7, 16],
[8, 16],
[9, 16],
[10, 32],
[11, 32],
[12, 32],
[13, 32],
[14, 64],
[14, 256],
[14, 1024],
Expand Down Expand Up @@ -55,6 +63,14 @@ export const ALL_DEPTH_SIZE_PAIRS: ValidDepthSizePair[] = allPairs.map(pair => {
export type ValidDepthSizePair =
| { maxDepth: 3; maxBufferSize: 8 }
| { maxDepth: 5; maxBufferSize: 8 }
| { maxDepth: 6; maxBufferSize: 16 }
| { maxDepth: 7; maxBufferSize: 16 }
| { maxDepth: 8; maxBufferSize: 16 }
| { maxDepth: 9; maxBufferSize: 16 }
| { maxDepth: 10; maxBufferSize: 32 }
| { maxDepth: 11; maxBufferSize: 32 }
| { maxDepth: 12; maxBufferSize: 32 }
| { maxDepth: 13; maxBufferSize: 32 }
| { maxDepth: 14; maxBufferSize: 64 }
| { maxDepth: 14; maxBufferSize: 256 }
| { maxDepth: 14; maxBufferSize: 1024 }
Expand Down

0 comments on commit e619e4d

Please sign in to comment.