Skip to content

Commit

Permalink
Merge pull request #2109 from OffchainLabs/missing-l1-pricing-getters
Browse files Browse the repository at this point in the history
Add missing L1 pricing getters to ArbGasInfo in ArbOS 20
  • Loading branch information
PlasmaPower authored Jan 28, 2024
2 parents 67292b4 + fe0d623 commit c7294a0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
8 changes: 0 additions & 8 deletions arbos/l1pricing/l1pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion contracts
24 changes: 22 additions & 2 deletions precompiles/ArbGasInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
5 changes: 5 additions & 0 deletions precompiles/precompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")}))

Expand Down

0 comments on commit c7294a0

Please sign in to comment.