Skip to content

Commit

Permalink
Merge branch 'master' into run-mode-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Nov 8, 2024
2 parents 7cc9e05 + a81da40 commit c5d4115
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arbitrator/bench/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use prover::prepare::prepare_machine;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Path to a preimages text file
/// Path to a preimages json file
#[arg(short, long)]
preimages_path: PathBuf,
json_inputs: PathBuf,

/// Path to a machine.wavm.br
#[arg(short, long)]
machine_path: PathBuf,
binary: PathBuf,
}

fn main() -> eyre::Result<()> {
Expand All @@ -33,7 +33,7 @@ fn main() -> eyre::Result<()> {

println!("Running benchmark with always merkleize feature on");
for step_size in step_sizes {
let mut machine = prepare_machine(args.preimages_path.clone(), args.machine_path.clone())?;
let mut machine = prepare_machine(args.json_inputs.clone(), args.binary.clone())?;
let _ = machine.hash();
let mut hash_times = vec![];
let mut step_times = vec![];
Expand Down
5 changes: 5 additions & 0 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ func (c *BatchPosterConfig) Validate() error {

type BatchPosterConfigFetcher func() *BatchPosterConfig

func DangerousBatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Bool(prefix+".allow-posting-first-batch-when-sequencer-message-count-mismatch", DefaultBatchPosterConfig.Dangerous.AllowPostingFirstBatchWhenSequencerMessageCountMismatch, "allow posting the first batch even if sequence number doesn't match chain (useful after force-inclusion)")
}

func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Bool(prefix+".enable", DefaultBatchPosterConfig.Enable, "enable posting batches to l1")
f.Bool(prefix+".disable-dap-fallback-store-data-on-chain", DefaultBatchPosterConfig.DisableDapFallbackStoreDataOnChain, "If unable to batch to DA provider, disable fallback storing data on chain")
Expand All @@ -229,6 +233,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
redislock.AddConfigOptions(prefix+".redis-lock", f)
dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfig)
genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultBatchPosterConfig.ParentChainWallet.Pathname)
DangerousBatchPosterConfigAddOptions(prefix+".dangerous", f)
}

var DefaultBatchPosterConfig = BatchPosterConfig{
Expand Down
10 changes: 10 additions & 0 deletions arbos/arbosState/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig,
log.Crit("failed to open the ArbOS state", "error", err)
}

chainOwner, err := initData.GetChainOwner()
if err != nil {
return common.Hash{}, err
}
if chainOwner != (common.Address{}) {
err = arbosState.ChainOwners().Add(chainOwner)
if err != nil {
return common.Hash{}, err
}
}
addrTable := arbosState.AddressTable()
addrTableSize, err := addrTable.Size()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions cmd/conf/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type InitConfig struct {
DownloadPoll time.Duration `koanf:"download-poll"`
DevInit bool `koanf:"dev-init"`
DevInitAddress string `koanf:"dev-init-address"`
DevMaxCodeSize uint64 `koanf:"dev-max-code-size"`
DevInitBlockNum uint64 `koanf:"dev-init-blocknum"`
Empty bool `koanf:"empty"`
ImportWasm bool `koanf:"import-wasm"`
Expand Down Expand Up @@ -47,6 +48,7 @@ var InitConfigDefault = InitConfig{
DownloadPoll: time.Minute,
DevInit: false,
DevInitAddress: "",
DevMaxCodeSize: 0,
DevInitBlockNum: 0,
Empty: false,
ImportWasm: false,
Expand Down Expand Up @@ -75,6 +77,7 @@ func InitConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Bool(prefix+".dev-init", InitConfigDefault.DevInit, "init with dev data (1 account with balance) instead of file import")
f.String(prefix+".dev-init-address", InitConfigDefault.DevInitAddress, "Address of dev-account. Leave empty to use the dev-wallet.")
f.Uint64(prefix+".dev-init-blocknum", InitConfigDefault.DevInitBlockNum, "Number of preinit blocks. Must exist in ancient database.")
f.Uint64(prefix+".dev-max-code-size", InitConfigDefault.DevMaxCodeSize, "Max code size for dev accounts")
f.Bool(prefix+".empty", InitConfigDefault.Empty, "init with empty state")
f.Bool(prefix+".import-wasm", InitConfigDefault.ImportWasm, "if set, import the wasm directory when downloading a database (contains executable code - only use with highly trusted source)")
f.Bool(prefix+".then-quit", InitConfigDefault.ThenQuit, "quit after init is done")
Expand Down
4 changes: 4 additions & 0 deletions cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
Nonce: 0,
},
},
ChainOwner: common.HexToAddress(config.Init.DevInitAddress),
}
initDataReader = statetransfer.NewMemoryInitDataReader(&initData)
}
Expand Down Expand Up @@ -716,6 +717,9 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
if err != nil {
return chainDb, nil, err
}
if config.Init.DevInit && config.Init.DevMaxCodeSize != 0 {
chainConfig.ArbitrumChainParams.MaxCodeSize = config.Init.DevMaxCodeSize
}
testUpdateTxIndex(chainDb, chainConfig, &txIndexWg)
ancients, err := chainDb.Ancients()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/util/confighelpers/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ func devFlagArgs() []string {
"--init.empty=false",
"--http.port", "8547",
"--http.addr", "127.0.0.1",
"--http.api=net,web3,eth,arb,arbdebug,debug",
}
return args
}
Expand Down
1 change: 1 addition & 0 deletions statetransfer/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type ArbosInitializationInfo struct {
AddressTableContents []common.Address
RetryableData []InitializationDataForRetryable
Accounts []AccountInitializationInfo
ChainOwner common.Address
}

type InitializationDataForRetryable struct {
Expand Down
1 change: 1 addition & 0 deletions statetransfer/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type InitDataReader interface {
GetNextBlockNumber() (uint64, error)
GetRetryableDataReader() (RetryableDataReader, error)
GetAccountDataReader() (AccountDataReader, error)
GetChainOwner() (common.Address, error)
}

type ListReader interface {
Expand Down
4 changes: 4 additions & 0 deletions statetransfer/jsondatareader.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,7 @@ func (r *JsonInitDataReader) GetAccountDataReader() (AccountDataReader, error) {
JsonListReader: listreader,
}, nil
}

func (r *JsonInitDataReader) GetChainOwner() (common.Address, error) {
return common.Address{}, nil
}
4 changes: 4 additions & 0 deletions statetransfer/memdatareader.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func (r *MemoryInitDataReader) GetAccountDataReader() (AccountDataReader, error)
}, nil
}

func (r *MemoryInitDataReader) GetChainOwner() (common.Address, error) {
return r.d.ChainOwner, nil
}

func (r *MemoryInitDataReader) Close() error {
return nil
}

0 comments on commit c5d4115

Please sign in to comment.