-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add /artifact/cardano-database/epoch/{epoch}
route + support epoch expansion from latest
in some routes
#2734
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
Test Results 4 files ± 0 168 suites ±0 23m 17s ⏱️ -12s Results for commit 99b441b. ± Comparison against base commit 046a4f8. This pull request removes 6 and adds 19 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
fd20823
to
d023666
Compare
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.
LGTM 👍
mithril-aggregator/src/database/repository/signed_entity_store.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/http_server/routes/artifact_routes/cardano_database.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/http_server/routes/artifact_routes/cardano_database.rs
Outdated
Show resolved
Hide resolved
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.
LGTM 👍
…date usages Instead of lists, since most of the time we only need one value and it's cubersome to extract it from the generated Vec.
To avoid collision when stored in a database
- Add a indexed `epoch` virtual column to `signe_entity` table, computed from the discriminant beacon - Supersed `GetSignedEntityRecordQuery::cardano_stake_distribution_by_epoch` with a `by_signed_entity_type_and_epoch` method that works on any discriminant - strengthen `GetSignedEntityRecordQuery` tests & tooling
307be9e
to
1d4af19
Compare
…d_entity_by_epoch`
…pport Actual epoch retrieval is done with a async lambda to give flexibility to the caller so they may do it beforehand or make the expander perform the operation.
Where epoch can be either a integer, `latest`, or `latest-{offset}`
... when the epoch service is unavailable
Cardano Stake Distribution signed entities are created with an offset of `-1` to the epoch, this must be reflected to the epoch expansion when using `latest` (with or without additional offset). Else querying with `latest` will always returns a `404`.
- fix/enhance some doc comments and logs - use u64 everywhere for offset configuration and parsing - add `MAX_ARTIFACT_EPOCH_OFFSET` constant in the DI - `expand_epoch`: - use const value from `"latest".len()` instead of `7` - tests: add decimal cases
instead of being a child of the `middleware` file and module
1d4af19
to
063e840
Compare
* mithril-aggregator from `0.7.87` to `0.7.88` * mithril-common from `0.6.21` to `0.6.22` * openapi.yaml from `0.1.53` to `0.1.54`
063e840
to
99b441b
Compare
Content
This PR add two main features:
/artifact/cardano-database/epoch/{epoch}
routelatest
orlatest-{offset}
in routes that take anepoch
parameters in their pathAggregator
epoch
virtual column to thesigned_entity
table, computed from the json value in thebeacon
column. This column is indexed to allow fast filtering.GetSignedEntityRecordQuery::cardano_stake_distribution_by_epoch
intoby_signed_entity_type_and_epoch
SignedEntityStorer
: addget_last_signed_entities_by_type_and_epoch
get_cardano_database_list_message_by_epoch
/artifact/cardano-database/epoch/{epoch}
routemiddleware::parameters::expand_epoch
helper. It parse the epoch if it's an integer or try to fetch its value from the epoch service if it'slatest{-offset}
.parameters::expand_epoch
in routes that allow epoch filtering (new route above, get/cardano-stake-distribution/epoch/{epoch}
,signers/registered/{epoch}
max_artifact_epoch_offset
to theRouterConfig
, value hard-coded to5
in the dependency injection layer.max_artifact_epoch_offset
as the upper limit when expanding epoch in artifacts routesCommon
Pre-submit checklist
Issue(s)
Relates to #2704