Skip to content

Commit

Permalink
Redo the test
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe committed Sep 11, 2024
1 parent a40ab8e commit 26eda6e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
12 changes: 6 additions & 6 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return bridgeCreatorAddr, nil
}

func deployChallengeFactory(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, hotshot common.Address) (common.Address, common.Address, error) {
func deployChallengeFactory(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (common.Address, common.Address, error) {
client := l1Reader.Client()
osp0, tx, _, err := ospgen.DeployOneStepProver0(auth, client)
err = andTxSucceeded(ctx, l1Reader, tx, err)
Expand All @@ -140,7 +140,7 @@ func deployChallengeFactory(ctx context.Context, l1Reader *headerreader.HeaderRe
return common.Address{}, common.Address{}, fmt.Errorf("ospMath deploy error: %w", err)
}

ospHostIo, tx, _, err := ospgen.DeployOneStepProverHostIo(auth, client, hotshot)
ospHostIo, tx, _, err := ospgen.DeployOneStepProverHostIo(auth, client, common.Address{})
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, common.Address{}, fmt.Errorf("ospHostIo deploy error: %w", err)
Expand All @@ -161,13 +161,13 @@ func deployChallengeFactory(ctx context.Context, l1Reader *headerreader.HeaderRe
return ospEntryAddr, challengeManagerAddr, nil
}

func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, maxDataSize *big.Int, hotshot common.Address, isUsingFeeToken bool) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) {
func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, maxDataSize *big.Int, isUsingFeeToken bool) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) {
bridgeCreator, err := deployBridgeCreator(ctx, l1Reader, auth, maxDataSize, isUsingFeeToken)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("bridge creator deploy error: %w", err)
}

ospEntryAddr, challengeManagerAddr, err := deployChallengeFactory(ctx, l1Reader, auth, hotshot)
ospEntryAddr, challengeManagerAddr, err := deployChallengeFactory(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}
Expand Down Expand Up @@ -234,12 +234,12 @@ func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return rollupCreator, rollupCreatorAddress, validatorUtils, validatorWalletCreator, nil
}

