@cancore/contracts 0.2.0-rc.3 → 0.2.0-rc.7

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "EIP-712 schema of FillProof — the struct CancoreRouter.settle verifies attestor signatures over — and its golden vectors. The contract is the source of truth: test/CancoreRouter.ts checks this file against FILLPROOF_TYPEHASH and hashFillProof. @cancore/contracts mirrors it (sdk: npm run sync) and checks the same vectors with its own encoder. Change the struct here and this repository's test fails at once; the SDK's fails once its `npm run sync` pulls the change (nothing checks the two repositories against each other automatically).",
2
+ "$comment": "EIP-712 schema of FillProof — the struct CancoreRouter.settle verifies attestor signatures over — and its golden vectors. The contract is the source of truth: test/CancoreRouter.ts checks this file against FILLPROOF_TYPEHASH and hashFillProof. @cancore/contracts mirrors it (sdk: npm run sync) and checks the same vectors with its own encoder. Change the struct here and this repository's test fails at once; the SDK's fails once its `npm run sync` pulls the change (nothing checks the two repositories against each other automatically). The vectors are @cancore/contracts' canonical set (CAN-2139, sdk 4c6971f), byte for byte: the router computing each of them in test/CancoreRouter.ts is the cross-check between the two repositories.",
3
3
  "primaryType": "FillProof",
4
4
  "domain": {
5
5
  "$comment": "The SOURCE router of the order: settle recomputes the digest in its own domain, so a proof never verifies on another chain or router.",
@@ -12,7 +12,8 @@
12
12
  "verifyingContract"
13
13
  ]
14
14
  },
