diff --git a/arbos/l1pricing/l1PricingOldVersions.go b/arbos/l1pricing/l1PricingOldVersions.go index c040794e75..19a0c6f07e 100644 --- a/arbos/l1pricing/l1PricingOldVersions.go +++ b/arbos/l1pricing/l1PricingOldVersions.go @@ -4,7 +4,6 @@ package l1pricing import ( - "github.com/ethereum/go-ethereum/metrics" "math" "math/big" @@ -14,13 +13,6 @@ import ( am "github.com/offchainlabs/nitro/util/arbmath" ) -var ( - l1PricerFundsPoolRewardsCounter = metrics.NewRegisteredCounter("arbos/l1price_funds/rewards_counter", nil) - l1PricerFundsPoolRewardsDistribution = metrics.NewRegisteredGaugeFloat64("arbos/l1price_funds/rewards_distribution", nil) - l1PricerFundsPoolDueCounter = metrics.NewRegisteredCounter("arbos/l1price_funds/due_counter", nil) - l1PricerFundsPoolDueDistribution = metrics.NewRegisteredGaugeFloat64("arbos/l1price_funds/due_distribution", nil) -) - func (ps *L1PricingState) _preversion10_UpdateForBatchPosterSpending( statedb vm.StateDB, evm *vm.EVM, @@ -131,9 +123,8 @@ func (ps *L1PricingState) _preversion10_UpdateForBatchPosterSpending( if err != nil { return err } - l1PricerRewards, _ := paymentForRewards.Float64() - l1PricerFundsPoolRewardsCounter.Inc(1) - l1PricerFundsPoolRewardsDistribution.Update(l1PricerRewards) + l1RewardsDistributionCounter.Inc(1) + l1RewardsDistribution.Inc(paymentForRewards.Int64()) availableFunds = statedb.GetBalance(L1PricerFundsPoolAddress) // settle up payments owed to the batch poster, as much as possible @@ -156,9 +147,8 @@ func (ps *L1PricingState) _preversion10_UpdateForBatchPosterSpending( if err != nil { return err } - l1PricerDue, _ := balanceToTransfer.Float64() - l1PricerFundsPoolDueCounter.Inc(1) - l1PricerFundsPoolDueDistribution.Update(l1PricerDue) + l1BaseFeeDueDistributionCounter.Inc(1) + l1BaseFeeDueDistribution.Inc(balanceToTransfer.Int64()) balanceDueToPoster = am.BigSub(balanceDueToPoster, balanceToTransfer) err = posterState.SetFundsDue(balanceDueToPoster) if err != nil { @@ -316,9 +306,8 @@ func (ps *L1PricingState) _preVersion2_UpdateForBatchPosterSpending( if err != nil { return err } - l1PricerRewards, _ := paymentForRewards.Float64() - l1PricerFundsPoolRewardsCounter.Inc(1) - l1PricerFundsPoolRewardsDistribution.Update(l1PricerRewards) + l1RewardsDistributionCounter.Inc(1) + l1RewardsDistribution.Inc(paymentForRewards.Int64()) availableFunds = am.BigSub(availableFunds, paymentForRewards) // settle up our batch poster payments owed, as much as possible @@ -350,9 +339,8 @@ func (ps *L1PricingState) _preVersion2_UpdateForBatchPosterSpending( if err != nil { return err } - l1PricerDue, _ := balanceToTransfer.Float64() - l1PricerFundsPoolDueCounter.Inc(1) - l1PricerFundsPoolDueDistribution.Update(l1PricerDue) + l1BaseFeeDueDistributionCounter.Inc(1) + l1BaseFeeDueDistribution.Inc(balanceToTransfer.Int64()) availableFunds = am.BigSub(availableFunds, balanceToTransfer) balanceDueToPoster = am.BigSub(balanceDueToPoster, balanceToTransfer) err = poster.SetFundsDue(balanceDueToPoster) diff --git a/arbos/l1pricing/l1pricing.go b/arbos/l1pricing/l1pricing.go index 576c2f7a12..887cc4b2c9 100644 --- a/arbos/l1pricing/l1pricing.go +++ b/arbos/l1pricing/l1pricing.go @@ -58,10 +58,11 @@ var ( ) var ( - batchPosterRewardsCounter = metrics.NewRegisteredCounter("arbos/batch_poster/rewards_counter", nil) - batchPosterRewardsDistribution = metrics.NewRegisteredGaugeFloat64("arbos/batch_poster/rewards_distribution", nil) - batchPosterRefundCounter = metrics.NewRegisteredCounter("arbos/batch_poster/refund_counter", nil) - batchPosterRefundDistribution = metrics.NewRegisteredGaugeFloat64("arbos/batch_poster/refund_distribution", nil) + l1RewardsDistributionCounter = metrics.NewRegisteredCounter("arbos/l1_rewards_recipient/rewards_counter", nil) + l1RewardsDistribution = metrics.NewRegisteredCounter("arbos/l1_rewards_recipient/rewards_distribution", nil) + l1BaseFeeDueDistributionCounter = metrics.NewRegisteredCounter("arbos/batchposter_fee_collector/due_counter", nil) + l1BaseFeeDueDistribution = metrics.NewRegisteredCounter("arbos/batchposter_fee_collector/due_distribution", nil) + l1PricerFundsPoolBalance = metrics.NewRegisteredGaugeFloat64("arbos/l1_pricer_funds_pool_balance", nil) ) const ( @@ -422,9 +423,9 @@ func (ps *L1PricingState) UpdateForBatchPosterSpending( if err != nil { return err } - batchPosterRewards, _ := paymentForRewards.Float64() - batchPosterRewardsCounter.Inc(1) - batchPosterRewardsDistribution.Update(batchPosterRewards) + l1RewardsDistributionCounter.Inc(1) + l1RewardsDistribution.Inc(paymentForRewards.Int64()) + l1PricerFundsPoolBalance.Update(arbmath.BalancePerEther()) // settle up payments owed to the batch poster, as much as possible balanceDueToPoster, err := posterState.FundsDue() @@ -446,9 +447,8 @@ func (ps *L1PricingState) UpdateForBatchPosterSpending( if err != nil { return err } - batchPosterRefunds, _ := balanceToTransfer.Float64() - batchPosterRefundCounter.Inc(1) - batchPosterRefundDistribution.Update(batchPosterRefunds) + l1BaseFeeDueDistributionCounter.Inc(1) + l1BaseFeeDueDistribution.Inc(balanceToTransfer.Int64()) balanceDueToPoster = am.BigSub(balanceDueToPoster, balanceToTransfer) err = posterState.SetFundsDue(balanceDueToPoster) if err != nil { diff --git a/arbos/tx_processor.go b/arbos/tx_processor.go index c495103a64..9f1e905993 100644 --- a/arbos/tx_processor.go +++ b/arbos/tx_processor.go @@ -30,9 +30,9 @@ import ( var ( infraFeeDistributionCounter = metrics.NewRegisteredCounter("arbos/infra_fee/counter", nil) - infraFeeDistribution = metrics.NewRegisteredGaugeFloat64("arbos/infra_fee/distribution", nil) + infraFeeDistribution = metrics.NewRegisteredCounter("arbos/infra_fee/distribution", nil) networkFeeDistributionCounter = metrics.NewRegisteredCounter("arbos/network_fee/counter", nil) - networkFeeDistribution = metrics.NewRegisteredGaugeFloat64("arbos/network_fee/distribution", nil) + networkFeeDistribution = metrics.NewRegisteredCounter("arbos/network_fee/distribution", nil) ) var arbosAddress = types.ArbosAddress @@ -580,14 +580,12 @@ func (p *TxProcessor) EndTxHook(gasLeft uint64, success bool) { infraRefund = takeFunds(networkRefund, infraRefund) refund(infraFeeAccount, infraRefund) infraFeeDistributionCounter.Inc(1) - infraFeeDistributed, _ := infraRefund.Float64() - infraFeeDistribution.Update(infraFeeDistributed) + infraFeeDistribution.Inc(infraRefund.Int64()) } } refund(networkFeeAccount, networkRefund) - networkFeeDistributed, _ := networkRefund.Float64() networkFeeDistributionCounter.Inc(1) - networkFeeDistribution.Update(networkFeeDistributed) + networkFeeDistribution.Inc(networkRefund.Int64()) if success { // we don't want to charge for this