diff --git a/op-deployer/pkg/deployer/devfeatures.go b/op-deployer/pkg/deployer/devfeatures.go index 8e62bb1a42fd4..15328c3158205 100644 --- a/op-deployer/pkg/deployer/devfeatures.go +++ b/op-deployer/pkg/deployer/devfeatures.go @@ -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 +} diff --git a/op-devstack/presets/disputegame_v2.go b/op-devstack/presets/disputegame_v2.go index a47a1cf088b9d..110a4de8ab46d 100644 --- a/op-devstack/presets/disputegame_v2.go +++ b/op-devstack/presets/disputegame_v2.go @@ -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))) } diff --git a/op-devstack/sysgo/deployer.go b/op-devstack/sysgo/deployer.go index 36bae2539ccfe..6f034002e5fde 100644 --- a/op-devstack/sysgo/deployer.go +++ b/op-devstack/sysgo/deployer.go @@ -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) @@ -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)) } } diff --git a/op-devstack/sysgo/system.go b/op-devstack/sysgo/system.go index f2f3d9e316e22..a37d686ad0ee8 100644 --- a/op-devstack/sysgo/system.go +++ b/op-devstack/sysgo/system.go @@ -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)) diff --git a/op-e2e/e2eutils/intentbuilder/builder.go b/op-e2e/e2eutils/intentbuilder/builder.go index df30e53a08229..a1946f98090ae 100644 --- a/op-e2e/e2eutils/intentbuilder/builder.go +++ b/op-e2e/e2eutils/intentbuilder/builder.go @@ -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) { @@ -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)