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>
75 lines
3.4 KiB
JavaScript
75 lines
3.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.AdminCheckpointIngress = void 0;
|
|
exports.buildCheckpointContract = buildCheckpointContract;
|
|
const ethers_1 = require("ethers");
|
|
const leafCodec_1 = require("../leafCodec");
|
|
const CHECKPOINT_HEADER_TUPLE = 'tuple(uint64 batchId,uint64 previousBatchId,uint64 chainId,uint256 checkpointBlock,uint256 startBlock,uint256 endBlock,bytes32 blockHash,bytes32 stateRoot,bytes32 paymentsRoot,bytes32 receiptsRoot,uint16 txCount,uint32 flags,uint64 submittedAt,address submitter,bytes32 contentURI)';
|
|
const PAYMENT_LEAF_TUPLE = 'tuple(bytes32,address,address,uint256,uint256,uint64,uint256,bool)';
|
|
const PAYMENT_LEAF_V2_TUPLE = 'tuple(bytes32,address,address,address,uint256,uint256,uint64,uint256,bool,uint32)';
|
|
function headerToTuple(h) {
|
|
return [
|
|
h.batchId,
|
|
h.previousBatchId,
|
|
h.chainId,
|
|
h.checkpointBlock,
|
|
h.startBlock,
|
|
h.endBlock,
|
|
h.blockHash,
|
|
h.stateRoot,
|
|
h.paymentsRoot,
|
|
h.receiptsRoot,
|
|
h.txCount,
|
|
h.flags,
|
|
h.submittedAt,
|
|
h.submitter,
|
|
h.contentURI,
|
|
];
|
|
}
|
|
class AdminCheckpointIngress {
|
|
checkpoint;
|
|
mode;
|
|
constructor(checkpoint, mode) {
|
|
this.checkpoint = checkpoint;
|
|
this.mode = mode;
|
|
}
|
|
async submit(ctx) {
|
|
const header = headerToTuple(ctx.header);
|
|
const validatorSignatures = ctx.validatorSignatures ?? '0x01';
|
|
switch (this.mode) {
|
|
case 'commitment': {
|
|
const tx = await this.checkpoint.submitCheckpointCommitment(header, validatorSignatures, ctx.contentURI, ctx.extensionData);
|
|
return { hash: tx.hash };
|
|
}
|
|
case 'leaves': {
|
|
const tx = await this.checkpoint.submitCheckpointWithLeaves(header, validatorSignatures, ctx.txHashes, (0, leafCodec_1.leavesToTuples)(ctx.leaves));
|
|
return { hash: tx.hash };
|
|
}
|
|
case 'leaves-v2':
|
|
throw new Error('leaves-v2 requires hub submitCheckpointWithLeavesV2 (deploy separate module or use hashes)');
|
|
case 'hashes':
|
|
default: {
|
|
const tx = await this.checkpoint.submitCheckpoint(header, validatorSignatures, ctx.txHashes, ctx.extensionData);
|
|
return { hash: tx.hash };
|
|
}
|
|
}
|
|
}
|
|
static extensionDataForMode(mode, leaves) {
|
|
if (mode === 'leaves-v2')
|
|
return (0, leafCodec_1.encodeExtensionLeavesV2)(leaves);
|
|
return (0, leafCodec_1.encodeExtensionLeavesV1)(leaves);
|
|
}
|
|
}
|
|
exports.AdminCheckpointIngress = AdminCheckpointIngress;
|
|
function buildCheckpointContract(wallet, proxy, mode) {
|
|
const fns = [
|
|
`function submitCheckpoint(${CHECKPOINT_HEADER_TUPLE} header, bytes validatorSignatures, bytes32[] txHashes, bytes extensionData) external`,
|
|
`function submitCheckpointCommitment(${CHECKPOINT_HEADER_TUPLE} header, bytes validatorSignatures, bytes32 contentURI, bytes extensionData) external`,
|
|
`function submitCheckpointWithLeaves(${CHECKPOINT_HEADER_TUPLE} header, bytes validatorSignatures, bytes32[] txHashes, ${PAYMENT_LEAF_TUPLE}[] leaves) external`,
|
|
'function getLatestBatchId() view returns (uint64)',
|
|
'function IMPLEMENTATION_VERSION() view returns (uint256)',
|
|
'function isTxIncluded(bytes32 txHash) view returns (bool included, uint64 batchId)',
|
|
];
|
|
return new ethers_1.ethers.Contract(proxy, fns, wallet);
|
|
}
|