From 182504855720c7c57bf4710ce06f76ae42f884b7 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Fri, 25 Apr 2025 13:28:51 +0100 Subject: [PATCH 1/2] Leggo --- internal/artifacts.go | 16 ++++++++++++---- internal/recipe_opstack.go | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/internal/artifacts.go b/internal/artifacts.go index e4e9186..5ac863e 100644 --- a/internal/artifacts.go +++ b/internal/artifacts.go @@ -36,9 +36,9 @@ import ( ) var ( - opBlockTimeSeconds = uint64(2) - defaultDiscoveryPrivKey = "a11ac89899cd86e36b6fb881ec1255b8a92a688790b7d950f8b7d8dd626671fb" - defaultDiscoveryEnodeID = "3479db4d9217fb5d7a8ed4d61ac36e120b05d36c2eefb795dc42ff2e971f251a2315f5649ea1833271e020b9adc98d5db9973c7ed92d6b2f1f2223088c3d852f" + defaultOpBlockTimeSeconds = uint64(2) + defaultDiscoveryPrivKey = "a11ac89899cd86e36b6fb881ec1255b8a92a688790b7d950f8b7d8dd626671fb" + defaultDiscoveryEnodeID = "3479db4d9217fb5d7a8ed4d61ac36e120b05d36c2eefb795dc42ff2e971f251a2315f5649ea1833271e020b9adc98d5db9973c7ed92d6b2f1f2223088c3d852f" ) // minimumGenesisDelay is the minimum delay for the genesis time. This is required @@ -66,6 +66,7 @@ type ArtifactsBuilder struct { applyLatestL1Fork bool genesisDelay uint64 applyLatestL2Fork *uint64 + OpblockTime uint64 } func NewArtifactsBuilder() *ArtifactsBuilder { @@ -73,6 +74,7 @@ func NewArtifactsBuilder() *ArtifactsBuilder { outputDir: "", applyLatestL1Fork: false, genesisDelay: MinimumGenesisDelay, + OpblockTime: defaultOpBlockTimeSeconds, } } @@ -96,6 +98,11 @@ func (b *ArtifactsBuilder) GenesisDelay(genesisDelaySeconds uint64) *ArtifactsBu return b } +func (b *ArtifactsBuilder) OpBlockTime(blockTimeSeconds uint64) *ArtifactsBuilder { + b.OpblockTime = blockTimeSeconds + return b +} + type Artifacts struct { Out *output } @@ -258,7 +265,7 @@ func (b *ArtifactsBuilder) Build() (*Artifacts, error) { forkTime = new(uint64) if *b.applyLatestL2Fork != 0 { - *forkTime = opTimestamp + opBlockTimeSeconds*(*b.applyLatestL2Fork) + *forkTime = opTimestamp + b.OpblockTime*(*b.applyLatestL2Fork) } else { *forkTime = 0 } @@ -317,6 +324,7 @@ func (b *ArtifactsBuilder) Build() (*Artifacts, error) { "number": 0, }, }, + "block_time": b.OpblockTime, "chain_op_config": map[string]interface{}{ // TODO: Read this from somewhere (genesis??) "eip1559Elasticity": 6, "eip1559Denominator": 50, diff --git a/internal/recipe_opstack.go b/internal/recipe_opstack.go index dfac98c..988b7e5 100644 --- a/internal/recipe_opstack.go +++ b/internal/recipe_opstack.go @@ -14,6 +14,10 @@ type OpRecipe struct { // whether to enable the latest fork isthmus and when enableLatestFork *uint64 + + // blockTime is the block time to use for the rollup + // (default is 2 seconds) + blockTime uint64 } func (o *OpRecipe) Name() string { @@ -28,6 +32,7 @@ func (o *OpRecipe) Flags() *flag.FlagSet { flags := flag.NewFlagSet("opstack", flag.ContinueOnError) flags.StringVar(&o.externalBuilder, "external-builder", "", "External builder URL") flags.Var(&nullableUint64Value{&o.enableLatestFork}, "enable-latest-fork", "Enable latest fork isthmus (nil or empty = disabled, otherwise enabled at specified block)") + flags.Uint64Var(&o.blockTime, "block-time", 1, "Block time to use for the rollup") return flags } From db7bfe728ab0b3552c170f4b0d5a3a1553d20c54 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Fri, 25 Apr 2025 15:05:21 +0100 Subject: [PATCH 2/2] Update --- internal/recipe_opstack.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/recipe_opstack.go b/internal/recipe_opstack.go index 988b7e5..e58f24c 100644 --- a/internal/recipe_opstack.go +++ b/internal/recipe_opstack.go @@ -32,13 +32,14 @@ func (o *OpRecipe) Flags() *flag.FlagSet { flags := flag.NewFlagSet("opstack", flag.ContinueOnError) flags.StringVar(&o.externalBuilder, "external-builder", "", "External builder URL") flags.Var(&nullableUint64Value{&o.enableLatestFork}, "enable-latest-fork", "Enable latest fork isthmus (nil or empty = disabled, otherwise enabled at specified block)") - flags.Uint64Var(&o.blockTime, "block-time", 1, "Block time to use for the rollup") + flags.Uint64Var(&o.blockTime, "block-time", defaultOpBlockTimeSeconds, "Block time to use for the rollup") return flags } func (o *OpRecipe) Artifacts() *ArtifactsBuilder { builder := NewArtifactsBuilder() builder.ApplyLatestL2Fork(o.enableLatestFork) + builder.OpBlockTime(o.blockTime) return builder }