Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move recording of available-signing-keys metric inside a deferred function #740

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ EMULATOR_ARGS := --flow-network-id=flow-emulator \
--log-writer=console \
--tx-state-validation=local-index \
--profiler-enabled=true \
--profiler-port=6060 \
--tx-state-validation=local-index
--profiler-port=6060

# Set VERSION from command line, environment, or default to SHORT_COMMIT
VERSION ?= $(SHORT_COMMIT)
Expand Down
1 change: 1 addition & 0 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ type responseHandler struct {
}

var knownErrors = []error{
errs.ErrInternal,
errs.ErrRateLimit,
errs.ErrInvalid,
errs.ErrFailedTransaction,
Expand Down
6 changes: 4 additions & 2 deletions services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func (e *EVM) SendRawTransaction(ctx context.Context, data []byte) (common.Hash,
script := replaceAddresses(runTxScript, e.config.FlowNetworkID)
flowTx, err := e.buildTransaction(ctx, script, hexEncodedTx, coinbaseAddress)
if err != nil {
e.logger.Error().Err(err).Str("data", txData).Msg("failed to build transaction")
return common.Hash{}, err
}

Expand Down Expand Up @@ -563,6 +562,10 @@ func (e *EVM) buildTransaction(
e.mux.Lock()
defer e.mux.Unlock()

defer func() {
e.collector.AvailableSigningKeys(e.keystore.AvailableKeys())
}()

var (
g = errgroup.Group{}
err1, err2 error
Expand Down Expand Up @@ -602,7 +605,6 @@ func (e *EVM) buildTransaction(
}
e.keystore.LockKey(flowTx.ID(), latestBlock.Height, accKey)

e.collector.AvailableSigningKeys(e.keystore.AvailableKeys())
e.collector.OperatorBalance(account)

return flowTx, nil
Expand Down