Skip to content

Commit

Permalink
Perform admin actions through upg executor in system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Oct 25, 2023
1 parent 1b5dc4d commit 25e4233
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func deployBridgeCreator(ctx context.Context, l1Reader *headerreader.HeaderReade
return common.Address{}, fmt.Errorf("bridge deploy error: %w", err)
}

// maxDataSize := big.NewInt(117964)
seqInboxTemplate, tx, _, err := bridgegen.DeploySequencerInbox(auth, client, maxDataSize)
err = andTxSucceeded(ctx, l1Reader, tx, err)
if err != nil {
Expand Down
24 changes: 19 additions & 5 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 @@ -628,20 +631,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{}),
common.Address{},
big.NewInt(117964),
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 @@ -990,11 +996,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

0 comments on commit 25e4233

Please sign in to comment.