Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
fix: remove logic for logging gas price calculator result, instead lo…
Browse files Browse the repository at this point in the history
…g all the array
  • Loading branch information
P1sar committed Sep 13, 2023
1 parent 7832d01 commit 2820df0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 1 addition & 5 deletions chains/evm/calls/transactor/monitored/monitored.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ func (t *MonitoredTransactor) Transact(ctx context.Context, to *common.Address,
return &common.Hash{}, err
}
}
if len(gp) > 1 {
span.AddEvent("Calculated GasPrice", traceapi.WithAttributes(attribute.String("tx.gasTipCap", gp[0].String()), attribute.String("tx.gasFeeCap", gp[1].String())))
} else {
span.AddEvent("Calculated GasPrice", traceapi.WithAttributes(attribute.String("tx.gp", gp[0].String())))
}
span.AddEvent("Calculated GasPrice", traceapi.WithAttributes(attribute.StringSlice("tx.gp", calls.BigIntSliceToStringSlice(gp))))

rawTx := RawTxWithTraceID{
RawTx{
Expand Down
8 changes: 2 additions & 6 deletions chains/evm/calls/transactor/signAndSend/signAndSend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewSignAndSendTransactor(txFabric calls.TxFabric, gasPriceClient calls.GasP
}

func (t *signAndSendTransactor) Transact(ctx context.Context, to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error) {
ctx, span, logger := observability.CreateSpanAndLoggerFromContext(ctx, "relayer-core", "relayer.core.Transactor.signAndSendTransactor.Transact")
ctx, span, _ := observability.CreateSpanAndLoggerFromContext(ctx, "relayer-core", "relayer.core.Transactor.signAndSendTransactor.Transact")
defer span.End()

t.client.LockNonce()
Expand All @@ -54,11 +54,7 @@ func (t *signAndSendTransactor) Transact(ctx context.Context, to *common.Address
}
}

if len(gp) > 1 {
observability.LogAndEvent(logger.Debug(), span, "Calculated GasPrice", attribute.String("tx.gasTipCap", gp[0].String()), attribute.String("tx.gasFeeCap", gp[1].String()))
} else {
observability.LogAndEvent(logger.Debug(), span, "Calculated GasPrice", attribute.String("tx.gp", gp[0].String()))
}
span.AddEvent("Calculated GasPrice", traceapi.WithAttributes(attribute.StringSlice("tx.gp", calls.BigIntSliceToStringSlice(gp))))

tx, err := t.TxFabric(n.Uint64(), to, opts.Value, opts.GasLimit, gp, data)
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions chains/evm/calls/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ func WeiAmountToUser(amount *big.Int, decimals *big.Int) (*big.Float, error) {
}
return new(big.Float).Quo(amountFloat, big.NewFloat(gomath.Pow10(int(decimals.Int64())))), nil
}

func BigIntSliceToStringSlice(arr []*big.Int) []string {
var sArr = make([]string, len(arr))
for i, v := range arr {
sArr[i] = v.String()
}
return sArr
}

0 comments on commit 2820df0

Please sign in to comment.