15
- "typeString": "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,address filler,uint32 attempt,uint32 setId)",
15
+ "typeString": "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,bytes32 fillerId,bytes32 repayTo,uint32 attempt,uint32 setId)",
16
+ "typeHash": "0xc37e18cdd22fbc1e707c1bcc554d9d29c2e6c5a44bb4a9a4dc38e2c28e2419ae",
16
17
  "types": {
17
18
  "FillProof": [
18
19
  {
@@ -48,8 +49,12 @@
48
49
  "type": "uint64"
49
50
  },
50
51
  {
51
- "name": "filler",
52
- "type": "address"
52
+ "name": "fillerId",
53
+ "type": "bytes32"
54
+ },
55
+ {
56
+ "name": "repayTo",
57
+ "type": "bytes32"
53
58
  },
54
59
  {
55
60
  "name": "attempt",
@@ -63,7 +68,7 @@
63
68
  },
64
69
  "vectors": [
65
70
  {
66
- "note": "baseline",
71
+ "note": "baseline: EVM source and destination, fillerId keccak256(\"acme\"), repayTo a padded EVM address",
67
72
  "chainId": 31337,
68
73
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
69
74
  "message": {
@@ -75,33 +80,39 @@
75
80
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
76
81
  "amountDelivered": "95000000000000000000",
77
82
  "filledAt": "1790000000",
78
- "filler": "0x5555555555555555555555555555555555555555",
83
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
84
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
79
85
  "attempt": 1,
80
86
  "setId": 1
81
87
  },
82
- "digest": "0x60710cde56b0ce205921f022e5bbeb6f3e9c016810f9597d5f5d4cd8388de68f"
88
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
89
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
90
+ "digest": "0xb8567a7df02431d496c14b998f686c050d86c7552939aa67f66612d3602f4b6c"
83
91
  },
84
92
  {
85
- "note": "every integer at its maximum: no field is narrower than the contract says",
93
+ "note": "every integer at its maximum, every word all ones: no field is narrower than the contract says",
86
94
  "chainId": 31337,
87
95
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
88
96
  "message": {
89
97
  "kind": 255,
90
- "orderHash": "0x1111111111111111111111111111111111111111111111111111111111111111",
91
- "destination": "0x0000000000000000000000000000000000000000000000000000000000aa36a7",
92
- "fillRef": "0x2222222222222222222222222222222222222222222222222222222222222222",
93
- "recipient": "0x0000000000000000000000003333333333333333333333333333333333333333",
94
- "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
98
+ "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
99
+ "destination": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
100
+ "fillRef": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
101
+ "recipient": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
102
+ "outputAsset": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
95
103
  "amountDelivered": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
96
104
  "filledAt": "18446744073709551615",
97
- "filler": "0x5555555555555555555555555555555555555555",
105
+ "fillerId": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
106
+ "repayTo": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
98
107
  "attempt": 4294967295,
99
108
  "setId": 4294967295
100
109
  },
101
- "digest": "0x01ce524359fa8b9b4cc736fc5da949f435071a25c07dd3af691318272c968379"
110
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
111
+ "structHash": "0x6d4f2ee32e02ff5cb479dbd8f18fd1306b89a2513db6cfa3da06c69992c96a3f",
112
+ "digest": "0x5850aac6189524d1b34d16b467bce6a3a5f6681255cb4abe83a28147d534fcdb"
102
113
  },
103
114
  {
104
- "note": "zero words and the zero address",
115
+ "note": "zero words",
105
116
  "chainId": 31337,
106
117
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
107
118
  "message": {
@@ -113,11 +124,14 @@
113
124
  "outputAsset": "0x0000000000000000000000000000000000000000000000000000000000000000",
114
125
  "amountDelivered": "0",
115
126
  "filledAt": "0",
116
- "filler": "0x0000000000000000000000000000000000000000",
127
+ "fillerId": "0x0000000000000000000000000000000000000000000000000000000000000000",
128
+ "repayTo": "0x0000000000000000000000000000000000000000000000000000000000000000",
117
129
  "attempt": 0,
118
130
  "setId": 0
119
131
  },
120
- "digest": "0x149dddd5a7f61b04d9bd11113d684e20464ae92b4c05d13ec039b157224ab723"
132
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
133
+ "structHash": "0x51713b6c288966f3e995793ff65a3cec60bfbc51c240bd2aa50ade3da1c284d0",
134
+ "digest": "0x5d5d4907e300a8d705d3d61c23c0b7bf0d34039c85e6e4eadc601fe3fe60e439"
121
135
  },
122
136
  {
123
137
  "note": "same proof, another router: the digest is bound to verifyingContract",
@@ -132,33 +146,39 @@
132
146
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
133
147
  "amountDelivered": "95000000000000000000",
134
148
  "filledAt": "1790000000",
135
- "filler": "0x5555555555555555555555555555555555555555",
149
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
150
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
136
151
  "attempt": 1,
137
152
  "setId": 1
138
153
  },
139
- "digest": "0x3c8add09c5e2c9fcdf3329f25bcfd8f2aa5f19ada2647d310df4dd6c2062021c"
154
+ "domainSeparator": "0x282a771d1c663bbda15fa1376f122d013f85569d94bdfa5c681ca6215c7db6b8",
155
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
156
+ "digest": "0xce35f3f8838fad5b41bc9ab963682a6965334abf7340ea4618958b0ac26f6712"
140
157
  },
141
158
  {
142
- "note": "a Canton destination and a later attempt under set 2",
159
+ "note": "Canton destination (protocol.md §3.13): destination keccak256(\"canton:mainnet\"), recipient keccak256(party), outputAsset keccak256(abi.encode(\"cancore:instrument:v1\", admin, id)), amount Numeric 10 × 10^10 (1200.25); a later attempt under set 2. The encoder itself is CAN-1935",
143
160
  "chainId": 31337,
144
161
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
145
162
  "message": {
146
163
  "kind": 1,
147
164
  "orderHash": "0x1111111111111111111111111111111111111111111111111111111111111111",
148
- "destination": "0x0000000000000000000000000000000000000000000000008000000000000003",
165
+ "destination": "0x8d6e3eea79c707a9549bdb1206260cd46ef29e86763e19a8a3f494bc6b499440",
149
166
  "fillRef": "0x2222222222222222222222222222222222222222222222222222222222222222",
150
- "recipient": "0x0000000000000000000000003333333333333333333333333333333333333333",
151
- "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
152
- "amountDelivered": "95000000000000000000",
167
+ "recipient": "0x8330f18e4203206b15fc33cb80a36595317e2638ec444305e71b9502faa9e628",
168
+ "outputAsset": "0x034bad92a7c82fb0e37b03e7795ae88257786ea0e2cfe2c43b88b420993dc98f",
169
+ "amountDelivered": "12002500000000",
153
170
  "filledAt": "1790000000",
154
- "filler": "0x5555555555555555555555555555555555555555",
171
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
172
+ "repayTo": "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
155
173
  "attempt": 3,
156
174
  "setId": 2
157
175
  },
158
- "digest": "0x7c2d541d8b5cb9cea85e2a509b5135cae5b8b23b000a7530e030d3663e8096a5"
176
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
177
+ "structHash": "0x3c76a53bbcb8fe01a0902d30794bcabf6948476a85f7be9fc9c178e74af5d272",
178
+ "digest": "0xdebb837668be49db1a9a6a4b0aeb69839b92ce0095dc5016a3b0d541aad346ba"
159
179
  },
160
180
  {
161
- "note": "computed by CancoreRouter.hashFillProof on the local stand (CAN-1776): same proof, chain id 11155111",
181
+ "note": "same proof, another chain (11155111) and router",
162
182
  "chainId": 11155111,
163
183
  "verifyingContract": "0xa5Ca448044cbF78a8b2a3853598b879e2722ce65",
164
184
  "message": {
@@ -170,14 +190,19 @@
170
190
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
171
191
  "amountDelivered": "95000000000000000000",
172
192
  "filledAt": "1790000000",
173
- "filler": "0x5555555555555555555555555555555555555555",
193
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
194
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
174
195
  "attempt": 1,
175
196
  "setId": 1
176
197
  },
177
- "digest": "0xdde67a41f980bd1d31af88addcbbd5a08e095816d7acc2fd9323e5dce7d28410"
198
+ "domainSeparator": "0x311d9cdf77fccd430656cbd12f0da889d7c14ab9832dec4dcf90f76557a4e9bf",
199
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
200
+ "digest": "0x81c3633199fbeed50c8d6aa235b1fdd5e0fa98d21caf70dc331d47936faced4b"
178
201
  },
179
202
  {
180
- "note": "Canton source (CAN-2061): the delivery of test/vectors/canton-order.json's order, in the domain Daml settles in — chainId CANTON_ORIGIN_ID = 2^63 + 1 (a string: it does not survive a JSON number), verifyingContract CANTON_SOURCE_ANCHOR. Both are the test vector's, not a per-network deployment. The digest is canton-contracts intent-test/daml/Intent/Test/AttestationVectors.daml vDigestExpected (fillProofDigest cantonMainnet (goldenProofOff 0)); no router computes it",
203
+ "note": "Canton source: the delivery of spec/vectors/canton-order.json's order, in the domain Daml settles in — chainId CANTON_ORIGIN_ID = 2^63 + 1 (a string: it does not survive a JSON number), verifyingContract CANTON_SOURCE_ANCHOR; repayTo = keccak256(utf8(partyId)) of the filler party (repayToParty), fillerId keccak256(\"acme-markets\"). Daml FillProofVerify must reproduce typeHash, domainSeparator, structHash and digest",
204
+ "fillerIdString": "acme-markets",
205
+ "repayToParty": "acme-markets::1220acdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacde",
181
206
  "chainId": "9223372036854775809",
182
207
  "verifyingContract": "0x2f37b46Ea93001829498b145985fb53028033701",
183
208
  "message": {
@@ -189,11 +214,14 @@
189
214
  "outputAsset": "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
190
215
  "amountDelivered": "1246760000",
191
216
  "filledAt": "1789999700",
192
- "filler": "0x5b38da6a701c568545dcfcb03fcb875f56beddc4",
217
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
218
+ "repayTo": "0xe61d35ec4ca48f587165d3138bd11c79b42e52f6de0cec4b9e2d4350017f1e87",
193
219
  "attempt": 1,
194
220
  "setId": 1
195
221
  },
196
- "digest": "0x4f6622ad6a74c4e5e173e9baaa2bfb2b4f32c1ff2e160076df172d4ef557b660"
222
+ "domainSeparator": "0x1f754285aeeb7c329e1107ea7f22092765deea7fd0db2c98bce7e0bda644ec16",
223
+ "structHash": "0xde3d93c38518796a0d639e855b5a875eeccd7e2dc9417b28d4b7c36d04d9f58d",
224
+ "digest": "0xfdc7e00e2d79fb63ee6bcb3c46dbe531ee0c40eaa0a670c371902a862615df80"
197
225
  }
198
226
  ]
199
227
  }
