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

BOLD Challenge Protocol Integration #1796

Closed
wants to merge 169 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
efa650b
Bold integration
amsanghi Aug 8, 2023
d5c7d16
minor fix
amsanghi Aug 8, 2023
63946a6
Fix test
amsanghi Aug 8, 2023
54371fc
update bold
amsanghi Aug 10, 2023
d1adb44
Merge branch 'master' into bold
amsanghi Aug 10, 2023
f97a03a
Merge branch 'master' into bold
amsanghi Aug 16, 2023
96a2b96
Fix
amsanghi Aug 16, 2023
746745c
minor fix
amsanghi Aug 16, 2023
d0dc758
Add test for posting assestion of a large number of batches
amsanghi Aug 16, 2023
153887c
update bold reference
rauljordan Aug 16, 2023
16b904c
Merge pull request #1812 from OffchainLabs/bench_assertion
rauljordan Aug 16, 2023
1564648
update execution_run to support Generalized History Provider
amsanghi Aug 17, 2023
3fedd34
Merge branch 'master' into bold
amsanghi Aug 21, 2023
f696079
Align with latest bold interface
amsanghi Aug 21, 2023
6f542af
Minor fix
amsanghi Aug 21, 2023
04241b0
Minor fix
amsanghi Aug 21, 2023
0f8bf4d
fix computeStepIncrement
amsanghi Aug 21, 2023
2e0bc77
minor fix
amsanghi Aug 21, 2023
1110abd
Merge branch 'bold' into generalize_history
amsanghi Aug 21, 2023
0a60c12
update based on latest changes in https://github.com/OffchainLabs/bol…
amsanghi Aug 23, 2023
12de883
Add option to switch to new bold protocol staker during the contract …
amsanghi Aug 24, 2023
7f011e7
call checkAndSwitchToBoldStaker before act as well
amsanghi Aug 31, 2023
612949a
Add TestStakerSwitchDuringRollupUpgrade
amsanghi Sep 1, 2023
1cd9819
add CollectProof
amsanghi Sep 12, 2023
26bc72b
Merge branch 'master' into bold
amsanghi Sep 19, 2023
0940782
use pr 440 of bold
amsanghi Sep 19, 2023
20b6f36
Merge branch 'bold' into generalize_history
amsanghi Sep 19, 2023
46c81d2
update based on pr 440 of bold
amsanghi Sep 19, 2023
8222183
Merge branch 'generalize_history' into staker_bold
amsanghi Sep 19, 2023
8c0df58
minor fix
amsanghi Sep 19, 2023
52934a8
minor fix
amsanghi Sep 19, 2023
7092ecd
update commit
rauljordan Sep 21, 2023
dfee9b7
update bold commit
rauljordan Sep 25, 2023
48a3dc8
protocol system test revisit
rauljordan Sep 25, 2023
dc8f7dc
add in the sys test
rauljordan Sep 25, 2023
7ad381e
working on integration
rauljordan Sep 25, 2023
25637ff
posting assertions
rauljordan Sep 25, 2023
4b67918
posting scanning interval fixes
rauljordan Sep 25, 2023
8db7463
updated commit
amsanghi Sep 25, 2023
7e52efb
fix regen
rauljordan Sep 25, 2023
9461455
debugging
rauljordan Sep 25, 2023
4e2ea7c
regen
rauljordan Sep 25, 2023
d5df068
update sub
rauljordan Sep 25, 2023
d1d4565
working up to subchallenges
rauljordan Sep 25, 2023
49321d2
update sub
rauljordan Sep 25, 2023
f539d0b
fixes
rauljordan Sep 27, 2023
377d6a6
fixing up interface for gathering leaves
rauljordan Sep 27, 2023
e185304
submod
rauljordan Sep 27, 2023
3fe8483
update dep
rauljordan Sep 27, 2023
64dbcb1
reach osp
rauljordan Sep 28, 2023
ab4c5bd
osp success
rauljordan Sep 28, 2023
a89fb18
update bold
rauljordan Oct 2, 2023
76463c5
still reaches osp
rauljordan Oct 3, 2023
f4a782f
update ref
rauljordan Oct 3, 2023
4dbb1e8
update main
rauljordan Oct 4, 2023
3dff3ca
cache tests
rauljordan Oct 4, 2023
8620dad
comments, todos
rauljordan Oct 4, 2023
91abb0e
builds
rauljordan Oct 4, 2023
5c7e04c
update commit
rauljordan Oct 4, 2023
32cf9fb
bold commit
rauljordan Oct 4, 2023
5fc5b5f
update bold ref
rauljordan Oct 5, 2023
251d2f9
tweak challenge period and ancestor blocks
rauljordan Oct 5, 2023
42e9174
Merge branch 'master' into bold
amsanghi Oct 5, 2023
dd9fdf5
Empty-Commit
amsanghi Oct 5, 2023
df34682
Merge branch 'bold' into generalize_history
amsanghi Oct 5, 2023
9459458
Empty-Commit
amsanghi Oct 5, 2023
d76a2df
update bold
amsanghi Oct 5, 2023
5ded86a
Merge branch 'bold' into generalize_history
amsanghi Oct 5, 2023
372a166
Empty-Commit
amsanghi Oct 5, 2023
f3cd9fd
update
amsanghi Oct 5, 2023
9ae6b43
fix delay
rauljordan Oct 5, 2023
1aabdef
Merge branch 'generalize_history' into staker_bold
amsanghi Oct 5, 2023
1190c0d
revamp
rauljordan Oct 5, 2023
0e0ce25
amend provider
rauljordan Oct 5, 2023
6893eb2
update bold ref
rauljordan Oct 6, 2023
584f1ca
bold ref
rauljordan Oct 6, 2023
2b8bad6
amend bold and post batches
rauljordan Oct 6, 2023
80caa0f
attempts
rauljordan Oct 9, 2023
042ed07
include msg checks
rauljordan Oct 9, 2023
484ff98
include unit test passing execution global state range checks
rauljordan Oct 10, 2023
7fd8b7c
added coverage and simplified the state provider logic
rauljordan Oct 10, 2023
036953b
back to posting block chal edges
rauljordan Oct 10, 2023
72ef594
bisections working
rauljordan Oct 10, 2023
a22bd73
getting there
rauljordan Oct 10, 2023
33c1bf0
challenge working again
rauljordan Oct 11, 2023
c59b84e
update bold commit
rauljordan Oct 11, 2023
f35f401
update bold commit
rauljordan Oct 11, 2023
927dba2
log await confirmation of assertion
rauljordan Oct 11, 2023
952066c
add expectation
rauljordan Oct 11, 2023
73f498d
Merge branch 'bold' of github.com:OffchainLabs/nitro into bold
rauljordan Oct 11, 2023
434c64d
sync bold
rauljordan Oct 11, 2023
34a587d
execution fixes
rauljordan Oct 12, 2023
9e98383
update bold
rauljordan Oct 12, 2023
ba5195c
update bold
rauljordan Oct 12, 2023
44e3b17
lint
rauljordan Oct 12, 2023
1e97c64
up
rauljordan Oct 12, 2023
13b9ba0
clean
rauljordan Oct 12, 2023
51ee105
edit
rauljordan Oct 12, 2023
9372f71
patch test
rauljordan Oct 12, 2023
d8e27d1
buidls
rauljordan Oct 12, 2023
a3ebe4d
cleanup
rauljordan Oct 12, 2023
9d8ff55
sys test
rauljordan Oct 12, 2023
93cfe2e
patch up
rauljordan Oct 12, 2023
1ab39f0
build tag
rauljordan Oct 12, 2023
726983e
update bold commit
rauljordan Oct 12, 2023
d0472ef
Merge pull request #1902 from OffchainLabs/protocol-system-test
rauljordan Oct 12, 2023
1927b27
Merge branch 'master' into bold
amsanghi Oct 12, 2023
fb22037
update bold commit
rauljordan Oct 12, 2023
044fc1a
update test
rauljordan Oct 13, 2023
de84dec
Use Mmap
amsanghi Oct 18, 2023
bd15d2b
use .Free()
amsanghi Oct 19, 2023
f202d2d
Clean up old cache files
amsanghi Nov 10, 2023
0b3b9fb
Merge branch 'bold' into clean_cache_files
amsanghi Nov 10, 2023
60a17ff
fix lint
amsanghi Nov 10, 2023
c09d56e
Merge branch 'master' into bold
amsanghi Nov 15, 2023
3eb482e
fix go.mod
amsanghi Nov 15, 2023
a8fc94b
Update bold
amsanghi Nov 15, 2023
4b8676d
Add State provider fixes
amsanghi Nov 15, 2023
cf66af4
Merge branch 'fix_state_provider' into staker_bold
amsanghi Nov 15, 2023
8b72013
minor fix
amsanghi Nov 15, 2023
fad6d7f
Minor fix
amsanghi Nov 15, 2023
a237cf2
Use config
amsanghi Nov 15, 2023
b19e9d5
Merge branch 'staker_bold' into mmap
amsanghi Nov 15, 2023
1acfeba
Merge branch 'fix_state_provider' into clean_cache_files
amsanghi Nov 15, 2023
d9c661b
Bold Deploy
amsanghi Nov 15, 2023
956d84b
Merge branch 'master' into bold
amsanghi Nov 28, 2023
b2e6412
Merge branch 'bold' into fix_state_provider
amsanghi Nov 28, 2023
8f3222b
Merge pull request #1968 from OffchainLabs/fix_state_provider
amsanghi Nov 28, 2023
6cf6f5c
Merge branch 'bold' into clean_cache_files
amsanghi Nov 28, 2023
b16afd7
Merge pull request #1961 from OffchainLabs/clean_cache_files
amsanghi Nov 28, 2023
8b68e35
Merge branch 'bold' into staker_bold
amsanghi Nov 28, 2023
9f46865
Merge pull request #1836 from OffchainLabs/staker_bold
amsanghi Nov 28, 2023
71a6439
Merge branch 'bold' into mmap
amsanghi Nov 28, 2023
038d8ac
Merge pull request #1931 from OffchainLabs/mmap
amsanghi Nov 28, 2023
373cbff
Merge branch 'bold' into bold-deploy
amsanghi Nov 28, 2023
8634698
Merge pull request #1969 from OffchainLabs/bold-deploy
amsanghi Nov 28, 2023
4c4dd3a
Add large assertions test
amsanghi Nov 28, 2023
0b7480e
minor fix
amsanghi Nov 28, 2023
401b80f
minor fix
amsanghi Nov 29, 2023
3f0d737
minor fix
amsanghi Nov 29, 2023
4187bf5
Merge branch 'master' into bold
amsanghi Nov 29, 2023
b580f24
minor fix
amsanghi Nov 29, 2023
f1adaf2
minor fix
amsanghi Nov 29, 2023
7d48a5d
fix build
amsanghi Dec 1, 2023
a58ebec
fix build
amsanghi Dec 1, 2023
dc75fa0
fix test
amsanghi Dec 1, 2023
b9af2db
fix build
amsanghi Dec 1, 2023
1c3a608
Merge branch 'master' into bold
amsanghi Dec 1, 2023
9b1e4aa
Merge branch 'master' into bold
amsanghi Dec 6, 2023
e515b61
Merge branch 'master' into bold
rauljordan Dec 6, 2023
e9bb7ba
Merge branch 'master' into bold
rauljordan Dec 6, 2023
3533525
Merge branch 'master' into bold
amsanghi Dec 12, 2023
a58cbfe
Merge branch 'master' into bold
amsanghi Jan 2, 2024
b7fb566
Merge branch 'master' into bold
amsanghi Jan 9, 2024
8f7443c
Merge branch 'master' into bold
amsanghi Jan 11, 2024
1f8a481
update bold
amsanghi Jan 11, 2024
bbc52c6
minor fix
amsanghi Jan 11, 2024
933ceb5
mod tidy
amsanghi Jan 11, 2024
e856fc9
Add test for mulitple and parallel challenges
amsanghi Jan 11, 2024
19a3868
Merge branch 'master' into bold
amsanghi Jan 31, 2024
e759768
remove mmpa
amsanghi Jan 31, 2024
35f061e
fixes
amsanghi Jan 31, 2024
59d16b6
fixes
amsanghi Jan 31, 2024
8c07386
fixes
amsanghi Jan 31, 2024
6eea57d
fixes
amsanghi Jan 31, 2024
9af7679
Empty-Commit
amsanghi Jan 31, 2024
388d1e8
fixes
amsanghi Jan 31, 2024
b6f2020
fixes
amsanghi Jan 31, 2024
9f62a78
Merge branch 'master' into bold
amsanghi Mar 7, 2024
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
[submodule "nitro-testnode"]
path = nitro-testnode
url = https://github.com/OffchainLabs/nitro-testnode.git
[submodule "bold"]
path = bold
url = https://github.com/OffchainLabs/bold.git
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ COPY ./contracts/package.json ./contracts/yarn.lock ./contracts/
COPY ./solgen/gen.go ./solgen/
COPY ./fastcache ./fastcache
COPY ./go-ethereum ./go-ethereum
COPY ./bold ./bold
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/
Expand Down Expand Up @@ -180,6 +181,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
COPY go.mod go.sum ./
COPY go-ethereum/go.mod go-ethereum/go.sum go-ethereum/
COPY fastcache/go.mod fastcache/go.sum fastcache/
COPY bold/go.mod bold/go.sum bold/
RUN go mod download
COPY . ./
COPY --from=contracts-builder workspace/contracts/build/ contracts/build/
Expand Down Expand Up @@ -253,6 +255,7 @@ USER root
RUN rm -f /home/user/target/machines/latest
COPY --from=prover-export /bin/jit /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/deploy /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/bold-deploy /usr/local/bin/
COPY --from=node-builder /workspace/target/bin/seq-coordinator-invalidate /usr/local/bin/
COPY --from=module-root-calc /workspace/target/machines/latest/machine.wavm.br /home/user/target/machines/latest/
COPY --from=module-root-calc /workspace/target/machines/latest/until-host-io-state.bin /home/user/target/machines/latest/
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ push: lint test-go .make/fmt
all: build build-replay-env test-gen-proofs
@touch .make/all

