From fe0d6231fc6196cbb1f048fe1e7c0f73ae2095d2 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sun, 28 Jan 2024 11:38:39 -0700 Subject: [PATCH] Add missing L1 pricing getters to ArbGasInfo in ArbOS 20 --- arbos/l1pricing/l1pricing.go | 8 -------- contracts | 2 +- precompiles/ArbGasInfo.go | 24 ++++++++++++++++++++++-- precompiles/precompile.go | 5 +++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/arbos/l1pricing/l1pricing.go b/arbos/l1pricing/l1pricing.go index 27ecae8b85..f2312c46d4 100644 --- a/arbos/l1pricing/l1pricing.go +++ b/arbos/l1pricing/l1pricing.go @@ -146,10 +146,6 @@ func (ps *L1PricingState) SetPayRewardsTo(addr common.Address) error { return ps.payRewardsTo.Set(addr) } -func (ps *L1PricingState) GetRewardsRecepient() (common.Address, error) { - return ps.payRewardsTo.Get() -} - func (ps *L1PricingState) EquilibrationUnits() (*big.Int, error) { return ps.equilibrationUnits.Get() } @@ -174,10 +170,6 @@ func (ps *L1PricingState) SetPerUnitReward(weiPerUnit uint64) error { return ps.perUnitReward.Set(weiPerUnit) } -func (ps *L1PricingState) GetRewardsRate() (uint64, error) { - return ps.perUnitReward.Get() -} - func (ps *L1PricingState) LastUpdateTime() (uint64, error) { return ps.lastUpdateTime.Get() } diff --git a/contracts b/contracts index cd5093d45e..7b84be56ec 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit cd5093d45ef0353fc5b2718ead70bd7f36e1a92c +Subproject commit 7b84be56ec5352aaeb85c58fea7f50725e1927d9 diff --git a/precompiles/ArbGasInfo.go b/precompiles/ArbGasInfo.go index 378d48c780..cda5350a4a 100644 --- a/precompiles/ArbGasInfo.go +++ b/precompiles/ArbGasInfo.go @@ -164,12 +164,12 @@ func (con ArbGasInfo) GetL1BaseFeeEstimateInertia(c ctx, evm mech) (uint64, erro // GetL1RewardRate gets the L1 pricer reward rate func (con ArbGasInfo) GetL1RewardRate(c ctx, evm mech) (uint64, error) { - return c.State.L1PricingState().GetRewardsRate() + return c.State.L1PricingState().PerUnitReward() } // GetL1RewardRecipient gets the L1 pricer reward recipient func (con ArbGasInfo) GetL1RewardRecipient(c ctx, evm mech) (common.Address, error) { - return c.State.L1PricingState().GetRewardsRecepient() + return c.State.L1PricingState().PayRewardsTo() } // GetL1GasPriceEstimate gets the current estimate of the L1 basefee @@ -244,3 +244,23 @@ func (con ArbGasInfo) GetAmortizedCostCapBips(c ctx, evm mech) (uint64, error) { func (con ArbGasInfo) GetL1FeesAvailable(c ctx, evm mech) (huge, error) { return c.State.L1PricingState().L1FeesAvailable() } + +func (con ArbGasInfo) GetL1PricingEquilibrationUnits(c ctx, evm mech) (*big.Int, error) { + return c.State.L1PricingState().EquilibrationUnits() +} + +func (con ArbGasInfo) GetLastL1PricingUpdateTime(c ctx, evm mech) (uint64, error) { + return c.State.L1PricingState().LastUpdateTime() +} + +func (con ArbGasInfo) GetL1PricingFundsDueForRewards(c ctx, evm mech) (*big.Int, error) { + return c.State.L1PricingState().FundsDueForRewards() +} + +func (con ArbGasInfo) GetL1PricingUnitsSinceUpdate(c ctx, evm mech) (uint64, error) { + return c.State.L1PricingState().UnitsSinceUpdate() +} + +func (con ArbGasInfo) GetLastL1PricingSurplus(c ctx, evm mech) (*big.Int, error) { + return c.State.L1PricingState().LastSurplus() +} diff --git a/precompiles/precompile.go b/precompiles/precompile.go index 330eb9a2e4..5d2ecce745 100644 --- a/precompiles/precompile.go +++ b/precompiles/precompile.go @@ -538,6 +538,11 @@ func Precompiles() map[addr]ArbosPrecompile { ArbGasInfo.methodsByName["GetL1FeesAvailable"].arbosVersion = 10 ArbGasInfo.methodsByName["GetL1RewardRate"].arbosVersion = 11 ArbGasInfo.methodsByName["GetL1RewardRecipient"].arbosVersion = 11 + ArbGasInfo.methodsByName["GetL1PricingEquilibrationUnits"].arbosVersion = 20 + ArbGasInfo.methodsByName["GetLastL1PricingUpdateTime"].arbosVersion = 20 + ArbGasInfo.methodsByName["GetL1PricingFundsDueForRewards"].arbosVersion = 20 + ArbGasInfo.methodsByName["GetL1PricingUnitsSinceUpdate"].arbosVersion = 20 + ArbGasInfo.methodsByName["GetLastL1PricingSurplus"].arbosVersion = 20 insert(MakePrecompile(templates.ArbAggregatorMetaData, &ArbAggregator{Address: hex("6d")})) insert(MakePrecompile(templates.ArbStatisticsMetaData, &ArbStatistics{Address: hex("6f")}))