Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Jan 22, 2024
1 parent 4f08f2a commit b472e00
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
6 changes: 3 additions & 3 deletions database/migrate/migrations/00015_pending_transaction.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CREATE TABLE pending_transaction
status SMALLINT NOT NULL,
rlp_encoding BYTEA NOT NULL,

gas_fee_cap NUMERIC NOT NULL,
gas_tip_cap NUMERIC NOT NULL,
gas_price NUMERIC NOT NULL,
gas_fee_cap BIGINT NOT NULL,
gas_tip_cap BIGINT NOT NULL,
gas_price BIGINT NOT NULL,
gas_limit BIGINT NOT NULL,
nonce BIGINT NOT NULL,
submit_block_number BIGINT NOT NULL,
Expand Down
1 change: 0 additions & 1 deletion rollup/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"escalate_multiple_den": 10,
"max_gas_price": 10000000000,
"tx_type": "DynamicFeeTx",
"min_balance": 100000000000000000000,
"check_pending_time": 12
},
"gas_oracle_config": {
Expand Down
6 changes: 3 additions & 3 deletions rollup/internal/controller/relayer/l1_relayer_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ func initL1RelayerMetrics(reg prometheus.Registerer) *l1RelayerMetrics {
l1RelayerMetric = &l1RelayerMetrics{
rollupL1RelayerGasPriceOracleRunTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer1_gas_price_oracle_run_total",
Help: "Total number of times the Layer 1 gas price oracle has been run",
Help: "Total number of times the layer1 gas price oracle has been run",
}),
rollupL1RelayerLastGasPrice: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
Name: "rollup_layer1_gas_price_latest_gas_price",
Help: "The latest gas price of rollup relayer l1",
}),
rollupL1UpdateGasOracleConfirmedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer1_update_gas_oracle_confirmed_total",
Help: "The total number of layer1 update gas oracle confirmed",
Help: "The total number of updating layer1 gas oracle confirmed",
}),
rollupL1UpdateGasOracleConfirmedFailedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer1_update_gas_oracle_confirmed_failed_total",
Help: "The total number of layer1 update gas oracle confirmed failed",
Help: "The total number of updating layer1 gas oracle confirmed failed",
}),
}
})
Expand Down
4 changes: 2 additions & 2 deletions rollup/internal/controller/relayer/l2_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,10 @@ func (r *Layer2Relayer) handleConfirmation(cfm *sender.Confirmation) {
var status types.GasOracleStatus
if cfm.IsSuccessful {
status = types.GasOracleImported
r.metrics.rollupL2UpdateL1GasOracleConfirmedTotal.Inc()
r.metrics.rollupL2UpdateGasOracleConfirmedTotal.Inc()
} else {
status = types.GasOracleImportedFailed
r.metrics.rollupL2UpdateL1GasOracleConfirmedFailedTotal.Inc()
r.metrics.rollupL2UpdateGasOracleConfirmedFailedTotal.Inc()
log.Warn("UpdateGasOracleTxType transaction confirmed but failed in layer1", "confirmation", cfm)
}

Expand Down
14 changes: 7 additions & 7 deletions rollup/internal/controller/relayer/l2_relayer_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type l2RelayerMetrics struct {
rollupL2BatchesCommittedConfirmedFailedTotal prometheus.Counter
rollupL2BatchesFinalizedConfirmedTotal prometheus.Counter
rollupL2BatchesFinalizedConfirmedFailedTotal prometheus.Counter
rollupL2UpdateL1GasOracleConfirmedTotal prometheus.Counter
rollupL2UpdateL1GasOracleConfirmedFailedTotal prometheus.Counter
rollupL2UpdateGasOracleConfirmedTotal prometheus.Counter
rollupL2UpdateGasOracleConfirmedFailedTotal prometheus.Counter
rollupL2ChainMonitorLatestFailedCall prometheus.Counter
rollupL2ChainMonitorLatestFailedBatchStatus prometheus.Counter
}
Expand All @@ -43,7 +43,7 @@ func initL2RelayerMetrics(reg prometheus.Registerer) *l2RelayerMetrics {
}),
rollupL2RelayerGasPriceOracleRunTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer2_gas_price_oracle_run_total",
Help: "The total number of layer2 gas price oracle run total",
Help: "Total number of times the layer2 gas price oracle has been run",
}),
rollupL2RelayerLastGasPrice: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
Name: "rollup_layer2_gas_price_latest_gas_price",
Expand Down Expand Up @@ -77,13 +77,13 @@ func initL2RelayerMetrics(reg prometheus.Registerer) *l2RelayerMetrics {
Name: "rollup_layer2_process_finalized_batches_confirmed_failed_total",
Help: "The total number of layer2 process finalized batches confirmed failed total",
}),
rollupL2UpdateL1GasOracleConfirmedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
rollupL2UpdateGasOracleConfirmedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer2_update_layer1_gas_oracle_confirmed_total",
Help: "The total number of layer2 update layer1 gas oracle confirmed",
Help: "The total number of updating layer2 gas oracle confirmed",
}),
rollupL2UpdateL1GasOracleConfirmedFailedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
rollupL2UpdateGasOracleConfirmedFailedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer2_update_layer1_gas_oracle_confirmed_failed_total",
Help: "The total number of layer2 update layer1 gas oracle confirmed failed",
Help: "The total number of updating layer2 gas oracle confirmed failed",
}),
rollupL2ChainMonitorLatestFailedCall: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "rollup_layer2_chain_monitor_latest_failed_batch_call",
Expand Down
4 changes: 2 additions & 2 deletions rollup/internal/controller/sender/estimategas.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func (s *Sender) estimateLegacyGas(to *common.Address, value *big.Int, data []by
}, nil
}

