Skip to content

Commit c592fd3

Browse files
authored
[fortuna] Add confirmation delay before responding (#1161)
* Update abi * fix tests * update contract * fix fortuna * test confirmation delay * cleanup * fix * split the fields * saturating sub * rename
1 parent 5de008f commit c592fd3

File tree

12 files changed

+307
-101
lines changed

12 files changed

+307
-101
lines changed

fortuna/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ chains:
22
optimism-goerli:
33
geth_rpc_addr: https://goerli.optimism.io
44
contract_addr: 0x28F16Af4D87523910b843a801454AEde5F9B0459
5+
reveal_delay_blocks: 0
56
avalanche-fuji:
67
geth_rpc_addr: https://api.avax-test.network/ext/bc/C/rpc
78
contract_addr: 0xD42c7a708E74AD19401D907a14146F006c851Ee3
9+
reveal_delay_blocks: 0
810
eos-evm-testnet:
911
geth_rpc_addr: https://api.testnet.evm.eosnetwork.com/
1012
contract_addr: 0xD42c7a708E74AD19401D907a14146F006c851Ee3
13+
reveal_delay_blocks: 0
1114
legacy_tx: true
1215
arbitrum-goerli:
1316
geth_rpc_addr: https://arbitrum-goerli.publicnode.com
1417
contract_addr: 0xd9eAcfFB8e80b7193042499485EF8369b08E85B6
18+
reveal_delay_blocks: 0

fortuna/src/abi.json

Lines changed: 97 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
[
22
{
3-
"type": "constructor",
4-
"inputs": [
3+
"type": "function",
4+
"name": "NUM_REQUESTS",
5+
"inputs": [],
6+
"outputs": [
57
{
6-
"name": "pythFeeInWei",
7-
"type": "uint256",
8-
"internalType": "uint256"
9-
},
8+
"name": "",
9+
"type": "uint8",
10+
"internalType": "uint8"
11+
}
12+
],
13+
"stateMutability": "view"
14+
},
15+
{
16+
"type": "function",
17+
"name": "NUM_REQUESTS_MASK",
18+
"inputs": [],
19+
"outputs": [
1020
{
11-
"name": "defaultProvider",
12-
"type": "address",
13-
"internalType": "address"
21+
"name": "",
22+
"type": "bytes1",
23+
"internalType": "bytes1"
1424
}
1525
],
16-
"stateMutability": "nonpayable"
26+
"stateMutability": "view"
1727
},
1828
{
1929
"type": "function",
@@ -70,8 +80,8 @@
7080
"outputs": [
7181
{
7282
"name": "accruedPythFeesInWei",
73-
"type": "uint256",
74-
"internalType": "uint256"
83+
"type": "uint128",
84+
"internalType": "uint128"
7585
}
7686
],
7787
"stateMutability": "view"
@@ -102,8 +112,8 @@
102112
"outputs": [
103113
{
104114
"name": "feeAmount",
105-
"type": "uint256",
106-
"internalType": "uint256"
115+
"type": "uint128",
116+
"internalType": "uint128"
107117
}
108118
],
109119
"stateMutability": "view"
@@ -126,13 +136,13 @@
126136
"components": [
127137
{
128138
"name": "feeInWei",
129-
"type": "uint256",
130-
"internalType": "uint256"
139+
"type": "uint128",
140+
"internalType": "uint128"
131141
},
132142
{
133143
"name": "accruedFeesInWei",
134-
"type": "uint256",
135-
"internalType": "uint256"
144+
"type": "uint128",
145+
"internalType": "uint128"
136146
},
137147
{
138148
"name": "originalCommitment",
@@ -179,6 +189,19 @@
179189
],
180190
"stateMutability": "view"
181191
},
192+
{
193+
"type": "function",
194+
"name": "getPythFee",
195+
"inputs": [],
196+
"outputs": [
197+
{
198+
"name": "feeAmount",
199+
"type": "uint128",
200+
"internalType": "uint128"
201+
}
202+
],
203+
"stateMutability": "view"
204+
},
182205
{
183206
"type": "function",
184207
"name": "getRequest",
@@ -211,24 +234,29 @@
211234
"internalType": "uint64"
212235
},
213236
{
214-
"name": "userCommitment",
215-
"type": "bytes32",
216-
"internalType": "bytes32"
237+
"name": "numHashes",
238+
"type": "uint32",
239+
"internalType": "uint32"
217240
},
218241
{
219-
"name": "providerCommitment",
242+
"name": "commitment",
220243
"type": "bytes32",
221244
"internalType": "bytes32"
222245
},
223246
{
224-
"name": "providerCommitmentSequenceNumber",
247+
"name": "blockNumber",
225248
"type": "uint64",
226249
"internalType": "uint64"
227250
},
228251
{
229-
"name": "blockNumber",
230-
"type": "uint256",
231-
"internalType": "uint256"
252+
"name": "requester",
253+
"type": "address",
254+
"internalType": "address"
255+
},
256+
{
257+
"name": "useBlockhash",
258+
"type": "bool",
259+
"internalType": "bool"
232260
}
233261
]
234262
}
@@ -241,8 +269,8 @@
241269
"inputs": [
242270
{
243271
"name": "feeInWei",
244-
"type": "uint256",
245-
"internalType": "uint256"
272+
"type": "uint128",
273+
"internalType": "uint128"
246274
},
247275
{
248276
"name": "commitment",
@@ -337,8 +365,8 @@
337365
"inputs": [
338366
{
339367
"name": "amount",
340-
"type": "uint256",
341-
"internalType": "uint256"
368+
"type": "uint128",
369+
"internalType": "uint128"
342370
}
343371
],
344372
"outputs": [],
@@ -356,13 +384,13 @@
356384
"components": [
357385
{
358386
"name": "feeInWei",
359-
"type": "uint256",
360-
"internalType": "uint256"
387+
"type": "uint128",
388+
"internalType": "uint128"
361389
},
362390
{
363391
"name": "accruedFeesInWei",
364-
"type": "uint256",
365-
"internalType": "uint256"
392+
"type": "uint128",
393+
"internalType": "uint128"
366394
},
367395
{
368396
"name": "originalCommitment",
@@ -430,24 +458,29 @@
430458
"internalType": "uint64"
431459
},
432460
{
433-
"name": "userCommitment",
434-
"type": "bytes32",
435-
"internalType": "bytes32"
461+
"name": "numHashes",
462+
"type": "uint32",
463+
"internalType": "uint32"
436464
},
437465
{
438-
"name": "providerCommitment",
466+
"name": "commitment",
439467
"type": "bytes32",
440468
"internalType": "bytes32"
441469
},
442470
{
443-
"name": "providerCommitmentSequenceNumber",
471+
"name": "blockNumber",
444472
"type": "uint64",
445473
"internalType": "uint64"
446474
},
447475
{
448-
"name": "blockNumber",
449-
"type": "uint256",
450-
"internalType": "uint256"
476+
"name": "requester",
477+
"type": "address",
478+
"internalType": "address"
479+
},
480+
{
481+
"name": "useBlockhash",
482+
"type": "bool",
483+
"internalType": "bool"
451484
}
452485
]
453486
}
@@ -475,24 +508,29 @@
475508
"internalType": "uint64"
476509
},
477510
{
478-
"name": "userCommitment",
479-
"type": "bytes32",
480-
"internalType": "bytes32"
511+
"name": "numHashes",
512+
"type": "uint32",
513+
"internalType": "uint32"
481514
},
482515
{
483-
"name": "providerCommitment",
516+
"name": "commitment",
484517
"type": "bytes32",
485518
"internalType": "bytes32"
486519
},
487520
{
488-
"name": "providerCommitmentSequenceNumber",
521+
"name": "blockNumber",
489522
"type": "uint64",
490523
"internalType": "uint64"
491524
},
492525
{
493-
"name": "blockNumber",
494-
"type": "uint256",
495-
"internalType": "uint256"
526+
"name": "requester",
527+
"type": "address",
528+
"internalType": "address"
529+
},
530+
{
531+
"name": "useBlockhash",
532+
"type": "bool",
533+
"internalType": "bool"
496534
}
497535
]
498536
},
@@ -530,27 +568,32 @@
530568
},
531569
{
532570
"type": "error",
533-
"name": "IncorrectProviderRevelation",
571+
"name": "IncorrectRevelation",
534572
"inputs": []
535573
},
536574
{
537575
"type": "error",
538-
"name": "IncorrectUserRevelation",
576+
"name": "InsufficientFee",
539577
"inputs": []
540578
},
541579
{
542580
"type": "error",
543-
"name": "InsufficientFee",
581+
"name": "NoSuchProvider",
544582
"inputs": []
545583
},
546584
{
547585
"type": "error",
548-
"name": "NoSuchProvider",
586+
"name": "NoSuchRequest",
549587
"inputs": []
550588
},
551589
{
552590
"type": "error",
553591
"name": "OutOfRandomness",
554592
"inputs": []
593+
},
594+
{
595+
"type": "error",
596+
"name": "Unauthorized",
597+
"inputs": []
555598
}
556599
]

0 commit comments

Comments
 (0)