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>
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.signBatchAttestation = signBatchAttestation;
|
|
exports.normalizeEcdsaSignature = normalizeEcdsaSignature;
|
|
const ethers_1 = require("ethers");
|
|
const BATCH_ATTESTATION_TYPES = {
|
|
BatchAttestation: [
|
|
{ name: 'chainId', type: 'uint64' },
|
|
{ name: 'batchId', type: 'uint64' },
|
|
{ name: 'checkpointBlock', type: 'uint256' },
|
|
{ name: 'blockHash', type: 'bytes32' },
|
|
{ name: 'stateRoot', type: 'bytes32' },
|
|
{ name: 'paymentsRoot', type: 'bytes32' },
|
|
{ name: 'previousBatchId', type: 'uint64' },
|
|
],
|
|
};
|
|
/** Matches CheckpointEIP712.digest / ValidatorSigVerifierExtension.beforeSubmit. */
|
|
async function signBatchAttestation(wallet, verifyingContract, header) {
|
|
const chainId = Number((await wallet.provider.getNetwork()).chainId);
|
|
const domain = {
|
|
name: 'Chain138MainnetCheckpoint',
|
|
version: '2',
|
|
chainId,
|
|
verifyingContract,
|
|
};
|
|
const message = {
|
|
chainId: header.chainId,
|
|
batchId: header.batchId,
|
|
checkpointBlock: header.checkpointBlock,
|
|
blockHash: header.blockHash,
|
|
stateRoot: header.stateRoot,
|
|
paymentsRoot: header.paymentsRoot,
|
|
previousBatchId: header.previousBatchId,
|
|
};
|
|
const sig = await wallet.signTypedData(domain, BATCH_ATTESTATION_TYPES, message);
|
|
return normalizeEcdsaSignature(sig);
|
|
}
|
|
/** OpenZeppelin ECDSA.recover expects v=27|28; ethers v6 may return 0|1. */
|
|
function normalizeEcdsaSignature(sig) {
|
|
const bytes = ethers_1.ethers.getBytes(sig);
|
|
if (bytes.length !== 65)
|
|
return sig;
|
|
const v = bytes[64];
|
|
if (v < 27)
|
|
bytes[64] = v + 27;
|
|
return ethers_1.ethers.hexlify(bytes);
|
|
}
|