Open trajan0x opened 3 months ago
To address the issue of making tx.Nonce, tx.To, etc., tags instead of events in the submitter package, follow these steps:
tx.Nonce
tx.To
submitter
SubmitTransaction
submitter.go
// submitter.go func (t *txSubmitterImpl) SubmitTransaction(parentCtx context.Context, chainID *big.Int, call ContractCallType) (nonce uint64, err error) { ctx, span := t.metrics.Tracer().Start(parentCtx, "submitter.SubmitTransaction", trace.WithAttributes( attribute.Stringer("chainID", chainID), attribute.String("caller", runtime.FuncForPC(reflect.ValueOf(call).Pointer()).Name()), attribute.Int64("tx.Nonce", int64(tx.Nonce())), attribute.String("tx.To", tx.To().Hex()), // Add other tx attributes as needed )) defer func() { metrics.EndSpanWithErr(span, err) }() // ... rest of the method }
setGasPrice
// submitter.go func (t *txSubmitterImpl) setGasPrice(ctx context.Context, client client.EVM, transactor *bind.TransactOpts, bigChainID *big.Int, prevTx *types.Transaction) (err error) { ctx, span := t.metrics.Tracer().Start(ctx, "submitter.setGasPrice", trace.WithAttributes( attribute.Int(metrics.ChainID, chainID), attribute.Bool("use_dynamic", useDynamic), attribute.String("gas_price", bigPtrToString(transactor.GasPrice)), attribute.String("gas_fee_cap", bigPtrToString(transactor.GasFeeCap)), attribute.String("gas_tip_cap", bigPtrToString(transactor.GasTipCap)), attribute.Int64("tx.Nonce", int64(tx.Nonce())), attribute.String("tx.To", tx.To().Hex()), // Add other tx attributes as needed )) defer func() { metrics.EndSpanWithErr(span, err) }() // ... rest of the method }
Update other methods where events are used for tx attributes:
tx
Update tests in export_test.go:
export_test.go
// export_test.go func TestSubmitTransaction(t *testing.T) { // ... setup code span := mockTracer.StartSpan("submitter.SubmitTransaction") // Check for tags instead of events assert.Equal(t, span.Attributes["tx.Nonce"], int64(expectedNonce)) assert.Equal(t, span.Attributes["tx.To"], expectedTo.Hex()) // ... rest of the test }
These changes will ensure that tx.Nonce, tx.To, and other attributes are recorded as tags instead of events.
/ethergo/submitter/submitter.go /ethergo/submitter/export_test.go
Ask Greptile · Edit Issue Bot Settings
To address the issue of making
tx.Nonce
,tx.To
, etc., tags instead of events in thesubmitter
package, follow these steps:SubmitTransaction
method insubmitter.go
:SubmitTransaction
method.setGasPrice
method insubmitter.go
:setGasPrice
method.Update other methods where events are used for
tx
attributes:submitter.go
where events are used fortx
attributes.Update tests in
export_test.go
:These changes will ensure that
tx.Nonce
,tx.To
, and other attributes are recorded as tags instead of events.References
/ethergo/submitter/submitter.go /ethergo/submitter/export_test.go
Ask Greptile · Edit Issue Bot Settings