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 deploying erc20-based rollup #1683

Closed
wants to merge 121 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
82c736b
Merge pull request #2 from OffchainLabs/token-fees
PlasmaPower Jan 10, 2023
98f5943
Add first version of token bridge
gvladika Jan 12, 2023
2ac89af
Add Foundry support
gvladika Jan 12, 2023
a8fb5db
Add unit test cases for NativeTokenBridge
gvladika Jan 12, 2023
95d36e0
Add 1st version of NativeTokenInbox with deposit token implementation
gvladika Jan 13, 2023
88b9e4b
Add implementation and test for creating retryable tickets
gvladika Jan 16, 2023
380de82
Implement executeCall for NativeTokenBridge
gvladika Jan 16, 2023
27fac01
Add Outbox test for executing transaction
gvladika Jan 17, 2023
d24780f
Refactor Bridge by adding abstract contract and 2 implemenation contr…
gvladika Jan 17, 2023
121a51e
Add ERC20BridgeCreator implementation and tests
gvladika Jan 17, 2023
363710d
Rename 'NativeToken' to 'ERC20'
gvladika Jan 18, 2023
dba2e45
Add separate test file for common eth/erc20 bridge functions
gvladika Jan 18, 2023
357772e
Implement Bridge and ERC20Bridge test cases using inheritance
gvladika Jan 19, 2023
df8f274
Standardize test names
gvladika Jan 19, 2023
c703619
Test setDelayedInbox bridge function
gvladika Jan 19, 2023
eda8437
Add more bridge tests
gvladika Jan 19, 2023
c5ee54b
Add enqueueSequencerMessage tests
gvladika Jan 19, 2023
5895e19
Merge branch 'master' into alternative-token-fees
gvladika Jan 20, 2023
62b6e10
Add more executeCall test cases
gvladika Jan 20, 2023
4e34a5d
Merge remote-tracking branch 'upstream/master'
PlasmaPower Jan 20, 2023
c22bcbf
Add more executeCall test cases
gvladika Jan 22, 2023
46200a2
Add more ERC20Inbox test cases
gvladika Jan 22, 2023
6bdbad5
Remove hard-coded forge-std
gvladika Jan 23, 2023
d49835a
Add forge-std as git submodule dependency
gvladika Jan 23, 2023
9cb4cf8
Add more depositERC20 test cases
gvladika Jan 23, 2023
1e3b0b7
Refactor Inbox to use abstract base abstract contract and 2 implement…
gvladika Jan 23, 2023
65042f6
Inherit from common interface
gvladika Jan 23, 2023
45d61d4
Add EthInbox test cases
gvladika Jan 23, 2023
f5f7b10
Add createRetryableTicket test cases
gvladika Jan 23, 2023
c449d22
Add more createRetryableTicket test cases
gvladika Jan 24, 2023
994a2a0
Fix test_createRetryableTicket_revert_InsufficientValue test
gvladika Jan 24, 2023
cb4f975
Refactor retryable ticket creation to avoid code duplication
gvladika Jan 24, 2023
e50cb82
Move more logic to abstract Inbox
gvladika Jan 24, 2023
ed9defd
Remove unneccessary function
gvladika Jan 24, 2023
4c2717f
More retryables test cases
gvladika Jan 24, 2023
16c2c96
Check bridge events are properly emitted
gvladika Jan 25, 2023
4daf1d1
Add test cases for calculateRetryableSubmissionFee and unsafeCreateRe…
gvladika Jan 25, 2023
bfe5fd0
Remove unnecessary functions
gvladika Jan 25, 2023
a2e5fbd
Refactor enqueueDelayedMessage
gvladika Jan 25, 2023
e271e3a
Refactor executeCall
gvladika Jan 25, 2023
62db629
Remove unused imports
gvladika Jan 25, 2023
3c86abc
Update CI - add unit tests, remove coverage and codeql
gvladika Jan 25, 2023
ce059c9
Fix CI jobs
gvladika Jan 25, 2023
949c091
Update .dot files (same storage layout, but different super class nam…
gvladika Jan 25, 2023
385866b
Re-enable Arbitrator test job, without uploading to codecov
gvladika Jan 25, 2023
f55fa38
Move sendL2Message and sendL2MessageFromOrigin to parent contract, ad…
gvladika Jan 31, 2023
0409ac1
Move sendUnsignedTransaction and sendContractTransaction to AbsInbox,…
gvladika Jan 31, 2023
d9d162b
Fix build
gvladika Jan 31, 2023
e0457f4
Use inheritance for Eth/ERC20 bridge creators
gvladika Feb 1, 2023
d848557
Implement Eth/ERC20 rollup creators as subclasses
gvladika Feb 3, 2023
9a29d81
Update bridge creator inheritance structure
gvladika Feb 3, 2023
4c07e3e
Add Eth/ERC20 implementation of RollupEventInbox
gvladika Feb 3, 2023
ccd6306
Use different Eth/ERC20 implementations for rollup event inbox
gvladika Feb 3, 2023
380dca6
Add more docs
gvladika Feb 5, 2023
578ae68
Implement test cases for Eth/ERC20 RollupCreators
gvladika Feb 6, 2023
0eb3b98
Temporary use hardcoded deployment of native token
gvladika Feb 9, 2023
31eee35
Update test node script
gvladika Feb 9, 2023
c925943
Update node.go to support deployment of ERC20 rollups
gvladika Feb 9, 2023
b776250
Add script that creates ERC20 to be used as rollup's native currency
gvladika Feb 10, 2023
a6141ea
Fix formatting and native token checks
gvladika Feb 10, 2023
8c9cb8f
Typo
gvladika Feb 10, 2023
3f71238
Add missing err check
gvladika Feb 10, 2023
49d911d
Fix CI
gvladika Feb 13, 2023
1274147
Downgrade Go to 1.19 for Arbitrator CI
PlasmaPower Feb 13, 2023
73ce784
Avoid code duplication when deploying L2
gvladika Mar 7, 2023
d98a130
Merge branch 'erc20-nitro' of github.com:OffchainLabs/nitro-private i…
gvladika Mar 7, 2023
8c0c0ba
Skip lint check
gvladika Mar 7, 2023
6cc870f
Another lint check skip
gvladika Mar 7, 2023
0f6e2fe
Pin nodejs version
gvladika Mar 7, 2023
e046a6c
Use safeTransfer instead of low level call
gvladika Mar 8, 2023
e4d4436
Report basefee as 0 in ERC20 rollup case, so submission cost charged …
gvladika Mar 8, 2023
b1a7b10
Fix CI
gvladika Mar 8, 2023
8287180
Improve test, add comments
gvladika Mar 8, 2023
9e3e0bb
Update comment
gvladika Mar 8, 2023
81a8636
Add 1st integration test for erc20 rollup
gvladika Mar 9, 2023
d09e760
Add token deposit integration test
gvladika Mar 9, 2023
de4b36d
Revert if call target is the native token
gvladika Mar 20, 2023
c3067b9
Add 'withdrawalAmount' field to context
gvladika Mar 21, 2023
fb88385
Add l2ToL1WithdrawalAmount function
gvladika Mar 21, 2023
c2037f0
Test default state of Outbox context
gvladika Mar 21, 2023
d6bb553
Add new function to test contract
gvladika Mar 21, 2023
f2f3e54
Fix formatting
gvladika Mar 21, 2023
3d8d483
Add executeTransaction test case for eth rollup
gvladika Mar 22, 2023
1cd8f78
Test CallTargetNotAllowed
gvladika Mar 22, 2023
98c824e
Update mutability to view/pure
gvladika Mar 22, 2023
7412070
Fix comparison value
gvladika Mar 22, 2023
7adb2a5
Pack context struct vars into 4 storage slots
gvladika Mar 22, 2023
9675d07
Fix CI
gvladika Mar 22, 2023
4dda246
Update Outbox storage layout, add layout for missing contracts
gvladika Mar 22, 2023
b454caa
Test that context is properly set during execution
gvladika Mar 22, 2023
ffd35f9
Add description for L2ToL1Context's storage layout
gvladika Mar 22, 2023
661c73d
Merge branch 'alternative-token-fees' into erc20-integration-test
gvladika Mar 26, 2023
2b4c096
Move test contract to src/test-helpers
gvladika Mar 27, 2023
d60009d
Add code docs for new functions
gvladika Mar 27, 2023
14c88a4
Add integration test cases for issuing retryables in erc20-based rollup
gvladika Mar 28, 2023
f85f182
Merge branch 'alternative-token-fees' into erc20-nitro
gvladika Mar 28, 2023
7f71e3b
Merge branch 'erc20-nitro' into erc20-integration-test
gvladika Mar 28, 2023
de618cc
Add l2->l1 withdrawal test case for erc20-based rollup
gvladika Mar 28, 2023
13b0f53
Add missing await
gvladika Mar 28, 2023
871856b
Sort out dependency conflicts
gvladika Mar 28, 2023
f81275c
Merge pull request #4 from OffchainLabs/alternative-token-fees
gvladika Apr 17, 2023
453da6c
Merge pull request #7 from OffchainLabs/erc20-nitro
gvladika Apr 17, 2023
2497d70
Merge pull request #8 from OffchainLabs/erc20-integration-test
gvladika Apr 17, 2023
84e0dd9
Put initializer entrypoints to child contracts
gvladika May 17, 2023
e5a971b
Approve bridge to fetch native token held by inbox
gvladika May 17, 2023
2ef2c1d
Transfer fund to bridge from inbox
gvladika May 17, 2023
f652f2f
Update test-cases to approve inbox to spend tokens instead of bridge
gvladika May 17, 2023
49c62fb
Expect events in proper place
gvladika May 17, 2023
3d140fc
Transfer just enough native tokens to cover fees
gvladika May 19, 2023
7c52fff
Lint
gvladika May 19, 2023
7cb41a4
Merge pull request #10 from OffchainLabs/orbit-feetoken-flow
gvladika May 23, 2023
6a90648
Convert the contracts folder into a submodule
gvladika May 31, 2023
a9ec9b3
Merge branch 'master' into feature-orbit-support
gvladika May 31, 2023
e740103
Remove contracts submodule
gvladika May 31, 2023
4f11b42
Add contracts submodule
gvladika May 31, 2023
8d8348e
Remove unnecessary CI changes
gvladika May 31, 2023
2b95178
Use feature-orbit-bridge
gvladika May 31, 2023
a36f9a9
Update contracts submodule to temporary use feature-orbit-bridge
gvladika Jun 1, 2023
2448683
Don't calculate expected rollup address in go deployer
gvladika Jun 4, 2023
6808b85
Update solgen generated library names
gvladika Jun 7, 2023
bdf832e
Merge branch 'master' into feature-erc20-rollup
gvladika Jun 21, 2023
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[submodule "contracts"]
path = contracts
url = https://github.com/OffchainLabs/nitro-contracts.git
branch = develop
branch = feature-orbit-bridge
[submodule "blockscout"]
path = blockscout
url = https://github.com/OffchainLabs/blockscout.git
Expand Down
174 changes: 135 additions & 39 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return bridgeCreatorAddr, nil
}

