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

Support creating ERC20 rollup #1879

Merged
merged 31 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
48c6a70
Add nativeToken flag to deployer and update createRollup call
gvladika Sep 22, 2023
e9751ab
Deploy UpgradeExecutor
gvladika Sep 22, 2023
4524994
Update testnode branch
gvladika Sep 23, 2023
4ec56e3
Update nitro-contracts ref
gvladika Sep 28, 2023
f7e63d5
Merge branch 'master' into create-erc20-rollup
gvladika Oct 3, 2023
226bd1c
Align with latest RollupCretor api
gvladika Oct 10, 2023
e7f1155
Use develop branch
gvladika Oct 13, 2023
fd0c404
Merge branch 'master' into create-erc20-rollup
gvladika Oct 13, 2023
1539963
Fix maxDataSize leftovers
gvladika Oct 13, 2023
39f1fbf
Merge branch 'master' into create-erc20-rollup
gvladika Oct 17, 2023
d024d9e
Merge branch 'master' into create-erc20-rollup
gvladika Oct 19, 2023
89f8372
Use latest version of nitro-contracts and testnode
gvladika Oct 19, 2023
1df214f
Lint
gvladika Oct 19, 2023
0fe1550
Remove testnode custom branch
gvladika Oct 20, 2023
b53036e
Merge branch 'master' into create-erc20-rollup
gvladika Oct 23, 2023
1b5dc4d
Merge branch 'master' into create-erc20-rollup
gvladika Oct 24, 2023
25e4233
Perform admin actions through upg executor in system tests
gvladika Oct 25, 2023
967d924
Perform admin action through upg executor in staker test
gvladika Oct 25, 2023
5fa0829
Merge branch 'master' into create-erc20-rollup
gvladika Oct 25, 2023
d603cba
Add missing checks
gvladika Oct 25, 2023
1c8f496
Upgrade through upg executor
gvladika Oct 25, 2023
cf82b27
Update nitro-contracts to v1.1.0
gvladika Oct 26, 2023
fc24d1a
Merge branch 'master' into create-erc20-rollup
gvladika Oct 26, 2023
1969387
Update maxDataSize param description
gvladika Oct 27, 2023
1e5a97b
Turn on feature to deploy the L2 utility factories as part of rollup …
gvladika Oct 27, 2023
651f78a
Merge branch 'create-erc20-rollup' of github.com:OffchainLabs/nitro i…
gvladika Oct 27, 2023
3eea3bb
Merge branch 'master' into create-erc20-rollup
gvladika Oct 27, 2023
e1eb6b5
Revert "Turn on feature to deploy the L2 utility factories as part of…
gvladika Oct 27, 2023
283f771
Merge branch 'create-erc20-rollup' of github.com:OffchainLabs/nitro i…
gvladika Oct 27, 2023
be17fea
Update nitro-contracts ref to include sha256 preimage support
gvladika Oct 30, 2023
382599c
Merge branch 'master' into create-erc20-rollup
gvladika Oct 30, 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
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN apt-get update && \
apt-get install -y git python3 make g++
WORKDIR /workspace
COPY contracts/package.json contracts/yarn.lock contracts/
RUN cd contracts && yarn install --ignore-optional
RUN cd contracts && yarn install
COPY contracts contracts/
COPY Makefile .
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-solidity
Expand Down Expand Up @@ -77,6 +77,7 @@ COPY ./fastcache ./fastcache
COPY ./go-ethereum ./go-ethereum
COPY --from=brotli-wasm-export / target/
COPY --from=contracts-builder workspace/contracts/build/contracts/src/precompiles/ contracts/build/contracts/src/precompiles/
COPY --from=contracts-builder workspace/contracts/node_modules/@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json contracts/
COPY --from=contracts-builder workspace/.make/ .make/
RUN PATH="$PATH:/usr/local/go/bin" NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-wasm-bin

Expand Down Expand Up @@ -180,6 +181,7 @@ COPY fastcache/go.mod fastcache/go.sum fastcache/
RUN go mod download
COPY . ./
COPY --from=contracts-builder workspace/contracts/build/ contracts/build/
COPY --from=contracts-builder workspace/contracts/node_modules/@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json contracts/node_modules/@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/
COPY --from=contracts-builder workspace/.make/ .make/
COPY --from=prover-header-export / target/
COPY --from=brotli-library-export / target/
Expand Down
92 changes: 77 additions & 15 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/offchainlabs/nitro/solgen/go/ospgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/solgen/go/upgrade_executorgen"
"github.com/offchainlabs/nitro/staker"
"github.com/offchainlabs/nitro/staker/validatorwallet"
"github.com/offchainlabs/nitro/util/contracts"
Expand All @@ -61,21 +62,23 @@ func andTxSucceeded(ctx context.Context, l1Reader *headerreader.HeaderReader, tx
return nil
}

