@@ -21,10 +21,6 @@ import (
21
21
"golang.org/x/sync/errgroup"
22
22
)
23
23
24
- const (
25
- setRandomnessGasLimit = 500000 // 500,000 should be more than enough for a setRandomness transaction
26
- )
27
-
28
24
type Updater struct {
29
25
// drandClient is the Drand HTTP client
30
26
drandClient client.Client
@@ -35,6 +31,9 @@ type Updater struct {
35
31
// rpcClient is the Ethereum RPC client
36
32
rpcClient * ethclient.Client
37
33
34
+ // setRandomnessGasLimit is the gas limit for the setRandomness transaction
35
+ setRandomnessGasLimit uint64
36
+
38
37
// binding is the Drand Oracle contract binding
39
38
binding * binding.Binding
40
39
@@ -68,21 +67,23 @@ type roundData struct {
68
67
func NewUpdater (
69
68
drandClient client.Client ,
70
69
rpcClient * ethclient.Client ,
70
+ setRandomnessGasLimit uint64 ,
71
71
binding * binding.Binding ,
72
72
genesisRound uint64 ,
73
73
signer * signer.Signer ,
74
74
sender * sender.Sender ,
75
75
) (* Updater , error ) {
76
76
return & Updater {
77
- drandClient : drandClient ,
78
- rpcClient : rpcClient ,
79
- binding : binding ,
80
- genesisRound : genesisRound ,
81
- roundChan : make (chan * roundData , 1 ),
82
- latestOracleRound : 0 ,
83
- latestDrandRound : 0 ,
84
- signer : signer ,
85
- sender : sender ,
77
+ drandClient : drandClient ,
78
+ rpcClient : rpcClient ,
79
+ setRandomnessGasLimit : setRandomnessGasLimit ,
80
+ binding : binding ,
81
+ genesisRound : genesisRound ,
82
+ roundChan : make (chan * roundData , 1 ),
83
+ latestOracleRound : 0 ,
84
+ latestDrandRound : 0 ,
85
+ signer : signer ,
86
+ sender : sender ,
86
87
}, nil
87
88
}
88
89
@@ -254,7 +255,7 @@ func (u *Updater) processRound(
254
255
& bind.TransactOpts {
255
256
From : u .sender .Address (),
256
257
Signer : u .sender .SignerFn (),
257
- GasLimit : setRandomnessGasLimit ,
258
+ GasLimit : u . setRandomnessGasLimit ,
258
259
GasPrice : gasPrice ,
259
260
},
260
261
binding.IDrandOracleRandom {
0 commit comments