func deployERC20BridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (common.Address, error) {
client := l1Reader.Client()

bridgeCreatorAddr, tx, _, err := rollupgen.DeployERC20BridgeCreator(auth, client)

err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("erc20 bridge creator deploy error: %w", err)
}

return bridgeCreatorAddr, nil
}

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)
Expand Down Expand Up @@ -144,45 +157,85 @@ func deployChallengeFactory(ctx context.Context, l1Reader *headerreader.HeaderRe
return ospEntryAddr, challengeManagerAddr, nil
}

func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) {
bridgeCreator, err := deployBridgeCreator(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}

func deployRollupDependencies(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (common.Address, common.Address, common.Address, common.Address, common.Address, common.Address, error) {
ospEntryAddr, challengeManagerAddr, err := deployChallengeFactory(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
return common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, err
}

rollupAdminLogic, tx, _, err := rollupgen.DeployRollupAdminLogic(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup admin logic deploy error: %w", err)
return common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup admin logic deploy error: %w", err)
}

rollupUserLogic, tx, _, err := rollupgen.DeployRollupUserLogic(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup user logic deploy error: %w", err)
return common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup user logic deploy error: %w", err)
}

validatorUtils, tx, _, err := rollupgen.DeployValidatorUtils(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("validator utils deploy error: %w", err)
}

validatorWalletCreator, tx, _, err := rollupgen.DeployValidatorWalletCreator(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("validator wallet creator deploy error: %w", err)
}

return ospEntryAddr, challengeManagerAddr, rollupAdminLogic, rollupUserLogic, validatorUtils, validatorWalletCreator, nil
}

func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (*rollupgen.RollupCreator, common.Address, common.Address, common.Address, error) {
ospEntryAddr, challengeManagerAddr, rollupAdminLogic, rollupUserLogic, validatorUtils, validatorWalletCreator, err := deployRollupDependencies(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}
bridgeCreator, err := deployBridgeCreator(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}
rollupCreatorAddress, tx, rollupCreator, err := rollupgen.DeployRollupCreator(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup creator deploy error: %w", err)
}

validatorUtils, tx, _, err := rollupgen.DeployValidatorUtils(auth, l1Reader.Client())
tx, err = rollupCreator.SetTemplates(
auth,
bridgeCreator,
ospEntryAddr,
challengeManagerAddr,
rollupAdminLogic,
rollupUserLogic,
validatorUtils,
validatorWalletCreator,
)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("validator utils deploy error: %w", err)
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup set template error: %w", err)
}

validatorWalletCreator, tx, _, err := rollupgen.DeployValidatorWalletCreator(auth, l1Reader.Client())
return rollupCreator, rollupCreatorAddress, validatorUtils, validatorWalletCreator, nil
}

func deployERC20RollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts, nativeERC20Token common.Address) (*rollupgen.ERC20RollupCreator, common.Address, common.Address, common.Address, error) {
ospEntryAddr, challengeManagerAddr, rollupAdminLogic, rollupUserLogic, validatorUtils, validatorWalletCreator, err := deployRollupDependencies(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}
bridgeCreator, err := deployERC20BridgeCreator(ctx, l1Reader, auth)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, err
}
rollupCreatorAddress, tx, rollupCreator, err := rollupgen.DeployERC20RollupCreator(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("validator wallet creator deploy error: %w", err)
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup creator deploy error: %w", err)
}

tx, err = rollupCreator.SetTemplates(
Expand Down Expand Up @@ -230,7 +283,7 @@ func GenerateRollupConfig(prod bool, wasmModuleRoot common.Hash, rollupOwner com
}
}

func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *bind.TransactOpts, sequencer common.Address, authorizeValidators uint64, readerConfig headerreader.ConfigFetcher, config rollupgen.Config) (*chaininfo.RollupAddresses, error) {
func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *bind.TransactOpts, sequencer common.Address, authorizeValidators uint64, readerConfig headerreader.ConfigFetcher, config rollupgen.Config, nativeERC20Token common.Address) (*chaininfo.RollupAddresses, error) {
l1Reader, err := headerreader.New(ctx, l1client, readerConfig)
if err != nil {
return nil, err
Expand All @@ -242,28 +295,70 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b
return nil, errors.New("no machine specified")
}

rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, l1Reader, deployAuth)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
}
var validatorUtils, validatorWalletCreator, bridgeAddr, inboxAddr, sequencerInboxAddr, rollupAddr common.Address
var tx *types.Transaction
var deployedAt uint64

tx, err := rollupCreator.CreateRollup(
deployAuth,
config,
)
if err != nil {
return nil, fmt.Errorf("error submitting create rollup tx: %w", err)
}
receipt, err := l1Reader.WaitForTxApproval(ctx, tx)
if err != nil {
return nil, fmt.Errorf("error executing create rollup tx: %w", err)
}
info, err := rollupCreator.ParseRollupCreated(*receipt.Logs[len(receipt.Logs)-1])
if err != nil {
return nil, fmt.Errorf("error parsing rollup created log: %w", err)
if nativeERC20Token == (common.Address{}) {
/// deploy standard Eth rollup
rollupCreator, _, _validatorUtils, _validatorWalletCreator, err := deployRollupCreator(ctx, l1Reader, deployAuth)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
}
validatorUtils, validatorWalletCreator = _validatorUtils, _validatorWalletCreator

tx, err := rollupCreator.CreateRollup(
deployAuth,
config,
)
if err != nil {
return nil, fmt.Errorf("error submitting create rollup tx: %w", err)
}

receipt, err := l1Reader.WaitForTxApproval(ctx, tx)
if err != nil {
return nil, fmt.Errorf("error executing create rollup tx: %w", err)
}
deployedAt = receipt.BlockNumber.Uint64()

info, err := rollupCreator.ParseRollupCreated(*receipt.Logs[len(receipt.Logs)-1])
if err != nil {
return nil, fmt.Errorf("error parsing rollup created log: %w", err)
}

bridgeAddr, inboxAddr, sequencerInboxAddr, rollupAddr = info.Bridge, info.InboxAddress, info.SequencerInbox, info.RollupAddress
} else {
/// deploy ERC20 rollup
rollupCreator, _, _validatorUtils, _validatorWalletCreator, err := deployERC20RollupCreator(ctx, l1Reader, deployAuth, nativeERC20Token)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
}
validatorUtils, validatorWalletCreator = _validatorUtils, _validatorWalletCreator

