Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for configuring the rollup stack deployment #710

Merged
merged 1 commit into from
Nov 28, 2024
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
7 changes: 5 additions & 2 deletions testing/endtoend/backend/anvil_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ func (a *AnvilLocal) DeployRollup(ctx context.Context, opts ...challenge_testing
anyTrustFastConfirmer,
opts...,
),
false, // Do not use a mock bridge.
true, // Use a mock one step prover entry.
setup.RollupStackConfig{
UseMockBridge: false,
UseMockOneStepProver: true,
MinimumAssertionPeriod: 0,
},
)
if err != nil {
return nil, errors.Wrap(err, "could not deploy rollup stack")
Expand Down
27 changes: 21 additions & 6 deletions testing/setup/rollup_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ type ChainSetup struct {
useMockBridge bool
useMockOneStepProver bool
numAccountsToGen uint64
minimumAssertionPeriod int64
challengeTestingOpts []challenge_testing.Opt
StateManagerOpts []statemanager.Opt
EnableFastConfirmation bool
Expand Down Expand Up @@ -203,6 +204,12 @@ func WithMockBridge() Opt {
}
}

func WithMinimumAssertionPeriod(period int64) Opt {
return func(setup *ChainSetup) {
setup.minimumAssertionPeriod = period
}
}

func WithChallengeTestingOpts(opts ...challenge_testing.Opt) Opt {
return func(setup *ChainSetup) {
setup.challengeTestingOpts = opts
Expand Down Expand Up @@ -377,8 +384,11 @@ func ChainsWithEdgeChallengeManager(opts ...Opt) (*ChainSetup, error) {
accs[0].TxOpts,
accs[0].TxOpts.From, // Sequencer addr.
cfg,
setp.useMockBridge,
setp.useMockOneStepProver,
RollupStackConfig{
UseMockBridge: setp.useMockBridge,
UseMockOneStepProver: setp.useMockOneStepProver,
MinimumAssertionPeriod: setp.minimumAssertionPeriod,
},
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -486,17 +496,22 @@ type RollupAddresses struct {
DeployedAt uint64 `json:"deployed-at"`
}

type RollupStackConfig struct {
UseMockBridge bool
UseMockOneStepProver bool
MinimumAssertionPeriod int64
}

func DeployFullRollupStack(
ctx context.Context,
backend protocol.ChainBackend,
deployAuth *bind.TransactOpts,
sequencer common.Address,
config rollupgen.Config,
useMockBridge bool,
useMockOneStepProver bool,
stackConf RollupStackConfig,
) (*RollupAddresses, error) {
log.Info("Deploying rollup creator")
rollupCreator, rollupUserAddr, rollupCreatorAddress, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, backend, deployAuth, useMockBridge, useMockOneStepProver)
rollupCreator, rollupUserAddr, rollupCreatorAddress, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, backend, deployAuth, stackConf.UseMockBridge, stackConf.UseMockOneStepProver)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -552,7 +567,7 @@ func DeployFullRollupStack(
if err != nil {
return nil, err
}
setMinimumAssertionPeriod, err := rollupABI.Pack("setMinimumAssertionPeriod", big.NewInt(0))
setMinimumAssertionPeriod, err := rollupABI.Pack("setMinimumAssertionPeriod", big.NewInt(stackConf.MinimumAssertionPeriod))
if err != nil {
return nil, err
}
Expand Down
Loading