func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReader, auth *bind.TransactOpts) (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
bridgeTemplate, tx, _, err := bridgegen.DeployBridge(auth, client)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("bridge deploy error: %w", err)
}

seqInboxTemplate, tx, _, err := bridgegen.DeploySequencerInbox(auth, client)
seqInboxTemplate, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("sequencer inbox deploy error: %w", err)
}

inboxTemplate, tx, _, err := bridgegen.DeployInbox(auth, client)
inboxTemplate, tx, _, err := bridgegen.DeployInbox(auth, client, maxDataSize)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("inbox deploy error: %w", err)
Expand All @@ -93,16 +96,51 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return common.Address{}, fmt.Errorf("outbox deploy error: %w", err)
}

bridgeCreatorAddr, tx, bridgeCreator, err := rollupgen.DeployBridgeCreator(auth, client)
ethBasedTemplates := rollupgen.BridgeCreatorBridgeContracts{
Bridge: bridgeTemplate,
SequencerInbox: seqInboxTemplate,
Inbox: inboxTemplate,
RollupEventInbox: rollupEventBridgeTemplate,
Outbox: outboxTemplate,
}

/// deploy ERC20 based templates
erc20BridgeTemplate, tx, _, err := bridgegen.DeployERC20Bridge(auth, client)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("bridge creator deploy error: %w", err)
return common.Address{}, fmt.Errorf("bridge deploy error: %w", err)
}

erc20InboxTemplate, tx, _, err := bridgegen.DeployERC20Inbox(auth, client, maxDataSize)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("inbox deploy error: %w", err)
}

erc20RollupEventBridgeTemplate, tx, _, err := rollupgen.DeployERC20RollupEventInbox(auth, client)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("rollup event bridge deploy error: %w", err)
}

erc20OutboxTemplate, tx, _, err := bridgegen.DeployERC20Outbox(auth, client)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("outbox deploy error: %w", err)
}

erc20BasedTemplates := rollupgen.BridgeCreatorBridgeContracts{
Bridge: erc20BridgeTemplate,
SequencerInbox: seqInboxTemplate,
Inbox: erc20InboxTemplate,
RollupEventInbox: erc20RollupEventBridgeTemplate,
Outbox: erc20OutboxTemplate,
}

tx, err = bridgeCreator.UpdateTemplates(auth, bridgeTemplate, seqInboxTemplate, inboxTemplate, rollupEventBridgeTemplate, outboxTemplate)
bridgeCreatorAddr, tx, _, err := rollupgen.DeployBridgeCreator(auth, client, ethBasedTemplates, erc20BasedTemplates)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return common.Address{}, fmt.Errorf("bridge creator update templates error: %w", err)
return common.Address{}, fmt.Errorf("bridge creator deploy error: %w", err)
}

return bridgeCreatorAddr, nil
Expand Down Expand Up @@ -149,10 +187,10 @@ 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)
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{}, err
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("bridge creator deploy error: %w", err)
}

ospEntryAddr, challengeManagerAddr, err := deployChallengeFactory(ctx, l1Reader, auth)
Expand All @@ -178,6 +216,12 @@ func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("rollup creator deploy error: %w", err)
}

upgradeExecutor, tx, _, err := upgrade_executorgen.DeployUpgradeExecutor(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("upgrade executor deploy error: %w", err)
}

validatorUtils, tx, _, err := rollupgen.DeployValidatorUtils(auth, l1Reader.Client())
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
Expand All @@ -190,15 +234,23 @@ func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return nil, common.Address{}, common.Address{}, common.Address{}, fmt.Errorf("validator wallet creator deploy error: %w", err)
}

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

tx, err = rollupCreator.SetTemplates(
auth,
bridgeCreator,
ospEntryAddr,
challengeManagerAddr,
rollupAdminLogic,
rollupUserLogic,
upgradeExecutor,
validatorUtils,
validatorWalletCreator,
l2FactoriesDeployHelper,
)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
Expand Down Expand Up @@ -235,12 +287,12 @@ func GenerateRollupConfig(prod bool, wasmModuleRoot common.Hash, rollupOwner com
}
}

