Skip to content

Commit

Permalink
fix(op-geth): fix nil issue and add metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
redhdx committed Jul 30, 2024
1 parent ed7ab15 commit f0b8112
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 6 additions & 2 deletions core/txpool/bundlepool/bundlepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ const (
)

var (
bundleGauge = metrics.NewRegisteredGauge("bundlepool/bundles", nil)
slotsGauge = metrics.NewRegisteredGauge("bundlepool/slots", nil)
bundleGauge = metrics.NewRegisteredGauge("bundlepool/bundles", nil)
slotsGauge = metrics.NewRegisteredGauge("bundlepool/slots", nil)
bundleDeliverAll = metrics.NewRegisteredCounter("bundle/deliver/all", nil)
bundleDeliverFailed = metrics.NewRegisteredCounter("bundle/deliver/failed", nil)
)

var (
Expand Down Expand Up @@ -187,9 +189,11 @@ func (p *BundlePool) AddBundle(bundle *types.Bundle, originBundle *types.SendBun
var hash common.Hash
err := cli.CallContext(context.Background(), &hash, "eth_sendBundle", *originBundle)
if err != nil {
bundleDeliverFailed.Inc(1)
log.Error("failed to deliver bundle to receiver", "url", url, "err", err)
}
}()
bundleDeliverAll.Inc(1)
}

for p.slots+numSlots(bundle) > p.config.GlobalSlots {
Expand Down
5 changes: 5 additions & 0 deletions internal/ethapi/api_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func (s *PrivateTxBundleAPI) SimulateGaslessBundle(_ context.Context, args types
if err := tx.UnmarshalBinary(encodedTx); err != nil {
return nil, err
}
switch tx.Type() {
case types.LegacyTxType, types.AccessListTxType, types.DynamicFeeTxType:
default:
return nil, errors.New(fmt.Sprintf("transaction type %d not supported", tx.Type()))
}
txs = append(txs, tx)
}

Expand Down
11 changes: 5 additions & 6 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,12 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) (
log.Warn("fail to simulate gasless bundle, skipped", "txHash", tx.Hash(), "err", err)
} else {
txIdx++
result = append(result, types.GaslessTxSimResult{
Hash: tx.Hash(),
GasUsed: receipt.GasUsed,
Valid: valid,
})
}

result = append(result, types.GaslessTxSimResult{
Hash: tx.Hash(),
GasUsed: receipt.GasUsed,
Valid: valid,
})
}

return &types.SimulateGaslessBundleResp{
Expand Down

0 comments on commit f0b8112

Please sign in to comment.