@@ -1,7 +1,8 @@
1
1
  {
2
- "$comment": "PROVISIONAL hand copy of the CancoreRouter.sol struct (evm-contracts f936594) until evm-contracts publishes abi/typed-data for it with its own vectors (follow-up F-1); digests by ethers TypedDataEncoder, checked in this package by the shipped encoder as well.",
2
+ "$comment": "EIP-712 schema of FillTicket — the dispatcher's assignment CancoreRouter.fill verifies — and its golden vectors. The contract is the source of truth: test/CancoreRouter.ts checks this file against TICKET_TYPEHASH, TICKET_DOMAIN_SEPARATOR and hashTicket. @cancore/contracts mirrors it (sdk: npm run sync) and checks the same vectors with its own encoder. The vectors are @cancore/contracts' canonical set (CAN-2139, sdk 4c6971f), byte for byte: the router computing each of them in test/CancoreRouter.ts is the cross-check between the two repositories.",
3
3
  "primaryType": "FillTicket",
4
4
  "domain": {
5
+ "$comment": "The PROTOCOL domain: no chainId, no verifyingContract. orderHash is already the source-router digest, so one ticket verifies identically on every router and off-chain.",
5
6
  "name": "CancoreFillTicket",
6
7
  "version": "1",
7
8
  "fields": [
@@ -9,7 +10,7 @@
9
10
  "version"
10
11
  ]
11
12
  },
12
- "typeString": "FillTicket(bytes32 orderHash,address filler,uint32 attempt,uint64 validFrom,uint64 validUntil)",
13
+ "typeString": "FillTicket(bytes32 orderHash,bytes32 fillerId,address deliveryKey,bytes32 repayTo,uint32 attempt,uint64 validFrom,uint64 validUntil)",
13
14
  "types": {
14
15
  "FillTicket": [
15
16
  {
@@ -17,9 +18,17 @@
17
18
  "type": "bytes32"
18
19
  },
19
20
  {
20
- "name": "filler",
21
+ "name": "fillerId",
22
+ "type": "bytes32"
23
+ },
24
+ {
25
+ "name": "deliveryKey",
21
26
  "type": "address"
22
27
  },
28
+ {
29
+ "name": "repayTo",
30
+ "type": "bytes32"
31
+ },
23
32
  {
24
33
  "name": "attempt",
25
34
  "type": "uint32"
@@ -36,48 +45,72 @@
36
45
  },
37
46
  "vectors": [
38
47
  {
39
- "note": "protocol.md §3.3 hashTicket example: a fixed bytes32 orderHash input (the pre-CAN-1683 golden value)",
48
+ "note": "protocol.md §3.3 hashTicket example: a fixed bytes32 orderHash input, fillerId keccak256(\"acme\"), repayTo the padded delivery key",
40
49
  "message": {
41
50
  "orderHash": "0xe61e980d40d1a666a509d2296c0d2658a40ff681e290c7646a75a550629ce1ad",
42
- "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
51
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
52
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
53
+ "repayTo": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
43
54
  "attempt": 0,
44
55
  "validFrom": "1789999000",
45
56
  "validUntil": "1789999180"
46
57
  },
47
- "digest": "0x80a86c8877ddb8c8ff1924b52311c1f2a7000b8d3ee3e69ed4314b2d38cab2c1"
58
+ "digest": "0xb751ce266445dfc74d2a1e7ec2b23f51bf36ccc97706f6d0d73e4be74f9d5c33"
48
59
  },
49
60
  {
50
- "note": "ticket for the test-kit fixture order, attempt 0",
61
+ "note": "ticket for the test-kit fixture order, attempt 0: EVM source, repayTo another address than the delivery key",
62
+ "fillerIdString": "acme-markets",
51
63
  "message": {
52
64
  "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
53
- "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
65
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
66
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
67
+ "repayTo": "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
54
68
  "attempt": 0,
55
69
  "validFrom": "1790000040",
56
70
  "validUntil": "1790000400"
57
71
  },
58
- "digest": "0x466bc75e5efad07ad975aeea9ec731902bc804461686a6c8f76ef4fd50297819"
72
+ "digest": "0x8eaef6b8d59e72288487b0def58e0eb9200fa7600170351af985111eaec5a0a9"
73
+ },
74
+ {
75
+ "note": "Canton source (canton-order.json): repayTo = keccak256(utf8(partyId)) of the filler party",
76
+ "fillerIdString": "acme-markets",
77
+ "repayToParty": "acme-markets::1220acdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacde",
78
+ "message": {
79
+ "orderHash": "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204",
80
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
81
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
82
+ "repayTo": "0xe61d35ec4ca48f587165d3138bd11c79b42e52f6de0cec4b9e2d4350017f1e87",
83
+ "attempt": 1,
84
+ "validFrom": "1789999500",
85
+ "validUntil": "1789999800"
86
+ },
87
+ "digest": "0xbbec903b320790bbe11b93446e183872ad43b3e2fa83d0a3daeb2cd79672b9c1"
59
88
  },
60
89
  {
61
90
  "note": "every integer at its maximum",
62
91
  "message": {
63
92
  "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
64
- "filler": "0xffffffffffffffffffffffffffffffffffffffff",
93
+ "fillerId": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
94
+ "deliveryKey": "0xffffffffffffffffffffffffffffffffffffffff",
95
+ "repayTo": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
65
96
  "attempt": 4294967295,
66
97
  "validFrom": "18446744073709551615",
67
98
  "validUntil": "18446744073709551615"
68
99
  },
69
- "digest": "0xc42ba85a1f897e17c385efd7de3b6e7948c18c129a7c2580b71a18205edb628e"
100
+ "digest": "0x041820b7007543c4750057958545f330ece16fc5ae81d4d30571b2f09269ccb3"
70
101
  },
71
102
  {
72
103
  "note": "zero",
73
104
  "message": {
74
105
  "orderHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
75
- "filler": "0x0000000000000000000000000000000000000000",
106
+ "fillerId": "0x0000000000000000000000000000000000000000000000000000000000000000",
107
+ "deliveryKey": "0x0000000000000000000000000000000000000000",
108
+ "repayTo": "0x0000000000000000000000000000000000000000000000000000000000000000",
76
109
  "attempt": 0,
77
110
  "validFrom": "0",
78
111
  "validUntil": "0"
79
112
  },
80
- "digest": "0xfeddbe10514c1cd10524b20487f96b3335e92fcb74b9aa9368a21caad1eef948"
113
+ "digest": "0x205fd8f9d58d390da2bf1158f6a4025274dfc0d1db56422610b271d0a5ddd098"
81
114
  }
82
115
  ]
83
116
  }