-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
op-node/rollup/derive: Implement pipeline stage multiplexing (#12506)
* op-node/rollup/derive: Implement pipeline stage multiplexing * fix BatchStage empty batch generation * fix fork configuration in LargeL1Gaps test
- Loading branch information
1 parent
da68177
commit dbaedac
Showing
27 changed files
with
879 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package helpers | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/log" | ||
|
||
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" | ||
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils" | ||
"github.com/ethereum-optimism/optimism/op-node/rollup" | ||
"github.com/ethereum-optimism/optimism/op-node/rollup/sync" | ||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
) | ||
|
||
type Env struct { | ||
Log log.Logger | ||
Logs *testlog.CapturingHandler | ||
|
||
SetupData *e2eutils.SetupData | ||
|
||
Miner *L1Miner | ||
Seq *L2Sequencer | ||
SeqEngine *L2Engine | ||
Verifier *L2Verifier | ||
VerifEngine *L2Engine | ||
Batcher *L2Batcher | ||
} | ||
|
||
type EnvOpt struct { | ||
DeployConfigMod func(*genesis.DeployConfig) | ||
} | ||
|
||
func WithActiveFork(fork rollup.ForkName, offset uint64) EnvOpt { | ||
return EnvOpt{ | ||
DeployConfigMod: func(d *genesis.DeployConfig) { | ||
d.ActivateForkAtOffset(fork, offset) | ||
}, | ||
} | ||
} | ||
|
||
func WithActiveGenesisFork(fork rollup.ForkName) EnvOpt { | ||
return WithActiveFork(fork, 0) | ||
} | ||
|
||
// DefaultFork specifies the default fork to use when setting up the action test environment. | ||
// Currently manually set to Holocene. | ||
// Replace with `var DefaultFork = func() rollup.ForkName { return rollup.AllForks[len(rollup.AllForks)-1] }()` after Interop launch. | ||
const DefaultFork = rollup.Holocene | ||
|
||
// SetupEnv sets up a default action test environment. If no fork is specified, the default fork as | ||
// specified by the package variable [defaultFork] is used. | ||
func SetupEnv(t StatefulTesting, opts ...EnvOpt) (env Env) { | ||
dp := e2eutils.MakeDeployParams(t, DefaultRollupTestParams()) | ||
|
||
log, logs := testlog.CaptureLogger(t, log.LevelDebug) | ||
env.Log, env.Logs = log, logs | ||
|
||
dp.DeployConfig.ActivateForkAtGenesis(DefaultFork) | ||
for _, opt := range opts { | ||
if dcMod := opt.DeployConfigMod; dcMod != nil { | ||
dcMod(dp.DeployConfig) | ||
} | ||
} | ||
|
||
sd := e2eutils.Setup(t, dp, DefaultAlloc) | ||
env.SetupData = sd | ||
env.Miner, env.SeqEngine, env.Seq = SetupSequencerTest(t, sd, log) | ||
env.Miner.ActL1SetFeeRecipient(common.Address{'A'}) | ||
env.VerifEngine, env.Verifier = SetupVerifier(t, sd, log, env.Miner.L1Client(t, sd.RollupCfg), env.Miner.BlobStore(), &sync.Config{}) | ||
rollupSeqCl := env.Seq.RollupClient() | ||
env.Batcher = NewL2Batcher(log, sd.RollupCfg, DefaultBatcherCfg(dp), | ||
rollupSeqCl, env.Miner.EthClient(), env.SeqEngine.EthClient(), env.SeqEngine.EngineClient(t, sd.RollupCfg)) | ||
|
||
return | ||
} | ||
|
||
func (env Env) ActBatchSubmitAllAndMine(t Testing) (l1InclusionBlock *types.Block) { | ||
env.Batcher.ActSubmitAll(t) | ||
batchTx := env.Batcher.LastSubmitted | ||
env.Miner.ActL1StartBlock(12)(t) | ||
env.Miner.ActL1IncludeTxByHash(batchTx.Hash())(t) | ||
return env.Miner.ActL1EndBlock(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.