build: $(patsubst %,$(output_root)/bin/%, nitro deploy relay daserver datool seq-coordinator-invalidate nitro-val seq-coordinator-manager)
build: $(patsubst %,$(output_root)/bin/%, nitro deploy bold-deploy relay daserver datool seq-coordinator-invalidate nitro-val seq-coordinator-manager)
@printf $(done)

build-node-deps: $(go_source) build-prover-header build-prover-lib build-jit .make/solgen .make/cbrotli-lib
Expand Down Expand Up @@ -170,6 +170,9 @@ $(output_root)/bin/nitro: $(DEP_PREDICATE) build-node-deps
$(output_root)/bin/deploy: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/deploy"

$(output_root)/bin/bold-deploy: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/bold-deploy"

$(output_root)/bin/relay: $(DEP_PREDICATE) build-node-deps
go build $(GOLANG_PARAMS) -o $@ "$(CURDIR)/cmd/relay"

Expand Down
2 changes: 1 addition & 1 deletion arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ func createNodeImpl(
confirmedNotifiers = append(confirmedNotifiers, messagePruner)
}

stakerObj, err = staker.NewStaker(l1Reader, wallet, bind.CallOpts{}, config.Staker, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, fatalErrChan)
stakerObj, err = staker.NewStaker(l1Reader, wallet, bind.CallOpts{}, config.Staker, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, deployInfo.Bridge, fatalErrChan)
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions bold
Submodule bold added at 5b6630
274 changes: 274 additions & 0 deletions cmd/bold-deploy/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

