Skip to content

Commit

Permalink
Add support for configuring the rollup stack deployment (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
eljobe authored Nov 28, 2024
1 parent 7f3b9eb commit b7965e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
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

0 comments on commit b7965e2

Please sign in to comment.