Commit 874c0e98 authored by Minhyuk Kim's avatar Minhyuk Kim Committed by GitHub

Make honestActorConfig public so that it can be used in asterisc e2e tests (#12108)

parent 2d1f41c4
...@@ -47,23 +47,23 @@ func (g *OutputCannonGameHelper) StartChallenger(ctx context.Context, name strin ...@@ -47,23 +47,23 @@ func (g *OutputCannonGameHelper) StartChallenger(ctx context.Context, name strin
return c return c
} }
type honestActorConfig struct { type HonestActorConfig struct {
prestateBlock uint64 PrestateBlock uint64
poststateBlock uint64 PoststateBlock uint64
challengerOpts []challenger.Option ChallengerOpts []challenger.Option
} }
type HonestActorOpt func(cfg *honestActorConfig) type HonestActorOpt func(cfg *HonestActorConfig)
func WithClaimedL2BlockNumber(num uint64) HonestActorOpt { func WithClaimedL2BlockNumber(num uint64) HonestActorOpt {
return func(cfg *honestActorConfig) { return func(cfg *HonestActorConfig) {
cfg.poststateBlock = num cfg.PoststateBlock = num
} }
} }
func WithPrivKey(privKey *ecdsa.PrivateKey) HonestActorOpt { func WithPrivKey(privKey *ecdsa.PrivateKey) HonestActorOpt {
return func(cfg *honestActorConfig) { return func(cfg *HonestActorConfig) {
cfg.challengerOpts = append(cfg.challengerOpts, challenger.WithPrivKey(privKey)) cfg.ChallengerOpts = append(cfg.ChallengerOpts, challenger.WithPrivKey(privKey))
} }
} }
...@@ -75,21 +75,21 @@ func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node s ...@@ -75,21 +75,21 @@ func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node s
g.Require.NoError(err, "Failed to load block range") g.Require.NoError(err, "Failed to load block range")
splitDepth := g.SplitDepth(ctx) splitDepth := g.SplitDepth(ctx)
rollupClient := g.System.RollupClient(l2Node) rollupClient := g.System.RollupClient(l2Node)
actorCfg := &honestActorConfig{ actorCfg := &HonestActorConfig{
prestateBlock: realPrestateBlock, PrestateBlock: realPrestateBlock,
poststateBlock: realPostStateBlock, PoststateBlock: realPostStateBlock,
challengerOpts: g.defaultChallengerOptions(), ChallengerOpts: g.defaultChallengerOptions(),
} }
for _, option := range options { for _, option := range options {
option(actorCfg) option(actorCfg)
} }
cfg := challenger.NewChallengerConfig(g.T, g.System, l2Node, actorCfg.challengerOpts...) cfg := challenger.NewChallengerConfig(g.T, g.System, l2Node, actorCfg.ChallengerOpts...)
dir := filepath.Join(cfg.Datadir, "honest") dir := filepath.Join(cfg.Datadir, "honest")
prestateProvider := outputs.NewPrestateProvider(rollupClient, actorCfg.prestateBlock) prestateProvider := outputs.NewPrestateProvider(rollupClient, actorCfg.PrestateBlock)
l1Head := g.GetL1Head(ctx) l1Head := g.GetL1Head(ctx)
accessor, err := outputs.NewOutputCannonTraceAccessor( accessor, err := outputs.NewOutputCannonTraceAccessor(
logger, metrics.NoopMetrics, cfg.Cannon, vm.NewOpProgramServerExecutor(), l2Client, prestateProvider, cfg.CannonAbsolutePreState, rollupClient, dir, l1Head, splitDepth, actorCfg.prestateBlock, actorCfg.poststateBlock) logger, metrics.NoopMetrics, cfg.Cannon, vm.NewOpProgramServerExecutor(), l2Client, prestateProvider, cfg.CannonAbsolutePreState, rollupClient, dir, l1Head, splitDepth, actorCfg.PrestateBlock, actorCfg.PoststateBlock)
g.Require.NoError(err, "Failed to create output cannon trace accessor") g.Require.NoError(err, "Failed to create output cannon trace accessor")
return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, g.Game, accessor) return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, g.Game, accessor)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment