-
Notifications
You must be signed in to change notification settings - Fork 4
feat: address_state module #241
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
…' into whankinsiv/setup-address-state
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
…' into whankinsiv/setup-address-state
Signed-off-by: William Hankins <[email protected]>
…moval) Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
…getters Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
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.
Very nicely done Will!
Ok(data) | ||
} | ||
|
||
pub fn stake_address_string(&self) -> Result<Option<String>> { |
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 know these are fairly straightforward methods, but would it be worth adding to/creating tests to cover them?
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.
Tests for both script and normal addresses to stake_address_string added in a1767e6.
|
||
use crate::{handlers_config::HandlersConfig, types::AddressInfoREST}; | ||
|
||
pub async fn handle_address_single_blockfrost( |
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.
More of a nit, but I do appreciate the /path this handle method corresponds to above this as a comment.
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.
Added comments above all address related handlers to indicate which endpoints they cover in 3dfa776.
); | ||
} | ||
|
||
match batch.commit() { |
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.
Should we limit the batch chunk by chunk, otherwise it ends up batching tons of data which is not that efficient.
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 decided to do it this way so that if the program is exited or crashes mid persistence we wont have a corrupted DB. I'm open to any alternative solutions you may have.
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
This PR enables optional indexing of address-related data required for conformance with the Blockfrost API specification.
Storage lifecycle:
volatile
layer which tracks live address updates within the rollback window.volatile
and transferred into a pending queue within theImmutableAddressStore
.Retrieving live state:
volatile
layer, applying any deltas relevant to the queried address on top of the immutable snapshot to produce an up-to-date view of the address state.Data indexed:
REST handlers:
/addresses/{address}
endpoint./addresses/{address}/totals
,/addresses/{address}/utxos
, and/addresses/{address}/transactions
endpoints, all of which rely on the data indexed by this module.Next steps:
assets_state
module to adopt the same storage lifecycle will significantly reduce the RAM footprint for address and transaction indexing.