Skip to content

Sign security parameter offset - #3168

Merged
turmelclem merged 19 commits into
mainfrom
ctl/3098-sign-security-parameter-offset
Apr 8, 2026
Merged

Sign security parameter offset#3168
turmelclem merged 19 commits into
mainfrom
ctl/3098-sign-security-parameter-offset

Conversation

@turmelclem

@turmelclem turmelclem commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Content

This PR includes changes to sign (and verify) security parameter for Cardano Blocks and transactions.

  • introduce a new type BlockNumberOffset with arithmetic operation with exisiting BlockNumber
  • Improve SignedEntityType CardanoBlocksTransactions by adding security parameter BlockNumberOffset
    • remove usage of mithril_network_configuration_provider in artifact builder since security parameter is in signed entity type now
  • Refactor CardanoBlocksTransactionsSigningConfig by changing security_parameter attribute from BlockNumber to BlockNumberOffset
  • Add a new variant for the ProtocolMessagePartKey: CardanoBlocksTransactionsBlockNumberOffset
  • Sign the BlockNumberOffset in the compute_protocol_message of the signable builder implementation
  • Update the aggregator to Return the BlockNumberOffset in the proof/v2/ routes for blocks and transactions
  • Update the client library to verify that the BlockNumberOffset is signed by the certificate For both blocks and transactionsV2
  • Update the client CLI to display the depth of the certification in table result of certify commands (blocks and transactionsV2)
  • Update Examples client-cardano-block and client-cardano-transaction-v2 has been updated to log depth of the certification
  • Adding SQL migration to remove all signed_entity and certificate records of type 'blocks and transactions' to handle the new offset

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)
    • Add ADR blog post or Dev ADR entry (if relevant)
    • No new TODOs introduced

Closes #3098

Comment thread mithril-common/src/test/double/fake_data.rs Fixed
Comment thread mithril-common/src/test/double/fake_data.rs Fixed
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

Test Results

     5 files  ± 0     199 suites  ±0   1h 17m 39s ⏱️ -39s
 2 860 tests +13   2 860 ✅ +13  0 💤 ±0  0 ❌ ±0 
10 085 runs  +67  10 085 ✅ +67  0 💤 ±0  0 ❌ ±0 

Results for commit 606eb90. ± Comparison against base commit 6a8101a.

This pull request removes 2 and adds 15 tests. Note that renamed tests count towards both.
mithril-aggregator ‑ artifact_builder::cardano_blocks_transactions::tests::should_fail_to_compute_artifact_without_cardano_blocks_transactions
mithril-common ‑ entities::signed_entity_type::tests::signed_entity_with_shared_beacons_computes_different_hashes
mithril-common ‑ entities::block_number::tests::test_add_asign_block_number_offset
mithril-common ‑ entities::block_number::tests::test_add_asign_block_number_to_block_number_offset
mithril-common ‑ entities::block_number::tests::test_add_block_number_offset_to_block_number
mithril-common ‑ entities::block_number::tests::test_sub_block_number_offset_from_block_number
mithril-common ‑ entities::block_number_offset::tests::saturating_sub
mithril-common ‑ entities::block_number_offset::tests::test_add
mithril-common ‑ entities::block_number_offset::tests::test_add_asign_block_number
mithril-common ‑ entities::block_number_offset::tests::test_add_block_number_to_block_number_offset
mithril-common ‑ entities::block_number_offset::tests::test_deserialize
mithril-common ‑ entities::block_number_offset::tests::test_display
…

♻️ This comment has been updated with latest results.

@turmelclem turmelclem self-assigned this Apr 3, 2026
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch from 71ac835 to e0959ef Compare April 3, 2026 08:25
@turmelclem
turmelclem marked this pull request as ready for review April 3, 2026 08:26
Copilot AI review requested due to automatic review settings April 3, 2026 08:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Cardano blocks/transactions V2 signing and proof pipeline to include (and verify) the security parameter as a signed BlockNumberOffset, and exposes it through the aggregator proof V2 APIs and client-facing tooling.

