Skip to content

feat(evm): week 2 contracts (EIP-712 + EndorsementVerifier)#1879

Open
atharrva01 wants to merge 7 commits into
LFDT-Panurus:feature/evm-network-driverfrom
atharrva01:evm-week2-contracts
Open

feat(evm): week 2 contracts (EIP-712 + EndorsementVerifier)#1879
atharrva01 wants to merge 7 commits into
LFDT-Panurus:feature/evm-network-driverfrom
atharrva01:evm-week2-contracts

Conversation

@atharrva01

@atharrva01 atharrva01 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

First half of week 2. Adds the Solidity contracts under x/token/services/network/evm/contracts (Foundry), kept out of the Go module. TokenState.sol and the integration tests come in PR 2b.

What's here:

  • StateDelta.sol and EIP712.sol: the frozen structs and EIP-712 encoding, mirroring the Go side byte for byte
  • EndorsementVerifier.sol: quorum signature check (ecrecover, low-s, unique signers, threshold)

21 forge tests pass. The Solidity digest matches the Go fixture for both the transfer and setup deltas (0xc9326b72 and 0xdca9a011), also checked against ethers v6.

On the Go side, StateDelta.Validate now rejects a few malformed deltas, and there's a second golden vector for the setup case.

The docs commit resyncs the plan and design (Besu as the backend, working rules, module isolation).

Note: forge-std is a git submodule, so run git submodule update --init.

adecaro and others added 4 commits June 30, 2026 15:46
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
…/hash types (LFDT-Panurus#1850)

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
…s#1853)

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
Working branch was rebuilt on the merged upstream (post LFDT-Panurus#1850/LFDT-Panurus#1853). Restores our finalized design doc, implementation plan (Week 2 updated for the snMarker fix and new digest) and plan.md tracker, none of which are meant to be upstreamed.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
@atharrva01 atharrva01 force-pushed the evm-week2-contracts branch from 938b22f to 2207162 Compare July 9, 2026 12:16
Foundry project under x/token/services/network/evm/contracts, kept out of
the Go module so forge never links into the driver.

- StateDelta.sol: frozen structs, same field order as the Go/EIP-712 type
- EIP712.sol: domain separator, type hashes, hashStruct, digest, mirroring
  the Go eip712 package
- EndorsementVerifier.sol: ecrecover, low-s, v check, unique signers and
  threshold over a digest; endorser set seeded at deploy

21 forge tests pass. Solidity reproduces both golden digests from the Go
fixture (transfer 0xc9326b72, setup 0xdca9a011), also checked with ethers v6.

Also tightens StateDelta.Validate (rejects setup params on non-setup deltas
and unsorted or duplicate metadata keys) and adds the setup digest vector on
the Go side. verify takes the final digest, since TokenState is the per-TMS
clone that owns the domain separator.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
- Besu is the acceptance backend, fabric-x-evm is a stretch
- working rules R1-R7, each from an actual slip on this branch
- module stays isolated under x/.../evm, core must not import it
- snMarker query-surface decision noted for PR 2b

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
@atharrva01 atharrva01 force-pushed the evm-week2-contracts branch from 2207162 to 7180b6d Compare July 9, 2026 12:19
@atharrva01 atharrva01 changed the title feat(evm): Week 2 (PR 2a) — smart contracts: EIP-712 library + EndorsementVerifier feat(evm): week 2 contracts (EIP-712 + EndorsementVerifier) Jul 9, 2026
@adecaro adecaro self-requested a review July 10, 2026 09:14
@adecaro adecaro self-assigned this Jul 10, 2026
- remove em dashes from code comments in the contracts and Go files
- document configNetworkResolver.IsEVMNetwork

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>

@adecaro adecaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Please, rebase and run make checks and make lint to make sure everything is fine.

@adecaro adecaro added this to the EVM-based Network Driver milestone Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants