@agoric/fast-usdc 0.1.1-dev-a67bf28.0 → 0.1.1-dev-eb8538b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/fast-usdc",
3
- "version": "0.1.1-dev-a67bf28.0+a67bf28",
3
+ "version": "0.1.1-dev-eb8538b.0+eb8538b",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,9 +23,9 @@
23
23
  "lint:eslint": "eslint ."
24
24
  },
25
25
  "devDependencies": {
26
- "@agoric/swingset-liveslots": "0.10.3-dev-a67bf28.0+a67bf28",
27
- "@agoric/vats": "0.15.2-dev-a67bf28.0+a67bf28",
28
- "@agoric/zone": "0.2.3-dev-a67bf28.0+a67bf28",
26
+ "@agoric/swingset-liveslots": "0.10.3-dev-eb8538b.0+eb8538b",
27
+ "@agoric/vats": "0.15.2-dev-eb8538b.0+eb8538b",
28
+ "@agoric/zone": "0.2.3-dev-eb8538b.0+eb8538b",
29
29
  "@fast-check/ava": "^2.0.1",
30
30
  "ava": "^5.3.0",
31
31
  "c8": "^10.1.2",
@@ -33,16 +33,16 @@
33
33
  "ts-blank-space": "^0.4.4"
34
34
  },
35
35
  "dependencies": {
36
- "@agoric/client-utils": "0.1.1-dev-a67bf28.0+a67bf28",
37
- "@agoric/cosmic-proto": "0.4.1-dev-a67bf28.0+a67bf28",
38
- "@agoric/ertp": "0.16.3-dev-a67bf28.0+a67bf28",
39
- "@agoric/internal": "0.3.3-dev-a67bf28.0+a67bf28",
40
- "@agoric/notifier": "0.6.3-dev-a67bf28.0+a67bf28",
41
- "@agoric/orchestration": "0.1.1-dev-a67bf28.0+a67bf28",
42
- "@agoric/store": "0.9.3-dev-a67bf28.0+a67bf28",
43
- "@agoric/vat-data": "0.5.3-dev-a67bf28.0+a67bf28",
44
- "@agoric/vow": "0.1.1-dev-a67bf28.0+a67bf28",
45
- "@agoric/zoe": "0.26.3-dev-a67bf28.0+a67bf28",
36
+ "@agoric/client-utils": "0.1.1-dev-eb8538b.0+eb8538b",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-eb8538b.0+eb8538b",
38
+ "@agoric/ertp": "0.16.3-dev-eb8538b.0+eb8538b",
39
+ "@agoric/internal": "0.3.3-dev-eb8538b.0+eb8538b",
40
+ "@agoric/notifier": "0.6.3-dev-eb8538b.0+eb8538b",
41
+ "@agoric/orchestration": "0.1.1-dev-eb8538b.0+eb8538b",
42
+ "@agoric/store": "0.9.3-dev-eb8538b.0+eb8538b",
43
+ "@agoric/vat-data": "0.5.3-dev-eb8538b.0+eb8538b",
44
+ "@agoric/vow": "0.1.1-dev-eb8538b.0+eb8538b",
45
+ "@agoric/zoe": "0.26.3-dev-eb8538b.0+eb8538b",
46
46
  "@cosmjs/proto-signing": "^0.32.4",
47
47
  "@cosmjs/stargate": "^0.32.4",
48
48
  "@endo/base64": "^1.0.9",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "a67bf2862935b4187f423813cfa327c0fea187b8"
85
+ "gitHead": "eb8538b55e672dae7b00c145d2f220900a416909"
86
86
  }
@@ -96,6 +96,7 @@ export const addOperatorCommands = (
96
96
  .requiredOption('--recipientAddress <string>', 'bech32 address', String)
97
97
  .requiredOption('--blockHash <0xhex>', 'hex hash', parseHex)
98
98
  .requiredOption('--blockNumber <number>', 'number', parseNat)
99
+ .requiredOption('--blockTimestamp <number>', 'number', parseNat)
99
100
  .requiredOption('--chainId <string>', 'chain id', Number)
100
101
  .requiredOption('--amount <number>', 'number', parseNat)
101
102
  .requiredOption('--forwardingAddress <string>', 'bech32 address', String)
@@ -91,13 +91,18 @@ export const prepareStatusManager = (
91
91
  /**
92
92
  * Transactions seen *ever* by the contract.
93
93
  *
94
- * Note that like all durable stores, this SetStore is stored in IAVL. It
95
- * grows without bound (though the amount of growth per incoming message to
96
- * the contract is bounded). At some point in the future we may want to prune.
97
- * @type {SetStore<EvmHash>}
94
+ * Note that like all durable stores, this MapStore is kept in IAVL. It stores
95
+ * the `blockTimestamp` so that later we can prune old transactions.
96
+ *
97
+ * Note that `blockTimestamp` can drift between chains. Fortunately all CCTP
98
+ * chains use the same Unix epoch and won't drift more than minutes apart,
99
+ * which is more than enough precision for pruning old transaction.
100
+ *
101
+ * @type {MapStore<EvmHash, NatValue>}
98
102
  */
99
- const seenTxs = zone.setStore('SeenTxs', {
103
+ const seenTxs = zone.mapStore('SeenTxs', {
100
104
  keyShape: M.string(),
105
+ valueShape: M.nat(),
101
106
  });
102
107
 
103
108
  /**
@@ -160,7 +165,7 @@ export const prepareStatusManager = (
160
165
  if (seenTxs.has(txHash)) {
161
166
  throw makeError(`Transaction already seen: ${q(txHash)}`);
162
167
  }
163
- seenTxs.add(txHash);
168
+ seenTxs.init(txHash, evidence.blockTimestamp);
164
169
 
165
170
  appendToStoredArray(
166
171
  pendingSettleTxs,
@@ -305,7 +310,7 @@ export const prepareStatusManager = (
305
310
  if (seenTxs.has(txHash)) {
306
311
  throw makeError(`Transaction already seen: ${q(txHash)}`);
307
312
  }
308
- seenTxs.add(txHash);
313
+ seenTxs.init(txHash, evidence.blockTimestamp);
309
314
  publishEvidence(txHash, evidence);
310
315
  },
311
316
 
@@ -76,6 +76,7 @@ export const CctpTxEvidenceShape = {
76
76
  },
77
77
  blockHash: EvmHashShape,
78
78
  blockNumber: M.nat(),
79
+ blockTimestamp: M.nat(),
79
80
  chainId: M.number(),
80
81
  tx: {
81
82
  amount: M.nat(),
package/src/types.ts CHANGED
@@ -27,8 +27,21 @@ export interface CctpTxEvidence {
27
27
  forwardingChannel: IBCChannelID;
28
28
  recipientAddress: ChainAddress['value'];
29
29
  };
30
+ /** on the source chain (e.g. L1 Ethereum and L2s Arbitrum, Base) */
30
31
  blockHash: EvmHash;
32
+ /** height of blockHash on the source chain */
31
33
  blockNumber: bigint;
34
+ /**
35
+ * Seconds since Unix epoch. Not all CCTP source chains update time the same
36
+ * way but they all use Unix epoch and thus are approximately equal. (Within
37
+ * minutes apart.)
38
+ */
39
+ blockTimestamp: bigint;
40
+ //
41
+ /**
42
+ * [Domain of values](https://chainid.network/) per [EIP-155](https://eips.ethereum.org/EIPS/eip-155)
43
+ * (We don't have [CCTP `domain`](https://developers.circle.com/stablecoins/supported-domains) )
44
+ */
32
45
  chainId: number;
33
46
  /** data covered by signature (aka txHash) */
34
47
  tx: {