Skip to content

Conversation

@cryptoAtwill
Copy link
Contributor

@cryptoAtwill cryptoAtwill commented Oct 22, 2025

This PR improves the previous PR by introducing a bitmap to count which validator has pre-commit vote signature included.

This excludes:

  • Validator with no submission
  • Validator with nil vote

Then contract will validate the cert onchain.

The point of this PR is to reduce gas usage for cometbft light client verification.


Note

Introduce bitmap-backed validator certificates for CometBFT quorum, adjust checkpoint/app-hash handling, and wire through node, CLI, and provider with new APIs and validations.

  • Contracts (Solidity):
    • Light client: Replace signature array with ValidatorCertificate { bitmap, signatures }; quorum verification iterates via bitmap.
    • Checkpointing: submitBottomUpCheckpoint now accepts (LightHeader, ValidatorCertificate, CanonicalVote) and treats app hash as height-1; add lastCommitmentHeight, rename internal tracking; recordAppHashBreakdown enforces sequencing and only records non-empty batches; expose deriveAppHash/validateAppHash as public.
    • Validation: Enforce activeValidatorsLimit <= uint8::MAX; add TooManyValidators; change InvalidCheckpointEpoch to include (expected, actual).
    • Selectors/Tests: Update selectors and integration tests; add new SubnetCheckpoint tests.
  • Provider/Relayer (Rust):
    • Add ValidatorCertificate ABI type and bitmap construction; submit_signed_header now sends certificate; new get_last_app_commitment_height and app-hash breakdown submission uses Fendermint state root.
    • CLI relayer requires --fendermint-rpc-url; integrate fendermint_rpc; default max_parallelism lowered.
  • Node/Fendermint:
    • App hash derived via ABI tuple keccak; expose state_root in StateParams; keep full state history for light client validation.
  • Encoding:
    • Add hex (de)serialization for Vec<u8> when human-readable.
  • Misc:
    • Small API/field renames and additional test coverage.

Written by Cursor Bugbot for commit 92dfd25. This will update automatically on new commits. Configure here.

@cryptoAtwill cryptoAtwill requested a review from a team as a code owner October 22, 2025 11:19
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

)
.await?;

next_height += self.metadata.period as u64;
Copy link

Choose a reason for hiding this comment

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

Bug: Infinite Loop in App Hash Breakdown Submission

The submit_missing_app_hash_breakdowns method can enter an infinite loop. If query_app_hash_breakdown returns None, next_height isn't incremented, causing the loop to repeatedly query the same height indefinitely.

Fix in Cursor Fix in Web

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.

1 participant