Skip to content

refactor(types): share HTTP commit certificate JSON types across evm-node and consensus#46

Merged
sergio-mena merged 2 commits intocirclefin:mainfrom
crazywriter1:refactor/share-commit-certificate-http-types
Apr 28, 2026
Merged

refactor(types): share HTTP commit certificate JSON types across evm-node and consensus#46
sergio-mena merged 2 commits intocirclefin:mainfrom
crazywriter1:refactor/share-commit-certificate-http-types

Conversation

@crazywriter1
Copy link
Copy Markdown
Contributor

Follow-up to #40 (re-opened after main was force-pushed and GitHub auto-closed the previous PR).

Summary

Introduces arc_consensus_types::commit_http with HttpCommitCertificate / HttpCommitSignature and try_into_commit_certificate() so the execution RPC (get_certificate) and consensus RPC sync paths deserialize the same JSON shape without duplicated structs.

Motivation

The wire format (height, round, block_hash, base64-encoded signature bytes) lived in two places, which risks drift and inconsistent handling. One shared module keeps JSON alignment between arc-evm-node and arc-node-consensus.

Changes

  • Add crates/types/src/commit_http.rs and pub mod commit_http in arc-consensus-types.
  • Add serde_with (with base64) to arc-consensus-types; update Cargo.lock.
  • arc-evm-node: re-export RpcCommitCertificate from HttpCommitCertificate; remove duplicate local types.
  • arc-node-consensus: deserialize via HttpCommitCertificate in RPC sync; use try_into_commit_certificate().
  • malachite-app HTTP RpcCommitCertificate uses Vec<HttpCommitSignature> for signatures (serialization unchanged).

Testing

  • cargo test -p arc-consensus-types
  • cargo test -p arc-evm-node get_certificate
  • cargo test -p arc-node-consensus (use OPENSSL_NO_VENDOR=1 if vendored OpenSSL build fails locally)
  • cargo clippy -p arc-consensus-types -p arc-node-consensus -p arc-evm-node --all-targets -- -D warnings

Add arc_consensus_types::commit_http (HttpCommitCertificate, HttpCommitSignature) and try_into_commit_certificate. Use from arc-evm-node get_certificate and malachite-app rpc_sync; RpcCommitCertificate HTTP response uses HttpCommitSignature. Add commit_http unit tests; serde_with dep + Cargo.lock.
@crazywriter1
Copy link
Copy Markdown
Contributor Author

Hi @ZhiyuCircle following up on #40: I rebased onto the latest main and opened this PR with the same change set. Could you take a look when you have a moment? Thanks again for the guidance.

@crazywriter1
Copy link
Copy Markdown
Contributor Author

Added a small follow-up commit only to fix CI formatting.

The previous run failed on Rust Formatting due to a rustfmt diff in crates/types/src/commit_http.rs. I ran cargo fmt --all and pushed the result. This is format only (no functional change), just to make the formatting check pass. @ZhiyuCircle

Copy link
Copy Markdown
Contributor

@sergio-mena sergio-mena left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @crazywriter1 for your contribution

@ZhiyuCircle ZhiyuCircle added the pending-import Merged PR awaiting reverse-sync to upstream label Apr 28, 2026
@sergio-mena sergio-mena merged commit 9c7ddbd into circlefin:main Apr 28, 2026
16 checks passed
@circle-github-action-bot circle-github-action-bot added imported and removed pending-import Merged PR awaiting reverse-sync to upstream labels Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants