Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions op-deployer/pkg/deployer/devfeatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ func IsDevFeatureEnabled(bitmap, flag common.Hash) bool {
bitmapContainsFeatures := new(big.Int).And(b, f).Cmp(f) == 0
return featuresIsNonZero && bitmapContainsFeatures
}

func EnableDevFeature(bitmap, flag common.Hash) common.Hash {
var result common.Hash
for i := 0; i < 32; i++ {
result[i] = bitmap[i] | flag[i]
}
return result
}
2 changes: 1 addition & 1 deletion op-devstack/presets/disputegame_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func WithDisputeGameV2() stack.CommonOption {
return stack.MakeCommon(sysgo.WithDeployerOptions(sysgo.WithDevFeatureBitmap(deployer.DeployV2DisputeGamesDevFlag)))
return stack.MakeCommon(sysgo.WithDeployerOptions(sysgo.WithDevFeatureEnabled(deployer.DeployV2DisputeGamesDevFlag)))
}
12 changes: 9 additions & 3 deletions op-devstack/sysgo/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

// funderMnemonicIndex the funding account is not one of the 30 standard account, but still derived from a user-key.
const funderMnemonicIndex = 10_000
const devFeatureBitmapKey = "devFeatureBitmap"

type DeployerOption func(p devtest.P, keys devkeys.Keys, builder intentbuilder.Builder)

Expand Down Expand Up @@ -274,10 +275,15 @@ func WithPrefundedL2(l1ChainID, l2ChainID eth.ChainID) DeployerOption {
}
}

// WithDevFeatureBitmap sets the dev feature bitmap.
func WithDevFeatureBitmap(devFlags common.Hash) DeployerOption {
// WithDevFeatureEnabled adds a feature as enabled in the dev feature bitmap
func WithDevFeatureEnabled(flag common.Hash) DeployerOption {
return func(p devtest.P, keys devkeys.Keys, builder intentbuilder.Builder) {
builder.WithGlobalOverride("devFeatureBitmap", devFlags)
currentValue := builder.GlobalOverride(devFeatureBitmapKey)
var bitmap common.Hash
if currentValue != nil {
bitmap = currentValue.(common.Hash)
}
builder.WithGlobalOverride(devFeatureBitmapKey, deployer.EnableDevFeature(bitmap, flag))
}
}

Expand Down
2 changes: 1 addition & 1 deletion op-devstack/sysgo/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func defaultSuperProofsSystem(dest *DefaultInteropSystemIDs, deployerOpts ...Dep
WithCommons(ids.L1.ChainID()),
WithPrefundedL2(ids.L1.ChainID(), ids.L2A.ChainID()),
WithPrefundedL2(ids.L1.ChainID(), ids.L2B.ChainID()),
WithDevFeatureBitmap(deployer.OptimismPortalInteropDevFlag),
WithDevFeatureEnabled(deployer.OptimismPortalInteropDevFlag),
}, deployerOpts...)...))

opt.Add(WithL1Nodes(ids.L1EL, ids.L1CL))
Expand Down
5 changes: 5 additions & 0 deletions op-e2e/e2eutils/intentbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type Builder interface {
Build() (*state.Intent, error)

WithGlobalOverride(key string, value any) Builder
GlobalOverride(key string) any
}

func WithDevkeyVaults(t require.TestingT, dk devkeys.Keys, configurator L2Configurator) {
Expand Down Expand Up @@ -223,6 +224,10 @@ func (b *intentBuilder) WithGlobalOverride(key string, value any) Builder {
return b
}

func (b *intentBuilder) GlobalOverride(key string) any {
return b.intent.GlobalDeployOverrides[key]
}

func (b *intentBuilder) Build() (*state.Intent, error) {
if err := b.intent.Check(); err != nil {
return nil, fmt.Errorf("check intent: %w", err)
Expand Down