package main

import (
"context"
"encoding/json"
"flag"
"fmt"
"math/big"
"os"
"time"

protocol "github.com/OffchainLabs/bold/chain-abstraction"
retry "github.com/OffchainLabs/bold/runtime"
"github.com/OffchainLabs/bold/solgen/go/mocksgen"
rollupgen "github.com/OffchainLabs/bold/solgen/go/rollupgen"
challenge_testing "github.com/OffchainLabs/bold/testing"
"github.com/OffchainLabs/bold/testing/setup"

"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/validator/server_common"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/cmd/util"
)

func main() {
glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
glogger.Verbosity(log.LvlDebug)
log.Root().SetHandler(glogger)
log.Info("deploying rollup")

ctx := context.Background()

l1conn := flag.String("l1conn", "", "l1 connection")
l1keystore := flag.String("l1keystore", "", "l1 private key store")
l1privatekey := flag.String("l1privatekey", "", "l1 private key")
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")
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")
l1passphrase := flag.String("l1passphrase", "passphrase", "l1 private key file passphrase")
outfile := flag.String("l1deployment", "deploy.json", "deployment output json file")
l1ChainIdUint := flag.Uint64("l1chainid", 1337, "L1 chain ID")
l2ChainConfig := flag.String("l2chainconfig", "l2_chain_config.json", "L2 chain config json file")
l2ChainName := flag.String("l2chainname", "", "L2 chain name (will be included in chain info output json file)")
l2ChainInfo := flag.String("l2chaininfo", "l2_chain_info.json", "L2 chain info output json file")
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")

// Bold specific flags.
numBigSteps := flag.Uint("numBigSteps", 5, "Number of big steps in the rollup")
blockChallengeLeafHeight := flag.Uint64("blockChallengeLeafHeight", 1<<5, "block challenge edge leaf height")
bigStepLeafHeight := flag.Uint64("bigStepLeafHeight", 1<<5, "big step edge leaf height")
smallSteapLeafHeight := flag.Uint64("smallStepLeafHeight", 1<<7, "small step edge leaf height")
minimumAssertionPeriodBlocks := flag.Uint64("minimumAssertionPeriodBlocks", 1, "minimum number of blocks between assertions")
confirmPeriodBlocks := flag.Uint64("confirmPeriodBlocks", 175, "challenge period")
challengeGracePeriodBlocks := flag.Uint64("challengeGracePeriodBlocks", 3, "challenge grace period in which security council can take action")
miniStake := flag.Uint64("miniStake", 1, "mini-stake size")
baseStake := flag.Uint64("baseStake", 1, "base-stake size")

flag.Parse()
l1ChainId := new(big.Int).SetUint64(*l1ChainIdUint)

if *prod {
if *wasmmoduleroot == "" {
panic("must specify wasm module root when launching prod chain")
}
}
if *l2ChainName == "" {
panic("must specify l2 chain name")
}

var l1TransactionOpts *bind.TransactOpts
var err error
if *l1privatekey != "" {
privKey, err := crypto.HexToECDSA(*l1privatekey)
if err != nil {
flag.Usage()
log.Error("error parsing l1 private key")
panic(err)
}
l1TransactionOpts, err = bind.NewKeyedTransactorWithChainID(privKey, l1ChainId)
if err != nil {
flag.Usage()
log.Error("error creating l1 tx opts")
panic(err)
}
} else {
wallet := genericconf.WalletConfig{
Pathname: *l1keystore,
Account: *deployAccount,
Password: *l1passphrase,
PrivateKey: *l1privatekey,
}
l1TransactionOpts, _, err = util.OpenWallet("l1", &wallet, l1ChainId)
if err != nil {
flag.Usage()
log.Error("error reading keystore")
panic(err)
}
}

l1client, err := ethclient.Dial(*l1conn)
if err != nil {
flag.Usage()
log.Error("error creating l1client")
panic(err)
}

if !common.IsHexAddress(*sequencerAddressString) && len(*sequencerAddressString) > 0 {
panic("specified sequencer address is invalid")
}
if !common.IsHexAddress(*ownerAddressString) {
panic("please specify a valid rollup owner address")
}
if *prod && !common.IsHexAddress(*loserEscrowAddressString) {
panic("please specify a valid loser escrow address")
}

sequencerAddress := common.HexToAddress(*sequencerAddressString)
ownerAddress := common.HexToAddress(*ownerAddressString)
loserEscrowAddress := common.HexToAddress(*loserEscrowAddressString)
if sequencerAddress != (common.Address{}) && ownerAddress != l1TransactionOpts.From {
panic("cannot specify sequencer address if owner is not deployer")
}

var moduleRoot common.Hash
if *wasmmoduleroot == "" {
locator, err := server_common.NewMachineLocator(*wasmrootpath)
if err != nil {
panic(err)
}
moduleRoot = locator.LatestWasmModuleRoot()
} else {
moduleRoot = common.HexToHash(*wasmmoduleroot)
}
if moduleRoot == (common.Hash{}) {
panic("wasmModuleRoot not found")
}

headerReaderConfig := headerreader.DefaultConfig
headerReaderConfig.TxTimeout = *txTimeout

chainConfigJson, err := os.ReadFile(*l2ChainConfig)
if err != nil {
panic(fmt.Errorf("failed to read l2 chain config file: %w", err))
}
var chainConfig params.ChainConfig
err = json.Unmarshal(chainConfigJson, &chainConfig)
if err != nil {
panic(fmt.Errorf("failed to deserialize chain config: %w", err))
}

arbSys, _ := precompilesgen.NewArbSys(types.ArbSysAddress, l1client)
l1Reader, err := headerreader.New(ctx, l1client, func() *headerreader.Config { return &headerReaderConfig }, arbSys)
if err != nil {
panic(fmt.Errorf("failed to create header reader: %w", err))
}
l1Reader.Start(ctx)
defer l1Reader.StopAndWait()

stakeToken, _, _, err := mocksgen.DeployTestWETH9(
l1TransactionOpts,
l1Reader.Client(),
"Weth",
"WETH",
)
if err != nil {
panic(err)
}
genesisExecutionState := rollupgen.ExecutionState{
GlobalState: rollupgen.GlobalState{},
MachineStatus: 1,
}
genesisInboxCount := big.NewInt(0)
anyTrustFastConfirmer := common.Address{}
rollupConfig := challenge_testing.GenerateRollupConfig(
*prod,
moduleRoot,
l1TransactionOpts.From,
chainConfig.ChainID,
loserEscrowAddress,
new(big.Int).SetUint64(*miniStake),
stakeToken,
genesisExecutionState,
genesisInboxCount,
anyTrustFastConfirmer,
challenge_testing.WithLayerZeroHeights(&protocol.LayerZeroHeights{
BlockChallengeHeight: *blockChallengeLeafHeight,
BigStepChallengeHeight: *bigStepLeafHeight,
SmallStepChallengeHeight: *smallSteapLeafHeight,
}),
challenge_testing.WithNumBigStepLevels(uint8(*numBigSteps)),
challenge_testing.WithConfirmPeriodBlocks(*confirmPeriodBlocks),
challenge_testing.WithChallengeGracePeriodBlocks(*challengeGracePeriodBlocks),
challenge_testing.WithChainConfig(string(chainConfigJson)),
challenge_testing.WithBaseStakeValue(new(big.Int).SetUint64(*baseStake)),
)
deployedAddresses, err := setup.DeployFullRollupStack(
ctx,
l1Reader.Client(),
l1TransactionOpts,
l1TransactionOpts.From,
rollupConfig,
false, // do not use mock bridge.
false, // do not use a mock one step prover
)
if err != nil {
flag.Usage()
log.Error("error deploying on l1")
panic(err)
}
rollup, err := rollupgen.NewRollupAdminLogicTransactor(deployedAddresses.Rollup, l1Reader.Client())
if err != nil {
panic(err)
}
_, err = retry.UntilSucceeds[*types.Transaction](ctx, func() (*types.Transaction, error) {
return rollup.SetMinimumAssertionPeriod(l1TransactionOpts, big.NewInt(int64(*minimumAssertionPeriodBlocks))) // 1 Ethereum block between assertions
})
if err != nil {
panic(err)
}

// We then have the validator itself authorize the rollup and challenge manager
// contracts to spend its stake tokens.
deployData, err := json.Marshal(deployedAddresses)
if err != nil {
panic(err)
}
if err := os.WriteFile(*outfile, deployData, 0600); err != nil {
panic(err)
}
parentChainIsArbitrum := l1Reader.IsParentChainArbitrum()
chainsInfo := []chaininfo.ChainInfo{
{
ChainName: *l2ChainName,
ParentChainId: l1ChainId.Uint64(),
ParentChainIsArbitrum: &parentChainIsArbitrum,
ChainConfig: &chainConfig,
RollupAddresses: &chaininfo.RollupAddresses{
Bridge: deployedAddresses.Bridge,
Inbox: deployedAddresses.Inbox,
SequencerInbox: deployedAddresses.SequencerInbox,
Rollup: deployedAddresses.Rollup,
ValidatorUtils: deployedAddresses.ValidatorUtils,
ValidatorWalletCreator: deployedAddresses.ValidatorWalletCreator,
StakeToken: stakeToken,
DeployedAt: deployedAddresses.DeployedAt,
},
},
}
chainsInfoJson, err := json.Marshal(chainsInfo)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", chainsInfoJson)
if err := os.WriteFile(*l2ChainInfo, chainsInfoJson, 0600); err != nil {
panic(err)
}
}
1 change: 1 addition & 0 deletions cmd/chaininfo/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ type RollupAddresses struct {
UpgradeExecutor common.Address `json:"upgrade-executor"`
ValidatorUtils common.Address `json:"validator-utils"`
ValidatorWalletCreator common.Address `json:"validator-wallet-creator"`
StakeToken common.Address `json:"stake-token"`
DeployedAt uint64 `json:"deployed-at"`
}
Loading
Loading