func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPosters []common.Address, batchPosterManager common.Address, authorizeValidators uint64, config rollupgen.Config, nativeToken common.Address, maxDataSize *big.Int, hotshot common.Address, isUsingFeeToken bool) (*chaininfo.RollupAddresses, error) {
func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPosters []common.Address, batchPosterManager common.Address, authorizeValidators uint64, config rollupgen.Config, nativeToken common.Address, maxDataSize *big.Int, isUsingFeeToken bool) (*chaininfo.RollupAddresses, error) {
if config.WasmModuleRoot == (common.Hash{}) {
return nil, errors.New("no machine specified")
}

rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize, hotshot, isUsingFeeToken)
rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize, isUsingFeeToken)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
}
Expand Down
19 changes: 7 additions & 12 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder {
b.L1Info = NewL1TestInfo(t)
b.L2Info = NewArbTestInfo(t, b.chainConfig.ChainID)
b.dataDir = t.TempDir()
b.l1StackConfig = createStackConfigForTest(t.TempDir())
b.l1StackConfig = createStackConfigForTest(b.dataDir)
b.l2StackConfig = createStackConfigForTest(b.dataDir)
cp := valnode.TestValidationConfig
b.valnodeConfig = &cp
Expand Down Expand Up @@ -222,7 +222,7 @@ func (b *NodeBuilder) Build(t *testing.T) func() {
if b.withL1 {
l1, l2 := NewTestClient(b.ctx), NewTestClient(b.ctx)
b.L2Info, l2.ConsensusNode, l2.Client, l2.Stack, b.L1Info, l1.L1Backend, l1.Client, l1.Stack =
createTestNodeOnL1WithConfigImpl(t, b.ctx, b.isSequencer, b.nodeConfig, b.execConfig, b.chainConfig, b.l1StackConfig, b.l2StackConfig, b.valnodeConfig, b.L2Info)
createTestNodeWithL1(t, b.ctx, b.isSequencer, b.nodeConfig, b.execConfig, b.chainConfig, b.l2StackConfig, b.valnodeConfig, b.L2Info)
b.L1, b.L2 = l1, l2
b.L1.cleanup = func() { requireClose(t, b.L1.Stack) }
} else {
Expand Down Expand Up @@ -719,7 +719,7 @@ func getInitMessage(ctx context.Context, t *testing.T, l1client client, addresse
}

func DeployOnTestL1(
t *testing.T, ctx context.Context, l1info info, l1client client, chainConfig *params.ChainConfig, wasmModuleRoot common.Hash, hotshotAddr common.Address,
t *testing.T, ctx context.Context, l1info info, l1client client, chainConfig *params.ChainConfig, wasmModuleRoot common.Hash,
) (*chaininfo.RollupAddresses, *arbostypes.ParsedInitMessage) {
l1info.GenerateAccount("RollupOwner")
l1info.GenerateAccount("Sequencer")
Expand Down Expand Up @@ -754,7 +754,6 @@ func DeployOnTestL1(
arbnode.GenerateRollupConfig(false, wasmModuleRoot, l1info.GetAddress("RollupOwner"), chainConfig, serializedChainConfig, common.Address{}),
nativeToken,
maxDataSize,
hotshotAddr,
false,
)
Require(t, err)
Expand Down Expand Up @@ -820,14 +819,14 @@ func ClientForStack(t *testing.T, backend *node.Node) *ethclient.Client {
return ethclient.NewClient(rpcClient)
}

func createTestNodeOnL1WithConfigImpl(
// Create and deploy L1 and arbnode for L2
func createTestNodeWithL1(
t *testing.T,
ctx context.Context,
isSequencer bool,
nodeConfig *arbnode.Config,
execConfig *gethexec.Config,
chainConfig *params.ChainConfig,
l1StackConfig *node.Config,
stackConfig *node.Config,
valnodeConfig *valnode.Config,
l2info_in info,
Expand All @@ -845,21 +844,17 @@ func createTestNodeOnL1WithConfigImpl(
chainConfig = params.ArbitrumDevTestChainConfig()
}
fatalErrChan := make(chan error, 10)
l1info, l1client, l1backend, l1stack = createTestL1BlockChainWithConfig(t, nil, l1StackConfig)
l1info, l1client, l1backend, l1stack = createTestL1BlockChain(t, nil)
var l2chainDb ethdb.Database
var l2arbDb ethdb.Database
var l2blockchain *core.BlockChain
l2info = l2info_in
if l2info == nil {
l2info = NewArbTestInfo(t, chainConfig.ChainID)
}
var lightClientAddr common.Address
if nodeConfig.BlockValidator.LightClientAddress != "" {
lightClientAddr = common.HexToAddress(nodeConfig.BlockValidator.LightClientAddress)
}
locator, err := server_common.NewMachineLocator(valnodeConfig.Wasm.RootPath)
Require(t, err)
addresses, initMessage := DeployOnTestL1(t, ctx, l1info, l1client, chainConfig, locator.LatestWasmModuleRoot(), lightClientAddr)
addresses, initMessage := DeployOnTestL1(t, ctx, l1info, l1client, chainConfig, locator.LatestWasmModuleRoot())
_, l2stack, l2chainDb, l2arbDb, l2blockchain = createL2BlockChainWithStackConfig(t, l2info, "", chainConfig, initMessage, stackConfig, &execConfig.Caching)
var sequencerTxOptsPtr *bind.TransactOpts
var dataSigner signature.DataSignerFunc
Expand Down
4 changes: 2 additions & 2 deletions system_tests/espresso_sovereign_sequencer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func createL1AndL2Node(ctx context.Context, t *testing.T) (*NodeBuilder, func())
builder.nodeConfig.BlockValidator.Enable = true
builder.nodeConfig.BlockValidator.ValidationPoll = 2 * time.Second
builder.nodeConfig.BlockValidator.ValidationServer.URL = fmt.Sprintf("ws://127.0.0.1:%d", arbValidationPort)
builder.nodeConfig.BlockValidator.LightClientAddress = lightClientAddress
builder.nodeConfig.BlockValidator.Espresso = true
// builder.nodeConfig.BlockValidator.LightClientAddress = lightClientAddress
// builder.nodeConfig.BlockValidator.Espresso = true
builder.nodeConfig.DelayedSequencer.Enable = true
builder.nodeConfig.DelayedSequencer.FinalizeDistance = 1

Expand Down

0 comments on commit 26eda6e

Please sign in to comment.