File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 44 "fmt"
55 "time"
66
7- "github.com/onflow/flow-go-sdk"
87 "github.com/prometheus/client_golang/prometheus"
98 "github.com/rs/zerolog"
109)
@@ -113,7 +112,7 @@ type Collector interface {
113112 EVMTransactionIndexed (count int )
114113 EVMAccountInteraction (address string )
115114 MeasureRequestDuration (start time.Time , method string )
116- OperatorBalance (account * flow. Account )
115+ OperatorBalance (balance uint64 )
117116 AvailableSigningKeys (count int )
118117 GasEstimationIterations (count int )
119118 BlockIngestionTime (blockCreation time.Time )
@@ -208,8 +207,8 @@ func (c *DefaultCollector) EVMAccountInteraction(address string) {
208207 c .evmAccountCallCounters .With (prometheus.Labels {"address" : address }).Inc ()
209208}
210209
211- func (c * DefaultCollector ) OperatorBalance (account * flow. Account ) {
212- c .operatorBalance .Set (float64 (account . Balance ))
210+ func (c * DefaultCollector ) OperatorBalance (balance uint64 ) {
211+ c .operatorBalance .Set (float64 (balance ))
213212}
214213
215214func (c * DefaultCollector ) MeasureRequestDuration (start time.Time , method string ) {
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ package metrics
22
33import (
44 "time"
5-
6- "github.com/onflow/flow-go-sdk"
75)
86
97type nopCollector struct {}
@@ -19,7 +17,7 @@ func (c *nopCollector) EVMHeightIndexed(uint64) {}
1917func (c * nopCollector ) EVMTransactionIndexed (int ) {}
2018func (c * nopCollector ) EVMAccountInteraction (string ) {}
2119func (c * nopCollector ) MeasureRequestDuration (time.Time , string ) {}
22- func (c * nopCollector ) OperatorBalance (* flow. Account ) {}
20+ func (c * nopCollector ) OperatorBalance (balance uint64 ) {}
2321func (c * nopCollector ) AvailableSigningKeys (count int ) {}
2422func (c * nopCollector ) GasEstimationIterations (count int ) {}
2523func (c * nopCollector ) BlockIngestionTime (blockCreation time.Time ) {}
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ func NewEVM(
118118
119119 if ! config .IndexOnly {
120120 address := config .COAAddress
121- acc , err := client .GetAccount (context .Background (), address )
121+ accBalance , err := client .GetAccountBalanceAtLatestBlock (context .Background (), address )
122122 if err != nil {
123123 return nil , fmt .Errorf (
124124 "could not fetch the configured COA account: %s make sure it exists: %w" ,
@@ -127,13 +127,13 @@ func NewEVM(
127127 )
128128 }
129129 // initialize the operator balance metric since it is only updated when sending a tx
130- collector .OperatorBalance (acc )
130+ collector .OperatorBalance (accBalance )
131131
132- if acc . Balance < minFlowBalance {
132+ if accBalance < minFlowBalance {
133133 return nil , fmt .Errorf (
134134 "COA account must be funded with at least %d Flow, but has balance of: %d" ,
135135 minFlowBalance ,
136- acc . Balance ,
136+ accBalance ,
137137 )
138138 }
139139 }
You can’t perform that action at this time.
0 commit comments