-
Notifications
You must be signed in to change notification settings - Fork 41
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
Block Number beacon in cardano transaction #1727
Block Number beacon in cardano transaction #1727
Conversation
Adapt only code where other types don't need to be modified as well.
Making this change also result in updating `TransactionsImporter` and `BlockRangeRootRetriever` traits methods to use a chain point. Only `mithril-persistence` is adapted to this changes in this commit.
…ockNumber` Plus add it to the openapi as it was missing.
Before it was using an ImmutableFileNumber for both bounds
As we can't retrieve the immutable file number associated to a block number if it's not stored in the database (which will be typically the case of the upper bound).
Ignoring the lower bound given has parameter. We ignore it since it's a block number and not a immutable file number and retrieving the later using the former is difficult since there's no available function to do that in the cardano api.
…onRepository As it will be needed from now on to compute the lower bound passed to the BlockScanner.
With this change the lower bound of the scanner is now based on block number instead of immutable file number.
* Give the LowerBoundFinder needed by the block scanner * Remove the transaction 'store' build since it's already provided by the transaction 'repository' build
…hainPoint Note: not compiling, we still need to update the `CardanoTransactionsSnapshot`.
Leaving only one required to compute the immutable block scanner lower bound.
Instead of `Epoch,ChainPoint`. This is because we use this value as the upper bound of the blocks to import and can't known easily the associated block hash and slot number needed to constitute a ChainPoint (and we only need them for the lower bound to allow Pallas to known the starting point).
This force to make the same change to the `TransactionImporter`, `TransactionRetriever`,`BlockScanner` and the `CardanoTransactionSnapshot`. When a lower bound was required this is when we use a `ChainPoint`(instead of a block number as before). To do this we added a new condition to the `GetCardanoTransactionQuery` that get the transactions with the highest block number in db (all transaction with a same block number also share their slot number and block hash). Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
Since the importer doesn't know anymore about immutable file numbers and the current block scanner role is precisely to fetch them for its `ImmutableBlockStreamer`. Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
To compute the block number to be signed based on the chain tip. Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
And pass them where needed to deduce a signed entity type from a time point. Also define a default configuration with: * `security_parameter`: 3000 * `step`: 90 End to end use more lax paramters (security param: 20, step: 15) since it's far faster and the last transactions we see included have a block number not that high (arround ~450).
…ransaction Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
Test Results 3 files ±0 43 suites ±0 8m 34s ⏱️ ±0s Results for commit 70a8a61. ± Comparison against base commit 3b542fd. This pull request removes 7 and adds 16 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
By running its `import.sh` script on a 'run only' end to end. Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
96d8bcf
to
fc41440
Compare
internal/mithril-persistence/src/database/repository/cardano_transaction_repository.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/artifact_builder/cardano_transactions.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.
Good job! LGTM 🚀
I left few comments and typo fixes below.
async fn parse_and_store_transactions_not_imported_yet( | ||
&self, | ||
from: Option<ImmutableFileNumber>, | ||
until: ImmutableFileNumber, | ||
from: Option<ChainPoint>, |
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.
Do we really need the full ChainPoint
here?
from: Option<ChainPoint>, | |
from: Option<BlockNumber>, |
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.
We need the full chain point for the BlockStreamer
called by this method.
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.
We may use a BlockNumber
but doing so we need to transfer the responsibility to obtain a chain point from a block number to the streamer.
This would be cumbersome since:
- The lower bound is acquired by the importer (that part of its current role), to do so it do a database round-trip.
- We would need to define a trait that take a block number as parameter and return a chain point ... implemented by doing another database round-trip (so two needed instead of one as now).
Another possibility would be to remove altogether the lower bound computation from the importer and transfer it to the scanner.
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.
Indeed this shoudl probably be the responsibility of the scanner.
This can be done in a separate PR 👍
mithril-common/src/messages/cardano_transaction_snapshot_list.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.
Looks good
internal/mithril-persistence/src/database/repository/cardano_transaction_repository.rs
Show resolved
Hide resolved
mithril-aggregator/src/artifact_builder/cardano_transactions.rs
Outdated
Show resolved
Hide resolved
mithril-common/src/messages/cardano_transaction_snapshot_list.rs
Outdated
Show resolved
Hide resolved
- Aggregator `cardano_transactions_signing_config.step` from 90 to 120. - Adjusts/fix multiples comments - Add missing types in `mithril-client` re-exported common types. Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
Add a test that check the `get_transaction_highest_chain_point` of the `CardanoTransactionRepository` handle correcly the common case of multiple transaction with the same chain point. Clarify cardano transactions artificat builder tests. Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
3866581
to
026f3d6
Compare
nodes: * Mithril-aggregator from `0.5.14` to `0.5.15` * Mithril-client from `0.8.1` to `0.8.2` * Mithril-client-cli from `0.9.0` to `0.9.1` * Mithril-client-wasm from `0.3.1` to `0.3.2` * Mithril-common from `0.4.11` to `0.4.12` * Mithril-signer from `0.2.139` to `0.2.140` websites: * Mithril-explorer from `0.7.0` to `0.7.1` internal: * Mithril-persistence from `0.2.1` to `0.2.2` test-lab * Mithril-aggregator-fake from `0.3.1` to `0.3.2` * Mithril-end-to-end from `0.4.13` to `0.4.14`
de1d279
to
70a8a61
Compare
Content
This PR changes the beacon used for the
CardanoTransactions
signed entity type:CardanoDbBeacon
(aka: network, epoch, immutable file number)This changes decouples the production of cardano transactions signatures and proofs from the immutable file number and the cardano node database structure. Allowing us to go closer to the tip of the chain since, with a adapted block streamer, we won't have to wait for a immutable to be complete update our stored transactions.
In depth
cardano_transactions_signing_config
.CardanoTransactionsSnapshot
artifact: replacebeacon
withblock_number
(note: the epoch can still be fetched if it's wrapped by aSignedEntity<T>
and is added to the related messages).ProtocolMessage
andCardanoTransactionsProofsMessage
: renamelatest_immutable_file_number
tolatest_block_number
.BlockScanner
trait: use aOption<ChainPoint>
for its lower bound and aBlockNumber
for the upper bound. Previously it used aImmutableFileNumber
for both.CardanoBlockScanner
: ignore the bounds given as parameter and compute them itself (lower bound from db and upper bound take all completed immutables) since it still works using immutables files and there's no way go get the immutable file that contains a given block from the chain.TransactionsImporter
andBlockRangeRootRetriever
traits, to use aBlockNumber
instead of aImmutableFileNumber
.CardanoTransactions
from Aggregator database since their beacons changed.signed_entity
instead of relying on the deprecatedbeacon
property.Pre-submit checklist
Comments
This would have been considered a network breaking change on a stable signed entity type.
Issue(s)
Closes #1697