Uh oh!
There was an error while loading. Please reload this page.
feat: batch address trees - #18
Conversation
b089102 to
db382f7Compareed8b8f0 to
c24977fCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| for (new_address, seq) in event | ||
| .new_addresses | ||
| .iter() | ||
| .zip(event.address_sequence_numbers.iter()) | ||
| { | ||
| let tree_info = TreeInfo::get(&new_address.mt_pubkey.to_string()) | ||
| .ok_or(IngesterError::ParserError("Missing queue".to_string()))? | ||
| .clone(); | ||
| state_update_event.addresses.push(AddressQueueUpdate { | ||
| tree: tree_info.tree.into(), | ||
| address: new_address.address, | ||
| queue_index: seq.seq, | ||
| }); | ||
| } |
There was a problem hiding this comment.
| for(new_address, seq)in event | |
| .new_addresses | |
| .iter() | |
| .zip(event.address_sequence_numbers.iter()) | |
| { | |
| let tree_info = TreeInfo::get(&new_address.mt_pubkey.to_string()) | |
| .ok_or(IngesterError::ParserError("Missing queue".to_string()))? | |
| .clone(); | |
| state_update_event.addresses.push(AddressQueueUpdate{ | |
| tree: tree_info.tree.into(), | |
| address: new_address.address, | |
| queue_index: seq.seq, | |
| }); | |
| } | |
| for(new_address, seq)in event | |
| .new_addresses | |
| .iter() | |
| .zip(event.address_sequence_numbers.iter()) | |
| { | |
| state_update_event.addresses.push(AddressQueueUpdate{ | |
| tree: new_address.mt_pubkey.into(), | |
| address: new_address.address, | |
| queue_index: seq.seq, | |
| }); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| pub const MAX_HEIGHT: usize = 32; | ||
| pub async fn get_subtrees( |
There was a problem hiding this comment.
shouldn't this be in persisted_indexed_merkle_tree ?
There was a problem hiding this comment.
I think it makes sense to leave it here, because persisted_state_tree stores nodes for indexed trees, and persisted_indexed_merkle_tree works more like indexed array.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ananas-block
left a comment
There was a problem hiding this comment.
Thanks!
TLDR on comments:
- are we sure queue indices are set correctly if we insert 2 addresses in the same tree in the same tx?
- found some dead code in
parse_public_transaction_event - PublicTransactionEvent::V1 maybe we can get away with less diff by implementing From
- Final root assert in test
- couple smaller improvements
…id-arg feat: add support for custom account compression program ID
| @@ -79,18 +77,15 @@ solana-program = "1.18.0" | |||
| solana-sdk = "1.18.0" | |||
Uh oh!
There was an error while loading. Please reload this page.
…d address is in the AddressQueue but not in tree yet, we should return error. For V1 trees we still return non-inclusion proof, because we don't have information about V1 queue. * Add offset as request parameter to get_batch_address_update_info. * Various cleanups
| light-compressed-account = { git = "https://github.com/Lightprotocol/light-protocol", rev = "368f9f08272db78c74b2ade1a1c2fead27dd0a96" } | ||
| light-concurrent-merkle-tree = { git = "https://github.com/Lightprotocol/light-protocol", rev = "368f9f08272db78c74b2ade1a1c2fead27dd0a96" } | ||
| light-hasher = "2.0.0" | ||
| light-hasher = { git = "https://github.com/Lightprotocol/light-protocol", rev = "368f9f08272db78c74b2ade1a1c2fead27dd0a96" } |
There was a problem hiding this comment.
why was this necessary?
(I didn't want to release light-hasher again.)
There was a problem hiding this comment.
light-merkle-tree-reference has light-hasher dependency as well => there are multiple different versions of crate light_hasher in the dependency graph
Overview
This pr adds support for batch address updates and introduces a new API endpoint
getBatchAddressUpdateInfoChanges:
API
getBatchAddressUpdateInfoendpoint.Retrieves addresses pending insertion from the new address queue, along with necessary proofs and context for batch updates.
Request:
Response:
DB
Added
address_queuestable, corresponding models & migrations.Table structure:
Events
Added PublicTransactionEventV2 structure and parsing logic which contains MerkleTreeSequenceNumberV2(
tree_pubkey, queue_pubkey, tree_type, seq).Tests
tests/integration_tests/batched_state_tree_tests.rs
Contains new
test_batched_address_transactionstest.Asserts:
getBatchAddressUpdateInforeturn non-empty queue after indexing of initial 50 txs and contain valid expected addresses.TODO: