Skip to content

Commit

Permalink
TestArbOwnerDoesntRevert
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoximenes committed Oct 15, 2024
1 parent 5790f2d commit 25fb1d4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
4 changes: 0 additions & 4 deletions precompiles/ArbOwner.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (con ArbOwner) SetL1BaseFeeEstimateInertia(c ctx, evm mech, inertia uint64)
return c.State.L1PricingState().SetInertia(inertia)
}

// TODO: add system test
// SetL2BaseFee sets the L2 gas price directly, bypassing the pool calculus
func (con ArbOwner) SetL2BaseFee(c ctx, evm mech, priceInWei huge) error {
return c.State.L2PricingState().SetBaseFeeWei(priceInWei)
Expand Down Expand Up @@ -145,7 +144,6 @@ func (con ArbOwner) SetPerBatchGasCharge(c ctx, evm mech, cost int64) error {
return c.State.L1PricingState().SetPerBatchGasCost(cost)
}

// TODO: add system test
func (con ArbOwner) SetAmortizedCostCapBips(c ctx, evm mech, cap uint64) error {
return c.State.L1PricingState().SetAmortizedCostCapBips(cap)
}
Expand All @@ -154,7 +152,6 @@ func (con ArbOwner) SetBrotliCompressionLevel(c ctx, evm mech, level uint64) err
return c.State.SetBrotliCompressionLevel(level)
}

// TODO: add system test
func (con ArbOwner) ReleaseL1PricerSurplusFunds(c ctx, evm mech, maxWeiToRelease huge) (huge, error) {
balance := evm.StateDB.GetBalance(l1pricing.L1PricerFundsPoolAddress)
l1p := c.State.L1PricingState()
Expand Down Expand Up @@ -298,7 +295,6 @@ func (con ArbOwner) RemoveWasmCacheManager(c ctx, _ mech, manager addr) error {
return managers.Remove(manager, c.State.ArbOSVersion())
}

// TODO: add system test
func (con ArbOwner) SetChainConfig(c ctx, evm mech, serializedChainConfig []byte) error {
if c == nil {
return errors.New("nil context")
Expand Down
41 changes: 41 additions & 0 deletions system_tests/precompile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package arbtest

import (
"context"
"encoding/json"
"fmt"
"math/big"
"sort"
Expand Down Expand Up @@ -876,6 +877,46 @@ func TestChainOwners(t *testing.T) {
}
}

func TestArbOwnerDoesntRevert(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
cleanup := builder.Build(t)
defer cleanup()

auth := builder.L2Info.GetDefaultTransactOpts("Owner", ctx)

arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, builder.L2.Client)
Require(t, err)

chainConfig := params.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams.MaxCodeSize = 100
serializedChainConfig, err := json.Marshal(chainConfig)
Require(t, err)
tx, err := arbOwner.SetChainConfig(&auth, string(serializedChainConfig))
Require(t, err)
_, err = builder.L2.EnsureTxSucceeded(tx)
Require(t, err)

tx, err = arbOwner.SetAmortizedCostCapBips(&auth, 77734)
Require(t, err)
_, err = builder.L2.EnsureTxSucceeded(tx)
Require(t, err)

tx, err = arbOwner.ReleaseL1PricerSurplusFunds(&auth, big.NewInt(1))
Require(t, err)
_, err = builder.L2.EnsureTxSucceeded(tx)
Require(t, err)

tx, err = arbOwner.SetL2BaseFee(&auth, big.NewInt(1))
Require(t, err)
_, err = builder.L2.EnsureTxSucceeded(tx)
Require(t, err)
}

func TestArbGasInfoDoesntRevert(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 25fb1d4

Please sign in to comment.