Changes:

  • Introduces BlockNumberOffset and threads it through SignedEntityType::CardanoBlocksTransactions, protocol messages, and signable/artifact builders so it becomes part of what is signed.
  • Extends proof V2 messages + OpenAPI to return security_parameter, updates aggregator routes to populate it, and updates client verification to include it in the reconstructed protocol message.
  • Updates CLI and examples to display/log the resulting certification “block depth”.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openapi.yaml Adds security_parameter to proof V2 schemas and examples.
mithril-signer/tests/test_extensions/state_machine_tester.rs Adjusts test config to use BlockNumberOffset.
mithril-common/src/test/double/fake_data.rs Updates fake blocks+tx snapshots to use BlockNumberOffset.
mithril-common/src/test/double/dummies.rs Updates dummy messages/entities for the new signed entity shape.
mithril-common/src/test/crypto_helper/mk_extensions.rs Updates proof-message test helpers to include BlockNumberOffset.
mithril-common/src/test/builder/cardano_transactions_builder.rs Uses BlockNumberOffset for block numbering in test builder logic.
mithril-common/src/signable_builder/signable_builder_service.rs Changes blocks+tx signable builder beacon type to (BlockNumber, BlockNumberOffset).
mithril-common/src/signable_builder/interface.rs Declares the tuple beacon type as a Beacon.
mithril-common/src/signable_builder/cardano_blocks_transactions.rs Signs the offset via a new protocol message part key.
mithril-common/src/messages/proof_v2/cardano_transactions_proof.rs Adds security_parameter to tx proofs V2 message + verified wrapper.
mithril-common/src/messages/proof_v2/cardano_blocks_proof.rs Adds security_parameter to block proofs V2 message + verified wrapper.
mithril-common/src/entities/signed_entity_type.rs Extends CardanoBlocksTransactions with BlockNumberOffset and updates hashing/JSON beacon.
mithril-common/src/entities/signed_entity_config.rs Refactors blocks+tx signing config to use BlockNumberOffset and propagates it into the signed entity type.
mithril-common/src/entities/protocol_message.rs Adds ProtocolMessagePartKey::CardanoBlocksTransactionsBlockNumberOffset.
mithril-common/src/entities/mod.rs Exposes the new block_number_offset module/type.
mithril-common/src/entities/cardano_blocks_transactions_snapshot.rs Updates snapshot constructor to take an offset newtype.
mithril-common/src/entities/block_number.rs Adds arithmetic ops between BlockNumber and BlockNumberOffset.
mithril-common/src/entities/block_number_offset.rs New BlockNumberOffset newtype + arithmetic wrapper impls + tests.
mithril-client/tests/extensions/fake_aggregator/cardano_proof_v2.rs Updates fake cert protocol message to include the new signed key.
mithril-client/src/message.rs Includes the offset key in message reconstruction for proof verification.
mithril-client-cli/src/commands/cardano_transaction/certify/v2.rs Displays/logs block depth in certify output.
mithril-client-cli/src/commands/cardano_block/certify.rs Displays/logs block depth in certify output.
mithril-aggregator/tests/leader_signed_entity_config_propagation.rs Updates signing config test to use BlockNumberOffset.
mithril-aggregator/tests/create_certificate.rs Updates certificate creation tests for new signed entity type.
mithril-aggregator/src/tools/certificates_hash_migrator.rs Includes offset in formatted identifiers for blocks+tx signed entity types.
mithril-aggregator/src/services/signed_entity.rs Updates artifact builder wiring to use (BlockNumber, BlockNumberOffset) beacons.
mithril-aggregator/src/services/network_configuration_provider.rs Updates tests/config handling to use BlockNumberOffset.
mithril-aggregator/src/services/message.rs Updates message service tests for new config/entity shapes.
mithril-aggregator/src/services/epoch_service.rs Updates epoch service tests for new config/entity shapes.
mithril-aggregator/src/http_server/routes/proof_routes.rs Adds security_parameter to proof V2 responses for blocks and tx.
mithril-aggregator/src/dependency_injection/builder/protocol/artifacts.rs Removes network configuration provider dependency from blocks+tx artifact builder wiring.
mithril-aggregator/src/database/record/signed_entity.rs Updates test-only fake record generation match arm for new enum variant shape.
mithril-aggregator/src/database/query/epoch_settings/insert_or_ignore_epoch_settings.rs Updates epoch settings query tests for BlockNumberOffset.
mithril-aggregator/src/configuration.rs Updates configuration defaults/tests for BlockNumberOffset.
mithril-aggregator/src/artifact_builder/cardano_blocks_transactions.rs Refactors artifact builder to receive offset in the beacon and remove config lookup.
internal/mithril-protocol-config/src/test/double/configuration_provider.rs Updates protocol-config test doubles to use BlockNumberOffset.
internal/mithril-protocol-config/src/http.rs Updates protocol-config HTTP tests to use BlockNumberOffset.
internal/mithril-persistence/src/database/hydrator.rs Updates beacon hydration for blocks+tx to deserialize block_number_offset.
internal/mithril-aggregator-client/src/query/get/get_cardano_transaction_proof_v2.rs Updates client query tests for new security_parameter field.
internal/mithril-aggregator-client/src/query/get/get_cardano_block_proof.rs Updates client query tests for new security_parameter field.
examples/client-cardano-transaction-v2/src/main.rs Logs block depth from verified transactions.
examples/client-cardano-block/src/main.rs Logs block depth from verified blocks.