func (s *Sender) estimateDynamicGas(to *common.Address, value *big.Int, input []byte, fallbackGasLimit uint64, baseFee uint64) (*FeeData, error) {
func (s *Sender) estimateDynamicGas(to *common.Address, value *big.Int, data []byte, fallbackGasLimit uint64, baseFee uint64) (*FeeData, error) {
gasTipCap, err := s.client.SuggestGasTipCap(s.ctx)
if err != nil {
log.Error("estimateDynamicGas SuggestGasTipCap failure", "error", err)
return nil, err
}

gasFeeCap := new(big.Int).Add(gasTipCap, new(big.Int).Mul(new(big.Int).SetUint64(baseFee), big.NewInt(2)))
gasLimit, accessList, err := s.estimateGasLimit(to, input, nil, gasTipCap, gasFeeCap, value, true)
gasLimit, accessList, err := s.estimateGasLimit(to, data, nil, gasTipCap, gasFeeCap, value, true)
if err != nil {
log.Error("estimateDynamicGas estimateGasLimit failure",
"from", s.auth.From.String(), "nonce", s.auth.Nonce.Uint64(), "to address", to.String(),
Expand Down
12 changes: 6 additions & 6 deletions rollup/internal/orm/pending_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ type PendingTransaction struct {
ContextID string `json:"context_id" gorm:"context_id"`
Hash string `json:"hash" gorm:"hash"`
Type uint8 `json:"type" gorm:"type"`
GasFeeCap string `json:"gas_fee_cap" gorm:"gas_fee_cap"`
GasTipCap string `json:"gas_tip_cap" gorm:"gas_tip_cap"`
GasPrice string `json:"gas_price" gorm:"gas_price"`
GasFeeCap uint64 `json:"gas_fee_cap" gorm:"gas_fee_cap"`
GasTipCap uint64 `json:"gas_tip_cap" gorm:"gas_tip_cap"`
GasPrice uint64 `json:"gas_price" gorm:"gas_price"`
GasLimit uint64 `json:"gas_limit" gorm:"gas_limit"`
Nonce uint64 `json:"nonce" gorm:"nonce"`
SubmitBlockNumber uint64 `json:"submit_block_number" gorm:"submit_block_number"`
Expand Down Expand Up @@ -95,9 +95,9 @@ func (o *PendingTransaction) InsertPendingTransaction(ctx context.Context, conte
ContextID: contextID,
Hash: tx.Hash().String(),
Type: tx.Type(),
GasFeeCap: tx.GasFeeCap().String(),
GasTipCap: tx.GasTipCap().String(),
GasPrice: tx.GasPrice().String(),
GasFeeCap: tx.GasFeeCap().Uint64(),
GasTipCap: tx.GasTipCap().Uint64(),
GasPrice: tx.GasPrice().Uint64(),
GasLimit: tx.Gas(),
Nonce: tx.Nonce(),
SubmitBlockNumber: submitBlockNumber,
Expand Down

0 comments on commit b472e00

Please sign in to comment.