tx, err := rollupCreator.CreateRollup(
deployAuth,
config,
nativeERC20Token,
)
if err != nil {
return nil, fmt.Errorf("error submitting create erc20 rollup tx: %w", err)
}

receipt, err := l1Reader.WaitForTxApproval(ctx, tx)
if err != nil {
return nil, fmt.Errorf("error executing create rollup tx: %w", err)
}
deployedAt = receipt.BlockNumber.Uint64()

info, err := rollupCreator.ParseRollupCreated(*receipt.Logs[len(receipt.Logs)-1])
if err != nil {
return nil, fmt.Errorf("error parsing rollup created log: %w", err)
}

bridgeAddr, inboxAddr, sequencerInboxAddr, rollupAddr = info.Bridge, info.InboxAddress, info.SequencerInbox, info.RollupAddress
}

sequencerInbox, err := bridgegen.NewSequencerInbox(info.SequencerInbox, l1client)
sequencerInbox, err := bridgegen.NewSequencerInbox(sequencerInboxAddr, l1client)
if err != nil {
return nil, fmt.Errorf("error getting sequencer inbox: %w", err)
}
Expand All @@ -284,7 +379,7 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b
allowValidators = append(allowValidators, true)
}
if len(validatorAddrs) > 0 {
rollup, err := rollupgen.NewRollupAdminLogic(info.RollupAddress, l1client)
rollup, err := rollupgen.NewRollupAdminLogic(rollupAddr, l1client)
if err != nil {
return nil, fmt.Errorf("error getting rollup admin: %w", err)
}
Expand All @@ -296,13 +391,14 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b
}