Comment thread mithril-common/src/entities/block_number_offset.rs Outdated
Comment thread internal/mithril-persistence/src/database/hydrator.rs
Comment thread mithril-common/src/entities/block_number.rs Outdated
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch 3 times, most recently from 5fd21c2 to 2e5c09d Compare April 3, 2026 09:26
@turmelclem
turmelclem temporarily deployed to testing-preview April 3, 2026 11:00 — with GitHub Actions Inactive
@turmelclem
turmelclem requested review from Alenar and jpraynaud April 3, 2026 13:26
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch 2 times, most recently from 2f5f79d to 17d866d Compare April 3, 2026 13:42

@Alenar Alenar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread mithril-aggregator/src/database/migration.rs Outdated
Comment thread mithril-aggregator/src/database/record/signed_entity.rs Outdated
Comment thread mithril-common/src/entities/signed_entity_type.rs Outdated
Comment thread mithril-common/src/entities/block_number.rs Outdated
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch from 17d866d to fb4b75b Compare April 3, 2026 15:18
@turmelclem
turmelclem temporarily deployed to testing-preview April 3, 2026 15:37 — with GitHub Actions Inactive

@jpraynaud jpraynaud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment thread mithril-common/src/entities/block_number.rs Outdated
Comment thread mithril-common/src/entities/signed_entity_type.rs Outdated
Comment thread openapi.yaml Outdated
Comment thread openapi.yaml Outdated
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch 3 times, most recently from e5166ab to 3bc737b Compare April 8, 2026 08:40
@turmelclem
turmelclem force-pushed the ctl/3098-sign-security-parameter-offset branch from 3bc737b to 4a4521b Compare April 8, 2026 09:19
@turmelclem
turmelclem temporarily deployed to testing-preview April 8, 2026 09:39 — with GitHub Actions Inactive
* client-cardano-block from `0.1.1` to `0.1.2`
 name = "client-cardano-transaction-v2" -version = "0.1.1" +version = "0.1.2" * mithril-aggregator-client from `0.1.9` to `0.1.10`
* mithril-persistence from `0.2.70` to `0.2.71`
* mithril-protocol-config from `0.1.6` to `0.1.7`
* mithril-aggregator from `0.8.41` to `0.8.42`
* mithril-client-cli from `0.13.2` to `0.13.3`
* mithril-client from `0.14.2` to `0.14.3`
* mithril-common from `0.6.62` to `0.6.63`
* mithril-signer from `0.3.28` to `0.3.29`
* mithril-aggregator-fake from `0.4.18` to `0.4.19`
* openapi.yaml from `0.1.60` to `0.1.61`
@turmelclem
turmelclem temporarily deployed to testing-preview April 8, 2026 10:03 — with GitHub Actions Inactive
@turmelclem
turmelclem merged commit 4d1d164 into main Apr 8, 2026
68 of 71 checks passed
@turmelclem
turmelclem deleted the ctl/3098-sign-security-parameter-offset branch April 8, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sign security parameter offset in ProtocolMessage for Blocks and Transactions

5 participants