func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPoster common.Address, authorizeValidators uint64, config rollupgen.Config) (*chaininfo.RollupAddresses, error) {
func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPoster 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)
rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
}
Expand All @@ -250,11 +302,19 @@ func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReade
validatorAddrs = append(validatorAddrs, crypto.CreateAddress(validatorWalletCreator, i))
}

deployParams := rollupgen.RollupCreatorRollupDeploymentParams{
Config: config,
BatchPoster: batchPoster,
Validators: validatorAddrs,
MaxDataSize: maxDataSize,
NativeToken: nativeToken,
DeployFactoriesToL2: false,
MaxFeePerGasForRetryables: big.NewInt(0), // needed when utility factories are deployed
gvladika marked this conversation as resolved.
Show resolved Hide resolved
}

tx, err := rollupCreator.CreateRollup(
deployAuth,
config,
batchPoster,
validatorAddrs,
deployParams,
)
if err != nil {
return nil, fmt.Errorf("error submitting create rollup tx: %w", err)
Expand All @@ -274,6 +334,8 @@ func DeployOnL1(ctx context.Context, parentChainReader *headerreader.HeaderReade
SequencerInbox: info.SequencerInbox,
DeployedAt: receipt.BlockNumber.Uint64(),
Rollup: info.RollupAddress,
NativeToken: nativeToken,
UpgradeExecutor: info.UpgradeExecutor,
ValidatorUtils: validatorUtils,
ValidatorWalletCreator: validatorWalletCreator,
}, nil
Expand Down
2 changes: 2 additions & 0 deletions cmd/chaininfo/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ type RollupAddresses struct {
Inbox common.Address `json:"inbox"`
SequencerInbox common.Address `json:"sequencer-inbox"`
Rollup common.Address `json:"rollup"`
NativeToken common.Address `json:"native-token"`
UpgradeExecutor common.Address `json:"upgrade-executor"`
ValidatorUtils common.Address `json:"validator-utils"`
ValidatorWalletCreator common.Address `json:"validator-wallet-creator"`
DeployedAt uint64 `json:"deployed-at"`
Expand Down
6 changes: 6 additions & 0 deletions cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ 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")
nativeTokenAddressString := flag.String("nativeTokenAddress", "0x0000000000000000000000000000000000000000", "address of the ERC20 token which is used as native L2 currency")
maxDataSizeUint := flag.Uint64("maxDataSize", 117964, "maximum data size of a batch or a cross-chain message (default = 90% of Geth's 128KB tx size limit)")
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 All @@ -55,6 +57,7 @@ func main() {
prod := flag.Bool("prod", false, "Whether to configure the rollup for production or testing")
flag.Parse()
l1ChainId := new(big.Int).SetUint64(*l1ChainIdUint)
maxDataSize := new(big.Int).SetUint64(*maxDataSizeUint)

if *prod {
if *wasmmoduleroot == "" {
Expand Down Expand Up @@ -137,13 +140,16 @@ func main() {
l1Reader.Start(ctx)
defer l1Reader.StopAndWait()

nativeToken := common.HexToAddress(*nativeTokenAddressString)
deployedAddresses, err := arbnode.DeployOnL1(
ctx,
l1Reader,
l1TransactionOpts,
sequencerAddress,
*authorizevalidators,
arbnode.GenerateRollupConfig(*prod, moduleRoot, ownerAddress, &chainConfig, chainConfigJson, loserEscrowAddress),
nativeToken,
maxDataSize,
)
if err != nil {
flag.Usage()
Expand Down
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 98 files
+7 −0 .env.sample.goerli
+34 −1 .github/workflows/contract-tests.yml
+4 −1 .gitignore
+3 −0 .gitmodules
+2 −0 .prettierignore
+1 −1 deploy/SequencerInbox.js
+1 −1 deploy/SequencerInboxStubCreator.js
+14 −0 foundry.toml
+19 −0 hardhat.config.ts
+1 −0 lib/forge-std
+18 −8 package.json
+5 −0 remappings.txt
+4 −0 scripts/config.ts.example
+41 −0 scripts/createERC20Rollup.ts
+13 −0 scripts/createEthRollup.ts
+65 −36 scripts/deployment.ts
+17 −0 scripts/genNetwork.ts
+45 −13 scripts/rollupCreation.ts
+132 −0 scripts/testSetup.ts
+308 −0 src/bridge/AbsBridge.sol
+356 −0 src/bridge/AbsInbox.sol
+326 −0 src/bridge/AbsOutbox.sol
+14 −243 src/bridge/Bridge.sol
+91 −0 src/bridge/ERC20Bridge.sol
+144 −0 src/bridge/ERC20Inbox.sol
+30 −0 src/bridge/ERC20Outbox.sol
+3 −14 src/bridge/IBridge.sol
+37 −0 src/bridge/IERC20Bridge.sol
+75 −0 src/bridge/IERC20Inbox.sol
+26 −0 src/bridge/IEthBridge.sol
+3 −63 src/bridge/IInbox.sol
+86 −0 src/bridge/IInboxBase.sol
+10 −0 src/bridge/IOutbox.sol
+4 −0 src/bridge/ISequencerInbox.sol
+38 −246 src/bridge/Inbox.sol
+11 −264 src/bridge/Outbox.sol
+20 −6 src/bridge/SequencerInbox.sol
+0 −3 src/libraries/Constants.sol
+18 −1 src/libraries/Error.sol
+6 −1 src/mocks/BridgeStub.sol
+36 −4 src/mocks/InboxStub.sol
+5 −3 src/mocks/SequencerInboxStub.sol
+2 −1 src/mocks/Simple.sol
+82 −0 src/mocks/UpgradeExecutorMock.sol
+71 −0 src/rollup/AbsRollupEventInbox.sol
+71 −80 src/rollup/BridgeCreator.sol
+2 −2 src/rollup/Config.sol
+149 −0 src/rollup/DeployHelper.sol
+26 −0 src/rollup/ERC20RollupEventInbox.sol
+1 −1 src/rollup/IRollupCore.sol
+2 −0 src/rollup/IRollupEventInbox.sol
+1 −1 src/rollup/RollupAdminLogic.sol
+1 −1 src/rollup/RollupCore.sol
+163 −53 src/rollup/RollupCreator.sol
+11 −46 src/rollup/RollupEventInbox.sol
+1 −1 src/rollup/RollupLib.sol
+26 −4 src/rollup/RollupUserLogic.sol
+6 −1 src/test-helpers/BridgeTester.sol
+20 −0 src/test-helpers/EthVault.sol
+1 −1 src/test-helpers/InterfaceCompatibilityTester.sol
+6 −0 src/test-helpers/OutboxWithoutOptTester.sol
+16 −0 src/test-helpers/TestToken.sol
+265 −62 test/contract/arbRollup.spec.ts
+2 −2 test/contract/sequencerInboxForceInclude.spec.ts
+405 −0 test/e2e/erc20rollup.ts
+522 −0 test/foundry/AbsBridge.t.sol
+391 −0 test/foundry/AbsInbox.t.sol
+28 −0 test/foundry/AbsOutbox.t.sol
+317 −0 test/foundry/Bridge.t.sol
+254 −0 test/foundry/BridgeCreator.t.sol
+389 −0 test/foundry/ERC20Bridge.t.sol
+660 −0 test/foundry/ERC20Inbox.t.sol
+180 −0 test/foundry/ERC20Outbox.t.sol
+637 −0 test/foundry/Inbox.t.sol
+117 −0 test/foundry/Outbox.t.sol
+478 −0 test/foundry/RollupCreator.t.sol
+12 −0 test/foundry/util/TestUtil.sol
+15 −0 test/storage/Bridge
+0 −27 test/storage/Bridge.dot
+8 −0 test/storage/ChallengeManager
+0 −9 test/storage/ChallengeManager.dot
+16 −0 test/storage/ERC20Bridge
+12 −0 test/storage/ERC20Inbox
+8 −0 test/storage/ERC20Outbox
+12 −0 test/storage/Inbox
+0 −15 test/storage/Inbox.dot
+8 −0 test/storage/Outbox
+0 −12 test/storage/Outbox.dot
+38 −0 test/storage/RollupAdminLogic
+0 −30 test/storage/RollupAdminLogic.dot
+38 −0 test/storage/RollupCore
+0 −30 test/storage/RollupCore.dot
+38 −0 test/storage/RollupUserLogic
+0 −30 test/storage/RollupUserLogic.dot
+9 −0 test/storage/SequencerInbox
+0 −15 test/storage/SequencerInbox.dot
+5 −4 test/storage/test.bash
+862 −824 yarn.lock
21 changes: 21 additions & 0 deletions solgen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ func main() {
modInfo.addArtifact(artifact)
}

// add upgrade executor module which is not compiled locally, but imported from 'nitro-contracts' depedencies
upgExecutorPath := filepath.Join(parent, "contracts", "node_modules", "@offchainlabs", "upgrade-executor", "build", "contracts", "src", "UpgradeExecutor.sol", "UpgradeExecutor.json")
_, err = os.Stat(upgExecutorPath)
if !os.IsNotExist(err) {
data, err := os.ReadFile(upgExecutorPath)
if err != nil {
// log.Fatal(string(output))
log.Fatal("could not read", upgExecutorPath, "for contract", "UpgradeExecutor", err)
}
artifact := HardHatArtifact{}
if err := json.Unmarshal(data, &artifact); err != nil {
log.Fatal("failed to parse contract", "UpgradeExecutor", err)
}
modInfo := modules["upgrade_executorgen"]
if modInfo == nil {
modInfo = &moduleInfo{}
modules["upgrade_executorgen"] = modInfo
}
modInfo.addArtifact(artifact)
}

for module, info := range modules {

code, err := bind.Bind(
Expand Down
22 changes: 19 additions & 3 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net"
"os"
"strconv"
"strings"
"testing"
"time"

Expand All @@ -30,6 +31,7 @@ import (
"github.com/offchainlabs/nitro/validator/server_common"
"github.com/offchainlabs/nitro/validator/valnode"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/common"
Expand All @@ -52,6 +54,7 @@ import (
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/solgen/go/upgrade_executorgen"
"github.com/offchainlabs/nitro/statetransfer"
"github.com/offchainlabs/nitro/util/testhelpers"
)
Expand Down Expand Up @@ -641,18 +644,23 @@ func DeployOnTestL1(
l1Reader.Start(ctx)
defer l1Reader.StopAndWait()

nativeToken := common.Address{}
maxDataSize := big.NewInt(117964)
addresses, err := arbnode.DeployOnL1(
ctx,
l1Reader,
&l1TransactionOpts,
l1info.GetAddress("Sequencer"),
0,
arbnode.GenerateRollupConfig(false, locator.LatestWasmModuleRoot(), l1info.GetAddress("RollupOwner"), chainConfig, serializedChainConfig, common.Address{}),
nativeToken,
maxDataSize,
)
Require(t, err)
l1info.SetContract("Bridge", addresses.Bridge)
l1info.SetContract("SequencerInbox", addresses.SequencerInbox)
l1info.SetContract("Inbox", addresses.Inbox)
l1info.SetContract("UpgradeExecutor", addresses.UpgradeExecutor)
initMessage := getInitMessage(ctx, t, l1client, addresses)
return addresses, initMessage
}
Expand Down Expand Up @@ -952,11 +960,19 @@ func authorizeDASKeyset(
err := keyset.Serialize(wr)
Require(t, err, "unable to serialize DAS keyset")
keysetBytes := wr.Bytes()
sequencerInbox, err := bridgegen.NewSequencerInbox(l1info.Accounts["SequencerInbox"].Address, l1client)
Require(t, err, "unable to create sequencer inbox")

sequencerInboxABI, err := abi.JSON(strings.NewReader(bridgegen.SequencerInboxABI))
Require(t, err, "unable to parse sequencer inbox ABI")
setKeysetCalldata, err := sequencerInboxABI.Pack("setValidKeyset", keysetBytes)
Require(t, err, "unable to generate calldata")

upgradeExecutor, err := upgrade_executorgen.NewUpgradeExecutor(l1info.Accounts["UpgradeExecutor"].Address, l1client)
Require(t, err, "unable to bind upgrade executor")

trOps := l1info.GetDefaultTransactOpts("RollupOwner", ctx)
tx, err := sequencerInbox.SetValidKeyset(&trOps, keysetBytes)
tx, err := upgradeExecutor.ExecuteCall(&trOps, l1info.Accounts["SequencerInbox"].Address, setKeysetCalldata)
Require(t, err, "unable to set valid keyset")

_, err = EnsureTxSucceeded(ctx, l1client, tx)
Require(t, err, "unable to ensure transaction success for setting valid keyset")
}
Expand Down
1 change: 1 addition & 0 deletions system_tests/full_challenge_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func setupSequencerInboxStub(ctx context.Context, t *testing.T, l1Info *Blockcha
bridgeAddr,
l1Info.GetAddress("sequencer"),
timeBounds,
big.NewInt(117964),
)
Require(t, err)
_, err = EnsureTxSucceeded(ctx, l1Client, tx)
Expand Down
Loading
Loading