Skip to content

Commit 9965cc9

Browse files
authored
Merge pull request #108 from smartcontractkit/vrf-perf
VRF soak test
2 parents 54070aa + 7d9aa07 commit 9965cc9

File tree

10 files changed

+563
-4
lines changed

10 files changed

+563
-4
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ test_ocr: ## run ocr tests
6868
test_ocr_soak: ## run OCR soak test
6969
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@soak-ocr"
7070

71+
.PHONY: test_vrf_soak
72+
test_vrf_soak: ## run VRF soak test
73+
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@soak-vrf"
74+
7175
.PHONY: test_runlog
7276
test_runlog: ## run runlog tests
7377
ginkgo -r --focus=@runlog

config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ networks:
198198
private_url: moonbase_alpha_url
199199
private_keys:
200200
- moonbase_alpha_1
201+
iotex_testnet:
202+
<<: *common_ethereum_testnet
203+
name: "IoTeX testnet"
204+
chain_id: 4690
205+
private_url: iotex_testnet_url
206+
private_keys:
207+
- iotex_testnet_1
201208
retry:
202209
attempts: 120
203210
linear_delay: 1s
@@ -232,4 +239,4 @@ contracts:
232239
commit: 19ba7cfbe7b7c6ca7621b090e229b4ba1147e2e1
233240
ocr:
234241
path: ocr/artifacts/contract/src
235-
commit: f27c14a905c5735abbb6e0c9699e9d0e3e9b7217
242+
commit: f27c14a905c5735abbb6e0c9699e9d0e3e9b7217

contracts/contract_models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ type VRFCoordinator interface {
258258
}
259259

260260
type VRFConsumer interface {
261+
Address() string
261262
RequestRandomness(fromWallet client.BlockchainWallet, hash [32]byte, fee *big.Int) error
263+
CurrentRoundID(ctx context.Context) (*big.Int, error)
262264
RandomnessOutput(ctx context.Context) (*big.Int, error)
263265
Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
264266
}

contracts/ethereum/VRFConsumer.go

Lines changed: 64 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ethereum/v0.6/abi/VRFConsumer.abi

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,32 @@
1515
"stateMutability": "nonpayable",
1616
"type": "constructor"
1717
},
18+
{
19+
"inputs": [],
20+
"name": "currentRoundID",
21+
"outputs": [
22+
{
23+
"internalType": "uint256",
24+
"name": "",
25+
"type": "uint256"
26+
}
27+
],
28+
"stateMutability": "view",
29+
"type": "function"
30+
},
31+
{
32+
"inputs": [],
33+
"name": "prevRandomnessOutput",
34+
"outputs": [
35+
{
36+
"internalType": "uint256",
37+
"name": "",
38+
"type": "uint256"
39+
}
40+
],
41+
"stateMutability": "view",
42+
"type": "function"
43+
},
1844
{
1945
"inputs": [],
2046
"name": "randomnessOutput",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0x60c060405234801561001057600080fd5b506040516104b33803806104b38339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606092831b811660a052911b1660805260805160601c60a05160601c6104316100826000398060e4528061019752508061016852506104316000f3fe608060405234801561001057600080fd5b506004361061004b5760003560e01c80626d6cae146100505780632f47fd861461006a578063866ee7481461007257806394985ddd14610095575b600080fd5b6100586100ba565b60408051918252519081900360200190f35b6100586100c0565b6100586004803603604081101561008857600080fd5b50803590602001356100c6565b6100b8600480360360408110156100ab57600080fd5b50803590602001356100d9565b005b60025481565b60015481565b60006100d28383610164565b9392505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610156576040805162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00604482015290519081900360640190fd5b6101608282610326565b5050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f00000000000000000000000000000000000000000000000000000000000000008486600060405160200180838152602001828152602001925050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561024a578181015183820152602001610232565b50505050905090810190601f1680156102775780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561029857600080fd5b505af11580156102ac573d6000803e3d6000fd5b505050506040513d60208110156102c257600080fd5b50506000838152602081905260408120546102e29085908390309061032e565b60008581526020819052604090205490915061030590600163ffffffff61037516565b60008581526020819052604090205561031e84826103cf565b949350505050565b600155600255565b60408051602080820196909652808201949094526001600160a01b039290921660608401526080808401919091528151808403909101815260a09092019052805191012090565b6000828201838110156100d2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60408051602080820194909452808201929092528051808303820181526060909201905280519101209056fea26469706673582212200efdc6883e84f1727409e1be45ef60ca7bfd91860c3027cba16a6a4f92422ef764736f6c63430006060033
1+
0x60c0604052600060015534801561001557600080fd5b506040516104f33803806104f38339818101604052604081101561003857600080fd5b5080516020909101516001600160601b0319606092831b811660a052911b1660805260805160601c60a05160601c61046b6100886000398061011052806101c952508061019a525061046b6000f3fe608060405234801561001057600080fd5b50600436106100615760003560e01c80626d6cae146100665780630d0332bc146100805780632f47fd8614610088578063866ee7481461009057806394985ddd146100b3578063a312c4f2146100d8575b600080fd5b61006e6100e0565b60408051918252519081900360200190f35b61006e6100e6565b61006e6100ec565b61006e600480360360408110156100a657600080fd5b50803590602001356100f2565b6100d6600480360360408110156100c957600080fd5b5080359060200135610105565b005b61006e610190565b60045481565b60025481565b60035481565b60006100fe8383610196565b9392505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610182576040805162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c00604482015290519081900360640190fd5b61018c8282610358565b5050565b60015481565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f00000000000000000000000000000000000000000000000000000000000000008486600060405160200180838152602001828152602001925050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561027c578181015183820152602001610264565b50505050905090810190601f1680156102a95780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156102ca57600080fd5b505af11580156102de573d6000803e3d6000fd5b505050506040513d60208110156102f457600080fd5b505060008381526020819052604081205461031490859083903090610368565b60008581526020819052604090205490915061033790600163ffffffff6103af16565b6000858152602081905260409020556103508482610409565b949350505050565b6003556004556001805481019055565b60408051602080820196909652808201949094526001600160a01b039290921660608401526080808401919091528151808403909101815260a09092019052805191012090565b6000828201838110156100fe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60408051602080820194909452808201929092528051808303820181526060909201905280519101209056fea2646970667358221220ae0d1cbc717e1c8e2cc762c4f0f928f13be40034bf9027c7495c92730ce7daf464736f6c63430006060033

contracts/ethereum/v0.6/src/VRFConsumer.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import "./VRFConsumerBase.sol";
55

66
contract VRFConsumer is VRFConsumerBase {
77

8+
uint256 public currentRoundID = 0;
9+
uint256 public prevRandomnessOutput;
810
uint256 public randomnessOutput;
911
bytes32 public requestId;
1012

@@ -17,6 +19,7 @@ contract VRFConsumer is VRFConsumerBase {
1719
{
1820
randomnessOutput = _randomness;
1921
requestId = _requestId;
22+
currentRoundID += 1;
2023
}
2124

2225
function testRequestRandomness(bytes32 _keyHash, uint256 _fee)

0 commit comments

Comments
 (0)