refactor+test: prover preparatory work#3072
Merged
Merged
Conversation
Test Results 5 files ± 0 190 suites ±0 57m 53s ⏱️ + 1m 41s Results for commit f41e270. ± Comparison against base commit 925875b. This pull request removes 25 and adds 43 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Alenar
force-pushed
the
djo/2987/prover_preparatory_work
branch
from
March 6, 2026 14:55
32d69a0 to
570b408
Compare
There was a problem hiding this comment.
Pull request overview
This PR is preparatory work for an upcoming blocks and transactions prover (tracking issue #2987). It cleans up the existing code and adds new test utilities so they can be used in future prover tests.
Changes:
- Extract
CardanoBlockTransactionMkTreeNodefromcardano_block.rsinto its own dedicated module, and add aFrom<CardanoBlockWithTransactions> for CardanoBlockconversion. - Refactor
CardanoTransactionsBuilderinmithril-common: renamebuild_block_rangestobuild_transactions_for_block_ranges, change slot number generation from per-transaction to per-block, and add newbuild_blocks/build_blocks_for_block_rangesmethods that produceCardanoBlockWithTransactions. - Enhance
InMemoryChainDataStoreinmithril-cardano-node-chain: addget_blocks_by_hashes,get_transactions_by_hashes,get_blocks_with_transactions_in_block_ranges,get_blocks_with_transactions_in_ranges, implementBlockRangeRootRetriever, and add acompute_block_rangesbuilder method.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
mithril-common/src/entities/cardano_block_transaction_mktree_node.rs |
New file: extracted CardanoBlockTransactionMkTreeNode type and all its tests from cardano_block.rs. |
mithril-common/src/entities/cardano_block.rs |
Removed CardanoBlockTransactionMkTreeNode (now extracted); added From<CardanoBlockWithTransactions> for CardanoBlock. |
mithril-common/src/entities/mod.rs |
Re-exports the new cardano_block_transaction_mktree_node module. |
mithril-common/src/test/builder/cardano_transactions_builder.rs |
Major refactor: new block-centric builder logic; renamed method; new build_blocks* methods; reorganized tests into sub-modules. |
internal/cardano-node/mithril-cardano-node-chain/src/test/double/chain_data_store.rs |
New retrieval methods, BlockRangeRootRetriever impl, and compute_block_ranges builder method; new and updated tests. |
internal/cardano-node/mithril-cardano-node-chain/src/chain_importer/mod.rs |
Exposes BlockRangeImporter as pub(crate) for use in the test double. |
mithril-aggregator/src/services/prover_legacy.rs |
Updates test calls from build_block_ranges to the renamed build_transactions_for_block_ranges. |
…dicated file module
…ChainDataStore` So it can be used in the new prover tests
…new prover to `InMemoryChainDataStore` To allow its usage in the new prover test
…ranges` By leveraging tested `BlockRangeImporter`
…ges` to `build_transactions_for_block_ranges` and restructure tests thoses changes prepare the extension of capabilities of the builder to also build `CardanoBlockWithTransaction`.
…y on blocks instead of transactions this will allow to extend it's capabilities to the builds of `CardanoBlockWithTransactions`.
…to `CardanoTransactionsBuilder`
Alenar
force-pushed
the
djo/2987/prover_preparatory_work
branch
from
March 9, 2026 16:52
570b408 to
0c8750a
Compare
* mithril-cardano-node-chain from `0.1.23` to `0.1.24` * mithril-aggregator from `0.8.32` to `0.8.33` * mithril-common from `0.6.54` to `0.6.55`
Alenar
force-pushed
the
djo/2987/prover_preparatory_work
branch
from
March 9, 2026 16:53
0c8750a to
f41e270
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Content
This PR includes refactors and new tests utilities that will be used for the upcoming blocks and transactions prover.
CardanoBlockTransactionMkTreeNodeto a dedicated file moduleInMemoryChainDataStore(mithril-cardano-node-chain) in order to be able to use it in the upcoming prover tests:mithril_common::signable_builder::BlockRangeRootRetrieverget_blocks_by_hashes,get_transactions_by_hashes,get_blocks_with_transactions_in_block_ranges,get_blocks_with_transactions_in_rangescompute_block_rangesto its builder to generate realistic block ranges root, avoiding the need to provide them manually (which is still an option)CardanoTransactionsBuilder(mithril-common):build_block_rangestobuild_transactions_for_block_ranges: to avoid confusion with a new methodbuild_blocksandbuild_blocks_for_block_rangesthat producesCardanoBlockWithTransactionsinstead ofCardanoTransactionPre-submit checklist
Issue(s)
Relates to #2987