-
Notifications
You must be signed in to change notification settings - Fork 5
feat: account assets REST endpoint #354
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
Conversation
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>
Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
|
|
||
| for block_map in drained_blocks { | ||
| for (addr, entry) in block_map { | ||
| let target = merged.entry(addr.clone()).or_insert_with(MergedDeltas::default); |
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.
Why do we insert defaults as our fallback here?
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 is to populate an empty entry for an address if the current block delta is the first time the address is detected in the epoch.
Signed-off-by: William Hankins <william@sundae.fi>
Description
This PR implements the
/accounts/{stake_address}/addresses/assetsendpoint. It also refactors theImmutableAddressStoreto merge block deltas in memory before persistence, fixing a bug where UTxOs spent in the same epoch they were created not being removed correctly.Related Issue(s)
#256 & #335
How was this tested?
Compared REST responses against Blockfrost using accounts with long standing balances such as stake1u88...cq5e4eww.

The handler itself serves as a runtime correctness test. The query fails if
address_statereturns any UTxO not found inutxo_state.Checklist
Impact / Side effects
Merging block deltas in memory before persistence reduces DB access frequency, improving sync performance when address UTxO, transaction, or totals indexing is enabled.
Reviewer notes / Areas to focus
Most logic changes are in
modules/address_state/src/immutable_address_store.rs.A known bug in totals persistence (tx count) will be addressed in a follow up PR implementing the
/accounts/{stake_address}/addresses/totalendpoint.