Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m18s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 20s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 40s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 49s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 21s
Validation / validate-genesis (push) Successful in 25s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m11s
Validation / validate-documentation (push) Failing after 14s
Verify Deployment / Verify Deployment (push) Failing after 45s
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface, checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services, relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.8 KiB
Solidity
52 lines
1.8 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {CheckpointStorage} from "../storage/CheckpointStorage.sol";
|
|
|
|
/// @title CheckpointEIP712 — typed data for relayer + validator attestations
|
|
library CheckpointEIP712 {
|
|
bytes32 public constant DOMAIN_TYPEHASH =
|
|
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
|
|
|
|
bytes32 public constant BATCH_ATTESTATION_TYPEHASH = keccak256(
|
|
"BatchAttestation(uint64 chainId,uint64 batchId,uint256 checkpointBlock,bytes32 blockHash,bytes32 stateRoot,bytes32 paymentsRoot,uint64 previousBatchId)"
|
|
);
|
|
|
|
function domainSeparator(address verifyingContract, uint256 chainId) internal pure returns (bytes32) {
|
|
return keccak256(
|
|
abi.encode(
|
|
DOMAIN_TYPEHASH,
|
|
keccak256("Chain138MainnetCheckpoint"),
|
|
keccak256("2"),
|
|
chainId,
|
|
verifyingContract
|
|
)
|
|
);
|
|
}
|
|
|
|
function hashBatchAttestation(CheckpointStorage.CheckpointHeader memory header) internal pure returns (bytes32) {
|
|
return keccak256(
|
|
abi.encode(
|
|
BATCH_ATTESTATION_TYPEHASH,
|
|
header.chainId,
|
|
header.batchId,
|
|
header.checkpointBlock,
|
|
header.blockHash,
|
|
header.stateRoot,
|
|
header.paymentsRoot,
|
|
header.previousBatchId
|
|
)
|
|
);
|
|
}
|
|
|
|
function digest(
|
|
address verifyingContract,
|
|
uint256 chainId,
|
|
CheckpointStorage.CheckpointHeader memory header
|
|
) internal pure returns (bytes32) {
|
|
bytes32 structHash = hashBatchAttestation(header);
|
|
bytes32 domain = domainSeparator(verifyingContract, chainId);
|
|
return keccak256(abi.encodePacked("\x19\x01", domain, structHash));
|
|
}
|
|
}
|