Skip to content

Commit

Permalink
chore: restore blockTimestamp in CctpTxEvidence
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Feb 12, 2025
1 parent 3b32bfe commit f2ed533
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 4 deletions.
7 changes: 4 additions & 3 deletions a3p-integration/proposals/b:beta-fast-usdc/test/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ yarn agoric wallet send --offer accept.json --from agoric1ee9hr0jyrxhy999y755mp8
# UNTIL https://github.com/Agoric/agoric-sdk/issues/10891
# ACCEPT_OFFER_ID=$(agoric wallet extract-id --offer accept.json)

yarn fast-usdc operator attest --previousOfferId="$ACCEPT_OFFER_ID" --forwardingChannel=foo --recipientAddress=agoric1foo --blockHash=0xfoo --blockNumber=1 --chainId=3 --amount=123 --forwardingAddress=noble1foo --sender 0xfoo --txHash=0xtx >| attest.json
cat attest.json
yarn agoric wallet send --offer attest.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test
# FIXME restore this test once the latest fast-usdc package is in NPM
# yarn fast-usdc operator attest --previousOfferId="$ACCEPT_OFFER_ID" --forwardingChannel=foo --recipientAddress=agoric1foo --blockHash=0xfoo --blockNumber=1 --blockTimestamp=1632340000 --chainId=3 --amount=123 --forwardingAddress=noble1foo --sender 0xfoo --txHash=0xtx >| attest.json
# cat attest.json
# yarn agoric wallet send --offer attest.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test

# The data above are bogus and result in errors in the logs:
# SwingSet: vat: v72: ----- TxFeed.11 8 publishing evidence { aux: { forwardingChannel: 'foo', recipientAddress: 'agoric1foo' }, blockHash: '0xfoo', blockNumber: 1n, chainId: 3, tx: { amount: 123n, forwardingAddress: 'noble1foo', sender: '0xfoo' }, txHash: '0xtx' } []
Expand Down
1 change: 1 addition & 0 deletions multichain-testing/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const makeTestContext = async (t: ExecutionContext) => {
blockHash:
'0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037663n,
blockTimestamp: 1632340000n,
txHash: `0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff3875527617${String(callCount++).padStart(2, '0')}`,
tx: {
amount: mintAmt,
Expand Down
5 changes: 4 additions & 1 deletion multichain-testing/test/fast-usdc/fu-actors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ export const makeUserAgent = (
t.log('got forwardingAddress', userForwardingAddr);

const senderDigits = 'FAKE_SENDER_ADDR' as string & { length: 40 };
const tx: Omit<CctpTxEvidence, 'blockHash' | 'blockNumber'> = harden({
const tx: Omit<
CctpTxEvidence,
'blockHash' | 'blockNumber' | 'blockTimestamp'
> = harden({
txHash: `0xFAKE_TX_HASH`,
tx: {
sender: `0x${senderDigits}`,
Expand Down
1 change: 1 addition & 0 deletions packages/fast-usdc/src/cli/operator-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const addOperatorCommands = (
.requiredOption('--recipientAddress <string>', 'bech32 address', String)
.requiredOption('--blockHash <0xhex>', 'hex hash', parseHex)
.requiredOption('--blockNumber <number>', 'number', parseNat)
.requiredOption('--blockTimestamp <number>', 'number', parseNat)
.requiredOption('--chainId <string>', 'chain id', Number)
.requiredOption('--amount <number>', 'number', parseNat)
.requiredOption('--forwardingAddress <string>', 'bech32 address', String)
Expand Down
1 change: 1 addition & 0 deletions packages/fast-usdc/src/type-guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const CctpTxEvidenceShape = {
},
blockHash: EvmHashShape,
blockNumber: M.nat(),
blockTimestamp: M.nat(),
chainId: M.number(),
tx: {
amount: M.nat(),
Expand Down
13 changes: 13 additions & 0 deletions packages/fast-usdc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,21 @@ export interface CctpTxEvidence {
forwardingChannel: IBCChannelID;
recipientAddress: ChainAddress['value'];
};
/** on the source chain (e.g. L1 Ethereum and L2s Arbitrum, Base) */
blockHash: EvmHash;
/** height of blockHash on the source chain */
blockNumber: bigint;
/**
* Seconds since Unix epoch. Not all CCTP source chains update time the same
* way but they all use Unix epoch and thus are approximately equal. (Within
* minutes apart.)
*/
blockTimestamp: bigint;
//
/**
* [Domain of values](https://chainid.network/) per [EIP-155](https://eips.ethereum.org/EIPS/eip-155)
* (We don't have [CCTP `domain`](https://developers.circle.com/stablecoins/supported-domains) )
*/
chainId: number;
/** data covered by signature (aka txHash) */
tx: {
Expand Down
7 changes: 7 additions & 0 deletions packages/fast-usdc/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const Senders = {
default: '0xDefaultFakeEthereumAddress',
} as unknown as Record<string, EvmAddress>;

const blockTimestamp = 1632340000n;

export const MockCctpTxEvidences: Record<
MockScenario,
(receiverAddress?: string) => CctpTxEvidence
Expand All @@ -27,6 +29,7 @@ export const MockCctpTxEvidences: Record<
blockHash:
'0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037663n,
blockTimestamp,
txHash:
'0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702',
tx: {
Expand All @@ -48,6 +51,7 @@ export const MockCctpTxEvidences: Record<
blockHash:
'0x80d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee699',
blockNumber: 21037669n,
blockTimestamp,
txHash:
'0xd81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761799',
tx: {
Expand All @@ -69,6 +73,7 @@ export const MockCctpTxEvidences: Record<
blockHash:
'0x80d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee6z9',
blockNumber: 21037600n,
blockTimestamp,
txHash:
'0xd81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff3875527617z9',
tx: {
Expand All @@ -90,6 +95,7 @@ export const MockCctpTxEvidences: Record<
blockHash:
'0x70d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee699',
blockNumber: 21037669n,
blockTimestamp,
txHash:
'0xa81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761799',
tx: {
Expand All @@ -107,6 +113,7 @@ export const MockCctpTxEvidences: Record<
blockHash:
'0x70d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee699',
blockNumber: 21037669n,
blockTimestamp,
txHash:
'0xa81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761799',
tx: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037671n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 5000000n,
Expand All @@ -3133,6 +3134,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037664n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 1000000n,
Expand All @@ -3148,6 +3150,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037665n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 108000000n,
Expand All @@ -3163,6 +3166,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037666n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 110000000n,
Expand All @@ -3178,6 +3182,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037667n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 120000000n,
Expand All @@ -3193,6 +3198,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037668n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 125000000n,
Expand All @@ -3208,6 +3214,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037669n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 6000000n,
Expand All @@ -3223,6 +3230,7 @@ Generated by [AVA](https://avajs.dev).
},
blockHash: '0x90d7343e04f8160892e94f02d6a9b9f255663ed0ac34caca98544c8143fee665',
blockNumber: 21037670n,
blockTimestamp: 1632340000n,
chainId: 1,
tx: {
amount: 150000000n,
Expand Down
Binary file modified packages/fast-usdc/test/snapshots/fast-usdc.contract.test.ts.snap
Binary file not shown.

0 comments on commit f2ed533

Please sign in to comment.