From 5d7a330c86b1f238d30106a3d00d140e582247b7 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 12 Sep 2024 13:45:43 +0800 Subject: [PATCH 1/2] fix: deploy both erc20 based and eth based templates --- cmd/deploy/deploy.go | 2 -- deploy/deploy.go | 21 +++++++++++++-------- system_tests/common_test.go | 1 - 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/deploy/deploy.go b/cmd/deploy/deploy.go index d8c0aeeac4..e0388e3d4b 100644 --- a/cmd/deploy/deploy.go +++ b/cmd/deploy/deploy.go @@ -61,7 +61,6 @@ func main() { authorizevalidators := flag.Uint64("authorizevalidators", 0, "Number of validators to preemptively authorize") txTimeout := flag.Duration("txtimeout", 10*time.Minute, "Timeout when waiting for a transaction to be included in a block") prod := flag.Bool("prod", false, "Whether to configure the rollup for production or testing") - isUsingFeeToken := flag.Bool("isUsingFeeToken", false, "true if the chain uses custom fee token") flag.Parse() l1ChainId := new(big.Int).SetUint64(*l1ChainIdUint) maxDataSize := new(big.Int).SetUint64(*maxDataSizeUint) @@ -190,7 +189,6 @@ func main() { arbnode.GenerateRollupConfig(*prod, moduleRoot, ownerAddress, &chainConfig, chainConfigJson, loserEscrowAddress), nativeToken, maxDataSize, - *isUsingFeeToken, ) if err != nil { flag.Usage() diff --git a/deploy/deploy.go b/deploy/deploy.go index 5e7755cae3..f7ae6d0b59 100644 --- a/deploy/deploy.go +++ b/deploy/deploy.go @@ -31,7 +31,7 @@ func andTxSucceeded(ctx context.Context, l1Reader *headerreader.HeaderReader, tx return nil } -func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, maxDataSize *big.Int, isUsingFeeToken bool) (common.Address, error) { +func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, maxDataSize *big.Int) (common.Address, error) { client := l1Reader.Client() /// deploy eth based templates @@ -46,7 +46,12 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade if err != nil { return common.Address{}, fmt.Errorf("blob basefee reader deploy error: %w", err) } - seqInboxTemplate, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize, reader4844, isUsingFeeToken) + seqInboxTemplateEthBased, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize, reader4844, false) + err = andTxSucceeded(ctx, l1Reader, tx, err) + if err != nil { + return common.Address{}, fmt.Errorf("sequencer inbox deploy error: %w", err) + } + seqInboxTemplateERC20Based, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize, reader4844, true) err = andTxSucceeded(ctx, l1Reader, tx, err) if err != nil { return common.Address{}, fmt.Errorf("sequencer inbox deploy error: %w", err) @@ -72,7 +77,7 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade ethBasedTemplates := rollupgen.BridgeCreatorBridgeContracts{ Bridge: bridgeTemplate, - SequencerInbox: seqInboxTemplate, + SequencerInbox: seqInboxTemplateEthBased, Inbox: inboxTemplate, RollupEventInbox: rollupEventBridgeTemplate, Outbox: outboxTemplate, @@ -105,7 +110,7 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade erc20BasedTemplates := rollupgen.BridgeCreatorBridgeContracts{ Bridge: erc20BridgeTemplate, - SequencerInbox: seqInboxTemplate, + SequencerInbox: seqInboxTemplateERC20Based, Inbox: erc20InboxTemplate, RollupEventInbox: erc20RollupEventBridgeTemplate, Outbox: erc20OutboxTemplate, @@ -161,8 +166,8 @@ 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, isUsingFeeToken bool) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) { - bridgeCreator, err := deployBridgeCreator(ctx, l1Reader, auth, maxDataSize, isUsingFeeToken) +func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, maxDataSize *big.Int) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) { + bridgeCreator, err := deployBridgeCreator(ctx, l1Reader, auth, maxDataSize) if err != nil { return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("bridge creator deploy error: %w", err) } @@ -234,12 +239,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, 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) (*chaininfo.RollupAddresses, error) { if config.WasmModuleRoot == (common.Hash{}) { return nil, errors.New("no machine specified") } - rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize, isUsingFeeToken) + rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize) if err != nil { return nil, fmt.Errorf("error deploying rollup creator: %w", err) } diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 7a78cee309..6975990be0 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -1040,7 +1040,6 @@ func DeployOnTestL1( arbnode.GenerateRollupConfig(prodConfirmPeriodBlocks, wasmModuleRoot, l1info.GetAddress("RollupOwner"), chainConfig, serializedChainConfig, common.Address{}), nativeToken, maxDataSize, - false, ) Require(t, err) l1info.SetContract("Bridge", addresses.Bridge) From e92300cb2c652846295af6de7da692a6b901cf3e Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 12 Sep 2024 13:47:04 +0800 Subject: [PATCH 2/2] chore: error message --- deploy/deploy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/deploy.go b/deploy/deploy.go index f7ae6d0b59..f2099f976a 100644 --- a/deploy/deploy.go +++ b/deploy/deploy.go @@ -49,12 +49,12 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade seqInboxTemplateEthBased, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize, reader4844, false) err = andTxSucceeded(ctx, l1Reader, tx, err) if err != nil { - return common.Address{}, fmt.Errorf("sequencer inbox deploy error: %w", err) + return common.Address{}, fmt.Errorf("sequencer inbox eth based deploy error: %w", err) } seqInboxTemplateERC20Based, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize, reader4844, true) err = andTxSucceeded(ctx, l1Reader, tx, err) if err != nil { - return common.Address{}, fmt.Errorf("sequencer inbox deploy error: %w", err) + return common.Address{}, fmt.Errorf("sequencer inbox erc20 based deploy error: %w", err) } inboxTemplate, tx, _, err := bridgegen.DeployInbox(auth, client, maxDataSize)