-
Notifications
You must be signed in to change notification settings - Fork 39
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
Store block range roots in db #1650
Conversation
Test Results 3 files ± 0 43 suites ±0 8m 16s ⏱️ -15s Results for commit b0decd8. ± Comparison against base commit 86c172c. This pull request removes 15 and adds 59 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
06e012f
to
9ca6619
Compare
mithril-aggregator/src/database/provider/block_range_root/get_block_range_root.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/database/record/interval_without_block_range_root.rs
Show resolved
Hide resolved
mithril-aggregator/src/services/cardano_transactions_importer.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/services/cardano_transactions_importer.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/services/cardano_transactions_importer.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 overall, just need to clarify @jpraynaud's last comments.
835021a
to
409530d
Compare
This reduce the 'move' boilerplates needed to work with the mocks.
Since we will change it's main method signature to retrieve a list of blocks instead of a list of transactions.
Automatically implemented for all provider if the Provider implement a new trait `GetAllCondition`.
This allow to lessen the compling between the tests and the implementations, making the code easier to changes while keeping the tests safety net.
By only loading a block range worth of transactions from db instead of loading them all at once.
To uniformise use of ranges since `BlockRange` use a Range internaly.
Two transactions that we get from the chain may have a gap of block numbers that is larger than a block range. In this case the importer still tried to compute the merkle root for the block ranges that did not contains any transaction, leading to an error.
It raised an retryable error that the state machine tried immediatly to retry leading to a loop. + Refactor the import_block_range method to flatten it's code, making it more readble. + Add a log that tell which BlockRangeRoots the importer will try to compute.
…ent state Before it only yielded that no work was needed
* start & end must be multiples of BlockRange::Length * start & end interval must be equal to BlockRange::Length
Instead of rowid, this is more consistent accross nodes.
Previous naive implementation was failing with very large intervals (larger than several millions) since the whole interval was loaded in memory. In order to avoid this side effect an iterator type, `BlockRangesSequence`, is now yielded. Allowing to lazely iterate a sequence of block ranges.
To be consistent with all usages or ranges for blocks, this remove the last usage of a range inclusive to only use non-inclusive range. The last case of RangeInclusive was a test that checked that an inverval is contained in a block ranges sequence. To do so it add a `contains(range)` to `BlockRangesSequence`.
b72b1df
to
01df776
Compare
…nge root * This computation forgot to handle the case when the last stored transaction is included at the end of the last stored block range root. When this case was seen it yielded an error instead of saying that there was no work to be done. record it derives from. This allow to write simpler tests.
* Mithril-aggregator from `0.4.62` to `0.4.63` * Mithril-common from `0.3.33` to `0.3.34` * Mithril-signer from `0.2.126` to `0.2.127` * Mithril-persitence from `0.1.6` to `0.1.7`
01df776
to
b0decd8
Compare
Content
This PR add block range root (aka a
BlockRange
and it's associated transactions merkle root) computation and storage.This step is added to the
CardanoTransactionImporter
of signer & aggregator nodes after the import of the transactions.Other changes:
mithril-common
: Change and rename theTransactionParser
into aBlockScanner
that returns a dedicated typeScannedBlock
that can be converted into a list of transactions. This simplify the next refactor to make it stream the blocks in order to lessen the scanning footprint (Stream import of Cardano transactions #1646).mithril-persistence
: Add a system to add quickly aget_all
method to a type that implement theProvider
trait. You can now implement theGetAllCondition
trait to the entity of the provider to automatically derive theGetAllProvider
trait that define theget_all
method.Pre-submit checklist
Issue(s)
Closes #1633