Skip to content

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

Open
crazywriter1 wants to merge 1 commit intocirclefin:mainfrom
crazywriter1:refactor/share-commit-certificate-http-types
Open

refactor(types): share HTTP commit certificate JSON types across evm-node and consensus#46
crazywriter1 wants to merge 1 commit intocirclefin:mainfrom
crazywriter1:refactor/share-commit-certificate-http-types

Conversation

@crazywriter1
Copy link
Copy Markdown

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
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.

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