-
Notifications
You must be signed in to change notification settings - Fork 5
feat: historical accounts Shelley address indexing #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: historical accounts Shelley address indexing #327
Conversation
Signed-off-by: William Hankins <william@sundae.fi>
…eward-processing' into whankinsiv/historical-accounts-address-indexing
Signed-off-by: William Hankins <william@sundae.fi>
…batching Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
…tter Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
…-accounts-address-indexing
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
| async fn prompt_pause(description: String, next_description: String) -> bool { | ||
| async fn prompt_pause(description: String) -> bool { | ||
| info!( | ||
| "Paused at {description}. Press [Enter] to step to {next_description}, or [c + Enter] to continue without pauses." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we've removed the next description here? Just for my understanding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed because next description needed to be called after incrementing to the next pause value. We don't want to increment the pause value (and the start time) until after the user ends the pause.
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
common/src/address.rs
Outdated
| }; | ||
|
|
||
| let payment_bits = (header >> 4) & 0x01; | ||
| let delegation_bits = (header >> 5) & 0x03; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let delegation_bits = (header >> 5) & 0x03; | |
| let delegation_bits = (header >> 5) & 0x07; |
Looking at CIP-0019, there are 8 valid types of Shelley addresses (2 kinds of payment part, 4 kinds of delegation part). The high bit of the header should always be 0, and if it isn't then this isn't a valid Shelley address.
This change will make the method reject header types 8 through 15 with an "invalid delegation bits" error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this Simon. I've fixed this issue and expanded the test_shelley_address_to_from_bytes_key_roundtrip() to check for the correct header byte for all address types in 10c2c09.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the updated version still has the issue. It'll decode all 8 valid address types, but it should fail when you try decoding something where the high bit is 0x80 (and right now it won't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a guard for header & 0x80 != 0 in 39a8919.
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
This PR implements
ShelleyAddressindexing byStakeAddressinhistorical_accounts_statealong with the corresponding REST handler as part of #256. Addresses are returned in the order they were first discovered on chain to match Blockfrost's return schema.Main changes
stake_delta_filterto group deltas by stake address and added a newaddressesfield toStakeAddressDelta, providing context on which Shelley addresses were involved in each account delta.mithril_snapshot_fetcherto include time deltas between pauses, providing a loose benchmarking mechanism for different implementations.handle_address_deltas,get_addresses, andGetAccountAssociatedAddressesquery handler inhistorical_accounts_state/accounts/{stake_address}/addressesendpoint viahandle_account_addresses_blockfrost.Performance evaluation
3 persistence approaches were evaluated:
Encoded Vec approach was extremely inefficient, consuming ~7x the storage of the duplicated key strategy.
Acceptable performance but ~10% slower due to read before write checks.
Writes new keys without reads with filtering handled in the getter.
Next steps:
The next PR will implement:
/accounts/{stake_address}/addresses/total/acounts/{stake_address}/addresses/assets/accounts/{stake_address}/utxos