Skip to content

Commit

Permalink
Merge branch 'master' into fix-stakers-two-batch-posters
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Aug 3, 2023
2 parents 978eaeb + 08d25fe commit 81793f8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,9 @@ contracts/test/prover/proofs/%.json: $(arbitrator_cases)/%.wasm $(arbitrator_pro
test -f target/lib-wasm/libbrotlidec-static.a || ./scripts/build-brotli.sh -w -d
@touch $@

.make/wasm-lib: $(DEP_PREDICATE) $(ORDER_ONLY_PREDICATE) .make
.make/wasm-lib: $(DEP_PREDICATE) arbitrator/wasm-libraries/soft-float/SoftFloat/build/Wasm-Clang/softfloat.a $(ORDER_ONLY_PREDICATE) .make
test -f arbitrator/wasm-libraries/soft-float/bindings32.o || ./scripts/build-brotli.sh -f -d -t .
test -f arbitrator/wasm-libraries/soft-float/bindings64.o || ./scripts/build-brotli.sh -f -d -t .
test -f arbitrator/wasm-libraries/soft-float/SoftFloat/build/Wasm-Clang/softfloat.a || ./scripts/build-brotli.sh -f -d -t .
@touch $@

.make:
Expand Down
15 changes: 13 additions & 2 deletions arbos/arbosState/arbosstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,16 @@ func (state *ArbosState) UpgradeArbosVersion(
ErrFatalNodeOutOfDate,
)
}
// no state changes needed
// Update the PerBatchGasCost to a more accurate value compared to the old v6 default.
ensure(state.l1PricingState.SetPerBatchGasCost(l1pricing.InitialPerBatchGasCostV12))

// We had mistakenly initialized AmortizedCostCapBips to math.MaxUint64 in older versions,
// but the correct value to disable the amortization cap is 0.
oldAmortizationCap, err := state.l1PricingState.AmortizedCostCapBips()
ensure(err)
if oldAmortizationCap == math.MaxUint64 {
ensure(state.l1PricingState.SetAmortizedCostCapBips(0))
}
default:
return fmt.Errorf(
"the chain is upgrading to unsupported ArbOS version %v, %w",
Expand All @@ -315,7 +324,9 @@ func (state *ArbosState) UpgradeArbosVersion(
}

if firstTime && upgradeTo >= 6 {
state.Restrict(state.l1PricingState.SetPerBatchGasCost(l1pricing.InitialPerBatchGasCostV6))
if upgradeTo < 11 {
state.Restrict(state.l1PricingState.SetPerBatchGasCost(l1pricing.InitialPerBatchGasCostV6))
}
state.Restrict(state.l1PricingState.SetEquilibrationUnits(l1pricing.InitialEquilibrationUnitsV6))
state.Restrict(state.l2PricingState.SetSpeedLimitPerSecond(l2pricing.InitialSpeedLimitPerSecondV6))
state.Restrict(state.l2PricingState.SetMaxPerBlockGasLimit(l2pricing.InitialPerBlockGasLimitV6))
Expand Down
7 changes: 4 additions & 3 deletions arbos/l1pricing/l1pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ const (
)

const (
InitialInertia = 10
InitialPerUnitReward = 10
InitialPerBatchGasCostV6 = 100000
InitialInertia = 10
InitialPerUnitReward = 10
InitialPerBatchGasCostV6 = 100_000
InitialPerBatchGasCostV12 = 210_000 // overriden as part of the upgrade
)

// one minute at 100000 bytes / sec
Expand Down
15 changes: 6 additions & 9 deletions precompiles/ArbOwner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ import (
"math/big"
"testing"

"github.com/offchainlabs/nitro/arbos/l1pricing"

"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"

"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/util/testhelpers"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/testhelpers"
)

func TestArbOwner(t *testing.T) {
Expand Down Expand Up @@ -99,7 +96,7 @@ func TestArbOwner(t *testing.T) {

costCap, err := gasInfo.GetAmortizedCostCapBips(callCtx, evm)
Require(t, err)
if costCap != math.MaxUint64 {
if costCap != 0 {
Fail(t, costCap)
}
newCostCap := uint64(77734)
Expand Down

0 comments on commit 81793f8

Please sign in to comment.