return &chaininfo.RollupAddresses{
Bridge: info.Bridge,
Inbox: info.InboxAddress,
SequencerInbox: info.SequencerInbox,
DeployedAt: receipt.BlockNumber.Uint64(),
Rollup: info.RollupAddress,
Bridge: bridgeAddr,
Inbox: inboxAddr,
SequencerInbox: sequencerInboxAddr,
DeployedAt: deployedAt,
Rollup: rollupAddr,
ValidatorUtils: validatorUtils,
ValidatorWalletCreator: validatorWalletCreator,
NativeERC20Token: nativeERC20Token,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions cmd/chaininfo/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type RollupAddresses struct {
Inbox common.Address `json:"inbox"`
SequencerInbox common.Address `json:"sequencer-inbox"`
Rollup common.Address `json:"rollup"`
NativeERC20Token common.Address `json:"native-erc20-token"`
ValidatorUtils common.Address `json:"validator-utils"`
ValidatorWalletCreator common.Address `json:"validator-wallet-creator"`
DeployedAt uint64 `json:"deployed-at"`
Expand Down
3 changes: 3 additions & 0 deletions cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func main() {
deployAccount := flag.String("l1DeployAccount", "", "l1 seq account to use (default is first account in keystore)")
ownerAddressString := flag.String("ownerAddress", "", "the rollup owner's address")
sequencerAddressString := flag.String("sequencerAddress", "", "the sequencer's address")
nativeERC20TokenAddressString := flag.String("nativeERC20TokenAddress", "", "address of ERC20 token which is used as native L2 currency")
loserEscrowAddressString := flag.String("loserEscrowAddress", "", "the address which half of challenge loser's funds accumulate at")
wasmmoduleroot := flag.String("wasmmoduleroot", "", "WASM module root hash")
wasmrootpath := flag.String("wasmrootpath", "", "path to machine folders")
Expand Down Expand Up @@ -125,6 +126,7 @@ func main() {
panic(fmt.Errorf("failed to deserialize chain config: %w", err))
}

nativeERC20Token := common.HexToAddress(*nativeERC20TokenAddressString)
deployedAddresses, err := arbnode.DeployOnL1(
ctx,
l1client,
Expand All @@ -133,6 +135,7 @@ func main() {
*authorizevalidators,
func() *headerreader.Config { return &headerReaderConfig },
arbnode.GenerateRollupConfig(*prod, moduleRoot, ownerAddress, &chainConfig, chainConfigJson, loserEscrowAddress),
nativeERC20Token,
)
if err != nil {
flag.Usage()
Expand Down
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 63 files
+0 −5 .clabot
+29 −0 .github/workflows/contract-tests.yml
+3 −0 .gitignore
+3 −0 .gitmodules
+2 −2 README.md
+14 −0 foundry.toml
+1 −0 lib/forge-std
+4 −0 remappings.txt
+295 −0 src/bridge/AbsBridge.sol
+334 −0 src/bridge/AbsInbox.sol
+295 −0 src/bridge/AbsOutbox.sol
+15 −244 src/bridge/Bridge.sol
+74 −0 src/bridge/ERC20Bridge.sol
+141 −0 src/bridge/ERC20Inbox.sol
+27 −0 src/bridge/ERC20Outbox.sol
+1 −16 src/bridge/IBridge.sol
+35 −0 src/bridge/IERC20Bridge.sol
+75 −0 src/bridge/IERC20Inbox.sol
+26 −0 src/bridge/IEthBridge.sol
+133 −0 src/bridge/IEthInbox.sol
+13 −123 src/bridge/IInbox.sol
+49 −257 src/bridge/Inbox.sol
+8 −265 src/bridge/Outbox.sol
+1 −11 src/bridge/SequencerInbox.sol
+0 −16 src/libraries/ArbitrumChecker.sol
+9 −1 src/libraries/Error.sol
+3 −2 src/mocks/BridgeStub.sol
+28 −5 src/mocks/InboxStub.sol
+3 −2 src/mocks/SequencerInboxStub.sol
+117 −0 src/rollup/AbsBridgeCreator.sol
+140 −0 src/rollup/AbsRollupCreator.sol
+50 −0 src/rollup/AbsRollupEventInbox.sol
+17 −88 src/rollup/BridgeCreator.sol
+48 −0 src/rollup/ERC20BridgeCreator.sol
+50 −0 src/rollup/ERC20RollupCreator.sol
+26 −0 src/rollup/ERC20RollupEventInbox.sol
+64 −0 src/rollup/IBridgeCreator.sol
+31 −0 src/rollup/IRollupCreator.sol
+8 −2 src/rollup/RollupCore.sol
+28 −104 src/rollup/RollupCreator.sol
+12 −47 src/rollup/RollupEventInbox.sol
+3 −2 src/test-helpers/BridgeTester.sol
+20 −0 src/test-helpers/EthVault.sol
+522 −0 test/foundry/AbsBridge.t.sol
+403 −0 test/foundry/AbsInbox.t.sol
+28 −0 test/foundry/AbsOutbox.t.sol
+82 −0 test/foundry/AbsRollupCreator.t.sol
+317 −0 test/foundry/Bridge.t.sol
+353 −0 test/foundry/ERC20Bridge.t.sol
+113 −0 test/foundry/ERC20BridgeCreator.t.sol
+661 −0 test/foundry/ERC20Inbox.t.sol
+179 −0 test/foundry/ERC20Outbox.t.sol
+103 −0 test/foundry/ERC20RollupCreator.t.sol
+637 −0 test/foundry/Inbox.t.sol
+116 −0 test/foundry/Outbox.t.sol
+86 −0 test/foundry/RollupCreator.t.sol
+12 −0 test/foundry/util/TestUtil.sol
+1 −1 test/storage/Bridge.dot
+27 −0 test/storage/ERC20Bridge.dot
+15 −0 test/storage/ERC20Inbox.dot
+12 −0 test/storage/ERC20Outbox.dot
+1 −1 test/storage/Inbox.dot
+3 −3 test/storage/Outbox.dot
1 change: 1 addition & 0 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ func DeployOnTestL1(
0,
func() *headerreader.Config { return &headerreader.TestConfig },
arbnode.GenerateRollupConfig(false, locator.LatestWasmModuleRoot(), l1info.GetAddress("RollupOwner"), chainConfig, serializedChainConfig, common.Address{}),
common.Address{},
)
Require(t, err)
l1info.SetContract("Bridge", addresses.Bridge)
Expand Down
21 changes: 18 additions & 3 deletions test-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ consensusclient=false
redundantsequencers=0
dev_build_nitro=false
dev_build_blockscout=false
erc20rollup=false
batchposters=1
devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
l1chainid=1337
Expand Down Expand Up @@ -98,6 +99,10 @@ while [[ $# -gt 0 ]]; do
detach=true
shift
;;
--erc20-rollup)
erc20rollup=true
shift
;;
--batchposters)
batchposters=$2
if ! [[ $batchposters =~ [0-3] ]] ; then
Expand Down Expand Up @@ -131,6 +136,7 @@ while [[ $# -gt 0 ]]; do
echo --init: remove all data, rebuild, deploy new rollup
echo --pos: l1 is a proof-of-stake chain \(using prysm for consensus\)
echo --validate: heavy computation, validating all blocks in WASM
echo --erc20rollup: deploys rollup in erc20 mode where token is used as L2 native currency
echo --batchposters: batch posters [0-3]
echo --redundantsequencers redundant sequencers [0-3]
echo --detach: detach from nodes after running them
Expand Down Expand Up @@ -284,11 +290,18 @@ if $force_init; then
echo == Writing l2 chain config
docker-compose run testnode-scripts write-l2-chain-config

echo == Deploying L2
sequenceraddress=`docker-compose run testnode-scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'`
deployL2Command="docker-compose run --entrypoint /usr/local/bin/deploy poster --l1conn ws://geth:8546 --l1keystore /home/user/l1keystore --sequencerAddress $sequenceraddress --ownerAddress $sequenceraddress --l1DeployAccount $sequenceraddress --l1deployment /config/deployment.json --authorizevalidators 10 --wasmrootpath /home/user/target/machines --l1chainid=$l1chainid --l2chainconfig /config/l2_chain_config.json --l2chainname arb-dev-test --l2chaininfo /config/deployed_chain_info.json"
if $erc20rollup; then
echo == Deploying token
nativeTokenAddress=`docker-compose run testnode-scripts create-erc20 --deployerKey $devprivkey --mintTo user_l1user | tail -n 1 | awk '{ print $NF }'`
deployL2Command+=" --nativeERC20TokenAddress $nativeTokenAddress"
fi

docker-compose run --entrypoint /usr/local/bin/deploy poster --l1conn ws://geth:8546 --l1keystore /home/user/l1keystore --sequencerAddress $sequenceraddress --ownerAddress $sequenceraddress --l1DeployAccount $sequenceraddress --l1deployment /config/deployment.json --authorizevalidators 10 --wasmrootpath /home/user/target/machines --l1chainid=$l1chainid --l2chainconfig /config/l2_chain_config.json --l2chainname arb-dev-test --l2chaininfo /config/deployed_chain_info.json
echo == Deploying L2
eval $deployL2Command
docker-compose run --entrypoint sh poster -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json"

echo == Writing configs
docker-compose run testnode-scripts write-config

Expand All @@ -297,7 +310,9 @@ if $force_init; then

echo == Funding l2 funnel
docker-compose up -d $INITIAL_SEQ_NODES
docker-compose run testnode-scripts bridge-funds --ethamount 100000 --wait
if ! $erc20rollup; then
docker-compose run testnode-scripts bridge-funds --ethamount 100000 --wait
fi

if $tokenbridge; then
echo == Deploying token bridge
Expand Down
Loading