Skip to content

Commit

Permalink
[fortuna] Add confirmation delay before responding (#1161)
Browse files Browse the repository at this point in the history
* Update abi

* fix tests

* update contract

* fix fortuna

* test confirmation delay

* cleanup

* fix

* split the fields

* saturating sub

* rename
  • Loading branch information
jayantk authored Dec 4, 2023
1 parent 5de008f commit c592fd3
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 101 deletions.
4 changes: 4 additions & 0 deletions fortuna/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ chains:
optimism-goerli:
geth_rpc_addr: https://goerli.optimism.io
contract_addr: 0x28F16Af4D87523910b843a801454AEde5F9B0459
reveal_delay_blocks: 0
avalanche-fuji:
geth_rpc_addr: https://api.avax-test.network/ext/bc/C/rpc
contract_addr: 0xD42c7a708E74AD19401D907a14146F006c851Ee3
reveal_delay_blocks: 0
eos-evm-testnet:
geth_rpc_addr: https://api.testnet.evm.eosnetwork.com/
contract_addr: 0xD42c7a708E74AD19401D907a14146F006c851Ee3
reveal_delay_blocks: 0
legacy_tx: true
arbitrum-goerli:
geth_rpc_addr: https://arbitrum-goerli.publicnode.com
contract_addr: 0xd9eAcfFB8e80b7193042499485EF8369b08E85B6
reveal_delay_blocks: 0
151 changes: 97 additions & 54 deletions fortuna/src/abi.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
[
{
"type": "constructor",
"inputs": [
"type": "function",
"name": "NUM_REQUESTS",
"inputs": [],
"outputs": [
{
"name": "pythFeeInWei",
"type": "uint256",
"internalType": "uint256"
},
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "NUM_REQUESTS_MASK",
"inputs": [],
"outputs": [
{
"name": "defaultProvider",
"type": "address",
"internalType": "address"
"name": "",
"type": "bytes1",
"internalType": "bytes1"
}
],
"stateMutability": "nonpayable"
"stateMutability": "view"
},
{
"type": "function",
Expand Down Expand Up @@ -70,8 +80,8 @@
"outputs": [
{
"name": "accruedPythFeesInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
}
],
"stateMutability": "view"
Expand Down Expand Up @@ -102,8 +112,8 @@
"outputs": [
{
"name": "feeAmount",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
}
],
"stateMutability": "view"
Expand All @@ -126,13 +136,13 @@
"components": [
{
"name": "feeInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
},
{
"name": "accruedFeesInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
},
{
"name": "originalCommitment",
Expand Down Expand Up @@ -179,6 +189,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getPythFee",
"inputs": [],
"outputs": [
{
"name": "feeAmount",
"type": "uint128",
"internalType": "uint128"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getRequest",
Expand Down Expand Up @@ -211,24 +234,29 @@
"internalType": "uint64"
},
{
"name": "userCommitment",
"type": "bytes32",
"internalType": "bytes32"
"name": "numHashes",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "providerCommitment",
"name": "commitment",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "providerCommitmentSequenceNumber",
"name": "blockNumber",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "blockNumber",
"type": "uint256",
"internalType": "uint256"
"name": "requester",
"type": "address",
"internalType": "address"
},
{
"name": "useBlockhash",
"type": "bool",
"internalType": "bool"
}
]
}
Expand All @@ -241,8 +269,8 @@
"inputs": [
{
"name": "feeInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
},
{
"name": "commitment",
Expand Down Expand Up @@ -337,8 +365,8 @@
"inputs": [
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
}
],
"outputs": [],
Expand All @@ -356,13 +384,13 @@
"components": [
{
"name": "feeInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
},
{
"name": "accruedFeesInWei",
"type": "uint256",
"internalType": "uint256"
"type": "uint128",
"internalType": "uint128"
},
{
"name": "originalCommitment",
Expand Down Expand Up @@ -430,24 +458,29 @@
"internalType": "uint64"
},
{
"name": "userCommitment",
"type": "bytes32",
"internalType": "bytes32"
"name": "numHashes",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "providerCommitment",
"name": "commitment",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "providerCommitmentSequenceNumber",
"name": "blockNumber",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "blockNumber",
"type": "uint256",
"internalType": "uint256"
"name": "requester",
"type": "address",
"internalType": "address"
},
{
"name": "useBlockhash",
"type": "bool",
"internalType": "bool"
}
]
}
Expand Down Expand Up @@ -475,24 +508,29 @@
"internalType": "uint64"
},
{
"name": "userCommitment",
"type": "bytes32",
"internalType": "bytes32"
"name": "numHashes",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "providerCommitment",
"name": "commitment",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "providerCommitmentSequenceNumber",
"name": "blockNumber",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "blockNumber",
"type": "uint256",
"internalType": "uint256"
"name": "requester",
"type": "address",
"internalType": "address"
},
{
"name": "useBlockhash",
"type": "bool",
"internalType": "bool"
}
]
},
Expand Down Expand Up @@ -530,27 +568,32 @@
},
{
"type": "error",
"name": "IncorrectProviderRevelation",
"name": "IncorrectRevelation",
"inputs": []
},
{
"type": "error",
"name": "IncorrectUserRevelation",
"name": "InsufficientFee",
"inputs": []
},
{
"type": "error",
"name": "InsufficientFee",
"name": "NoSuchProvider",
"inputs": []
},
{
"type": "error",
"name": "NoSuchProvider",
"name": "NoSuchRequest",
"inputs": []
},
{
"type": "error",
"name": "OutOfRandomness",
"inputs": []
},
{
"type": "error",
"name": "Unauthorized",
"inputs": []
}
]
Loading

0 comments on commit c592fd3

Please sign in to comment.