diff --git a/.golangci.yml b/.golangci.yml
index 0594670137..8e597f950a 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -16,6 +16,7 @@ linters:
enable:
- asciicheck # check for non-ascii characters
- errorlint # enure error wrapping is safely done
+ - gci # keep imports sorted deterministically
- gocritic # check for certain simplifications
- gofmt # ensure code is formatted
- gosec # check for security concerns
@@ -30,6 +31,13 @@ linters-settings:
#
check-type-assertions: true
+ gci:
+ sections:
+ - standard
+ - default
+ - prefix(github.com/ethereum/go-ethereum)
+ - prefix(github.com/offchainlabs)
+
gocritic:
disabled-tags:
- experimental
diff --git a/arbcompress/native.go b/arbcompress/native.go
index f7b8f0b8e0..943d21e89e 100644
--- a/arbcompress/native.go
+++ b/arbcompress/native.go
@@ -12,6 +12,7 @@ package arbcompress
#include "arbitrator.h"
*/
import "C"
+
import (
"errors"
"fmt"
diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs
index 60a7036e2b..f9bd85ce53 100644
--- a/arbitrator/bench/src/bin.rs
+++ b/arbitrator/bench/src/bin.rs
@@ -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<()> {
@@ -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![];
diff --git a/arbitrator/prover/test-cases/dynamic.wat b/arbitrator/prover/test-cases/dynamic.wat
index 8771bde87c..5de0dbdca1 100644
--- a/arbitrator/prover/test-cases/dynamic.wat
+++ b/arbitrator/prover/test-cases/dynamic.wat
@@ -12,7 +12,7 @@
;; WAVM Module hash
(data (i32.const 0x000)
- "\a1\49\cf\81\13\ff\9c\95\f2\c8\c2\a1\42\35\75\36\7d\e8\6d\d4\22\d8\71\14\bb\9e\a4\7b\af\53\5d\d7") ;; user
+ "\ae\87\91\cf\6a\c4\55\ff\28\06\b9\55\d5\a7\36\e8\1b\c7\91\f7\93\8a\22\a4\08\23\25\16\37\01\48\25") ;; user
(func $start (local $user i32) (local $internals i32)
;; link in user.wat
i32.const 0
diff --git a/arbitrator/prover/test-cases/go/main.go b/arbitrator/prover/test-cases/go/main.go
index 1f81553af2..b959454d26 100644
--- a/arbitrator/prover/test-cases/go/main.go
+++ b/arbitrator/prover/test-cases/go/main.go
@@ -73,7 +73,7 @@ const BYTES_PER_FIELD_ELEMENT = 32
var BLS_MODULUS, _ = new(big.Int).SetString("52435875175126190479447740508185965837690552500527637822603658699938581184513", 10)
-var stylusModuleHash = common.HexToHash("a149cf8113ff9c95f2c8c2a1423575367de86dd422d87114bb9ea47baf535dd7") // user.wat
+var stylusModuleHash = common.HexToHash("ae8791cf6ac455ff2806b955d5a736e81bc791f7938a22a40823251637014825") // user.wat
func callStylusProgram(recurse int) {
evmData := programs.EvmData{}
diff --git a/arbitrator/prover/test-cases/link.wat b/arbitrator/prover/test-cases/link.wat
index ef15326481..85490a40b1 100644
--- a/arbitrator/prover/test-cases/link.wat
+++ b/arbitrator/prover/test-cases/link.wat
@@ -30,7 +30,7 @@
(data (i32.const 0x140)
"\47\f7\4f\9c\21\51\4f\52\24\ea\d3\37\5c\bf\a9\1b\1a\5f\ef\22\a5\2a\60\30\c5\52\18\90\6b\b1\51\e5") ;; iops
(data (i32.const 0x160)
- "\a1\49\cf\81\13\ff\9c\95\f2\c8\c2\a1\42\35\75\36\7d\e8\6d\d4\22\d8\71\14\bb\9e\a4\7b\af\53\5d\d7") ;; user
+ "\ae\87\91\cf\6a\c4\55\ff\28\06\b9\55\d5\a7\36\e8\1b\c7\91\f7\93\8a\22\a4\08\23\25\16\37\01\48\25") ;; user
(data (i32.const 0x180)
"\ee\47\08\f6\47\b2\10\88\1f\89\86\e7\e3\79\6b\b2\77\43\f1\4e\ee\cf\45\4a\9b\7c\d7\c4\5b\63\b6\d7") ;; return
diff --git a/arbitrator/prover/test-cases/user.wat b/arbitrator/prover/test-cases/user.wat
index 9ecb4dcc45..694d2f3ed8 100644
--- a/arbitrator/prover/test-cases/user.wat
+++ b/arbitrator/prover/test-cases/user.wat
@@ -22,6 +22,12 @@
i32.const 0xFFFFFF
i32.load
)
+ (func $infinite_loop (result i32)
+ (loop $loop
+ br $loop
+ )
+ unreachable
+ )
(func (export "user_entrypoint") (param $args_len i32) (result i32)
;; this func uses $args_len to select which func to call
@@ -43,6 +49,12 @@
(then (call $out_of_bounds) (return))
)
+ ;; reverts due to an out-of-gas error
+ (i32.eq (local.get $args_len) (i32.const 4))
+ (if
+ (then (call $infinite_loop) (return))
+ )
+
(i32.eq (local.get $args_len) (i32.const 32))
(if
(then (call $storage_load) (return))
diff --git a/arbitrator/stylus/tests/hostio-test/src/main.rs b/arbitrator/stylus/tests/hostio-test/src/main.rs
index 17a5d10266..47b46daad2 100644
--- a/arbitrator/stylus/tests/hostio-test/src/main.rs
+++ b/arbitrator/stylus/tests/hostio-test/src/main.rs
@@ -204,4 +204,37 @@ impl HostioTest {
fn tx_origin() -> Result
{
Ok(tx::origin())
}
+
+ fn storage_cache_bytes32() {
+ let key = B256::ZERO;
+ let val = B256::ZERO;
+ unsafe {
+ hostio::storage_cache_bytes32(key.as_ptr(), val.as_ptr());
+ }
+ }
+
+ fn pay_for_memory_grow(pages: U256) {
+ let pages: u16 = pages.try_into().unwrap();
+ unsafe {
+ hostio::pay_for_memory_grow(pages);
+ }
+ }
+
+ fn write_result_empty() {
+ }
+
+ fn write_result(size: U256) -> Result> {
+ let size: usize = size.try_into().unwrap();
+ let data = vec![0; size];
+ Ok(data)
+ }
+
+ fn read_args_no_args() {
+ }
+
+ fn read_args_one_arg(_arg1: U256) {
+ }
+
+ fn read_args_three_args(_arg1: U256, _arg2: U256, _arg3: U256) {
+ }
}
diff --git a/arbitrator/wasm-libraries/user-host-trait/src/lib.rs b/arbitrator/wasm-libraries/user-host-trait/src/lib.rs
index 35a4a31347..2f410849fc 100644
--- a/arbitrator/wasm-libraries/user-host-trait/src/lib.rs
+++ b/arbitrator/wasm-libraries/user-host-trait/src/lib.rs
@@ -936,7 +936,7 @@ pub trait UserHost: GasMeteredMachine {
fn pay_for_memory_grow(&mut self, pages: u16) -> Result<(), Self::Err> {
if pages == 0 {
self.buy_ink(HOSTIO_INK)?;
- return Ok(());
+ return trace!("pay_for_memory_grow", self, be!(pages), &[]);
}
let gas_cost = self.evm_api().add_pages(pages); // no sentry needed since the work happens after the hostio
self.buy_gas(gas_cost)?;
diff --git a/arbnode/api.go b/arbnode/api.go
index 2dabd41bff..55dc92434f 100644
--- a/arbnode/api.go
+++ b/arbnode/api.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/staker"
"github.com/offchainlabs/nitro/validator"
diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go
index 185f43fce7..a3256cb78f 100644
--- a/arbnode/batch_poster.go
+++ b/arbnode/batch_poster.go
@@ -203,11 +203,15 @@ 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")
- f.Int(prefix+".max-size", DefaultBatchPosterConfig.MaxSize, "maximum batch size")
- f.Int(prefix+".max-4844-batch-size", DefaultBatchPosterConfig.Max4844BatchSize, "maximum 4844 blob enabled batch size")
+ f.Int(prefix+".max-size", DefaultBatchPosterConfig.MaxSize, "maximum estimated compressed batch size")
+ f.Int(prefix+".max-4844-batch-size", DefaultBatchPosterConfig.Max4844BatchSize, "maximum estimated compressed 4844 blob enabled batch size")
f.Duration(prefix+".max-delay", DefaultBatchPosterConfig.MaxDelay, "maximum batch posting delay")
f.Bool(prefix+".wait-for-max-delay", DefaultBatchPosterConfig.WaitForMaxDelay, "wait for the max batch delay, even if the batch is full")
f.Duration(prefix+".poll-interval", DefaultBatchPosterConfig.PollInterval, "how long to wait after no batches are ready to be posted before checking again")
@@ -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{
diff --git a/arbnode/dataposter/data_poster.go b/arbnode/dataposter/data_poster.go
index 0949d929e1..65d8f579fa 100644
--- a/arbnode/dataposter/data_poster.go
+++ b/arbnode/dataposter/data_poster.go
@@ -20,6 +20,10 @@ import (
"time"
"github.com/Knetic/govaluate"
+ "github.com/holiman/uint256"
+ "github.com/redis/go-redis/v9"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -35,9 +39,10 @@ import (
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/arbnode/dataposter/dbstorage"
"github.com/offchainlabs/nitro/arbnode/dataposter/noop"
+ redisstorage "github.com/offchainlabs/nitro/arbnode/dataposter/redis"
"github.com/offchainlabs/nitro/arbnode/dataposter/slice"
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
"github.com/offchainlabs/nitro/util/arbmath"
@@ -46,10 +51,6 @@ import (
"github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/util/signature"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/redis/go-redis/v9"
- "github.com/spf13/pflag"
-
- redisstorage "github.com/offchainlabs/nitro/arbnode/dataposter/redis"
)
var (
diff --git a/arbnode/dataposter/dataposter_test.go b/arbnode/dataposter/dataposter_test.go
index 7bf0f86e6f..dc5df1a6c4 100644
--- a/arbnode/dataposter/dataposter_test.go
+++ b/arbnode/dataposter/dataposter_test.go
@@ -9,6 +9,9 @@ import (
"time"
"github.com/Knetic/govaluate"
+ "github.com/google/go-cmp/cmp"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -17,8 +20,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/google/go-cmp/cmp"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/arbnode/dataposter/externalsignertest"
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbnode/dataposter/dbstorage/storage.go b/arbnode/dataposter/dbstorage/storage.go
index 6a6cd3cfa4..88989cf757 100644
--- a/arbnode/dataposter/dbstorage/storage.go
+++ b/arbnode/dataposter/dbstorage/storage.go
@@ -11,6 +11,7 @@ import (
"strconv"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
"github.com/offchainlabs/nitro/util/dbutil"
)
diff --git a/arbnode/dataposter/externalsignertest/externalsignertest.go b/arbnode/dataposter/externalsignertest/externalsignertest.go
index 554defc764..51ccec1903 100644
--- a/arbnode/dataposter/externalsignertest/externalsignertest.go
+++ b/arbnode/dataposter/externalsignertest/externalsignertest.go
@@ -22,6 +22,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/arbnode/dataposter/redis/redisstorage.go b/arbnode/dataposter/redis/redisstorage.go
index b54abf618b..364f9fc85c 100644
--- a/arbnode/dataposter/redis/redisstorage.go
+++ b/arbnode/dataposter/redis/redisstorage.go
@@ -9,9 +9,10 @@ import (
"errors"
"fmt"
+ "github.com/redis/go-redis/v9"
+
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
"github.com/offchainlabs/nitro/util/signature"
- "github.com/redis/go-redis/v9"
)
// Storage implements redis sorted set backed storage. It does not support
diff --git a/arbnode/dataposter/storage/storage.go b/arbnode/dataposter/storage/storage.go
index 8e5a7e1798..dfd4c2745c 100644
--- a/arbnode/dataposter/storage/storage.go
+++ b/arbnode/dataposter/storage/storage.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/arbnode/dataposter/storage_test.go b/arbnode/dataposter/storage_test.go
index c6316caea7..cd4e4babae 100644
--- a/arbnode/dataposter/storage_test.go
+++ b/arbnode/dataposter/storage_test.go
@@ -9,12 +9,14 @@ import (
"path"
"testing"
+ "github.com/google/go-cmp/cmp"
+ "github.com/google/go-cmp/cmp/cmpopts"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
- "github.com/google/go-cmp/cmp"
- "github.com/google/go-cmp/cmp/cmpopts"
+
"github.com/offchainlabs/nitro/arbnode/dataposter/dbstorage"
"github.com/offchainlabs/nitro/arbnode/dataposter/redis"
"github.com/offchainlabs/nitro/arbnode/dataposter/slice"
diff --git a/arbnode/delayed.go b/arbnode/delayed.go
index 354fa671b3..f28a9617a3 100644
--- a/arbnode/delayed.go
+++ b/arbnode/delayed.go
@@ -334,7 +334,11 @@ func (b *DelayedBridge) parseMessage(ctx context.Context, ethLog types.Log) (*bi
if err != nil {
return nil, nil, err
}
- return parsedLog.MessageNum, args["messageData"].([]byte), nil
+ dataBytes, ok := args["messageData"].([]byte)
+ if !ok {
+ return nil, nil, errors.New("messageData not a byte array")
+ }
+ return parsedLog.MessageNum, dataBytes, nil
default:
return nil, nil, errors.New("unexpected log type")
}
diff --git a/arbnode/delayed_seq_reorg_test.go b/arbnode/delayed_seq_reorg_test.go
index 699eb3e8f6..f821d71e63 100644
--- a/arbnode/delayed_seq_reorg_test.go
+++ b/arbnode/delayed_seq_reorg_test.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
)
diff --git a/arbnode/delayed_sequencer.go b/arbnode/delayed_sequencer.go
index b29a66dd05..abd24dbd12 100644
--- a/arbnode/delayed_sequencer.go
+++ b/arbnode/delayed_sequencer.go
@@ -10,10 +10,11 @@ import (
"math/big"
"sync"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
- flag "github.com/spf13/pflag"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/execution"
diff --git a/arbnode/inbox_reader.go b/arbnode/inbox_reader.go
index 14ca83ab13..50893ca392 100644
--- a/arbnode/inbox_reader.go
+++ b/arbnode/inbox_reader.go
@@ -13,10 +13,11 @@ import (
"sync/atomic"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
- flag "github.com/spf13/pflag"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go
index e588ef399b..0c31008ff1 100644
--- a/arbnode/inbox_test.go
+++ b/arbnode/inbox_test.go
@@ -11,23 +11,23 @@ import (
"testing"
"time"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/rawdb"
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/params"
+
+ "github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbutil"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/statetransfer"
-
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/testhelpers"
"github.com/offchainlabs/nitro/util/testhelpers/env"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core"
- "github.com/ethereum/go-ethereum/core/rawdb"
- "github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/params"
- "github.com/offchainlabs/nitro/arbos"
)
type execClientWrapper struct {
@@ -45,7 +45,7 @@ func (w *execClientWrapper) FullSyncProgressMap() map[string]interface{} {
}
func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (*gethexec.ExecutionEngine, *TransactionStreamer, ethdb.Database, *core.BlockChain) {
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
initData := statetransfer.ArbosInitializationInfo{
Accounts: []statetransfer.AccountInitializationInfo{
diff --git a/arbnode/inbox_tracker_test.go b/arbnode/inbox_tracker_test.go
index 582b334aee..82d380b03c 100644
--- a/arbnode/inbox_tracker_test.go
+++ b/arbnode/inbox_tracker_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/core/rawdb"
+
"github.com/offchainlabs/nitro/util/containers"
)
diff --git a/arbnode/maintenance.go b/arbnode/maintenance.go
index 7397229c2e..5e4e56b577 100644
--- a/arbnode/maintenance.go
+++ b/arbnode/maintenance.go
@@ -10,12 +10,14 @@ import (
"strings"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbnode/redislock"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
// Regularly runs db compaction if configured
diff --git a/arbnode/message_pruner.go b/arbnode/message_pruner.go
index b249bd886c..840a15f328 100644
--- a/arbnode/message_pruner.go
+++ b/arbnode/message_pruner.go
@@ -11,14 +11,14 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/offchainlabs/nitro/validator"
-
- flag "github.com/spf13/pflag"
)
type MessagePruner struct {
diff --git a/arbnode/message_pruner_test.go b/arbnode/message_pruner_test.go
index e64bb4f838..8e6b744430 100644
--- a/arbnode/message_pruner_test.go
+++ b/arbnode/message_pruner_test.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/arbnode/node.go b/arbnode/node.go
index 75aba0481d..ac1a532da1 100644
--- a/arbnode/node.go
+++ b/arbnode/node.go
@@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbnode/dataposter"
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
"github.com/offchainlabs/nitro/arbnode/resourcemanager"
diff --git a/arbnode/redislock/redis.go b/arbnode/redislock/redis.go
index de9508323a..075ff60c09 100644
--- a/arbnode/redislock/redis.go
+++ b/arbnode/redislock/redis.go
@@ -11,10 +11,12 @@ import (
"sync/atomic"
"time"
- "github.com/ethereum/go-ethereum/log"
- "github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/redis/go-redis/v9"
flag "github.com/spf13/pflag"
+
+ "github.com/ethereum/go-ethereum/log"
+
+ "github.com/offchainlabs/nitro/util/stopwaiter"
)
type Simple struct {
diff --git a/arbnode/resourcemanager/resource_management.go b/arbnode/resourcemanager/resource_management.go
index 249b689443..462b38c578 100644
--- a/arbnode/resourcemanager/resource_management.go
+++ b/arbnode/resourcemanager/resource_management.go
@@ -14,10 +14,11 @@ import (
"strings"
"time"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
- "github.com/spf13/pflag"
)
var (
diff --git a/arbnode/sequencer_inbox.go b/arbnode/sequencer_inbox.go
index 81146ed46e..9dae7cfb8d 100644
--- a/arbnode/sequencer_inbox.go
+++ b/arbnode/sequencer_inbox.go
@@ -16,9 +16,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/arbutil"
-
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
)
@@ -124,7 +124,11 @@ func (m *SequencerInboxBatch) getSequencerData(ctx context.Context, client *ethc
if err != nil {
return nil, err
}
- return args["data"].([]byte), nil
+ dataBytes, ok := args["data"].([]byte)
+ if !ok {
+ return nil, errors.New("args[\"data\"] not a byte array")
+ }
+ return dataBytes, nil
case batchDataSeparateEvent:
var numberAsHash common.Hash
binary.BigEndian.PutUint64(numberAsHash[(32-8):], m.SequenceNumber)
diff --git a/arbnode/sync_monitor.go b/arbnode/sync_monitor.go
index 5ab1ede2d6..f06e9ca49f 100644
--- a/arbnode/sync_monitor.go
+++ b/arbnode/sync_monitor.go
@@ -5,10 +5,12 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
type SyncMonitor struct {
@@ -144,11 +146,13 @@ func (s *SyncMonitor) FullSyncProgressMap() map[string]interface{} {
batchProcessed := s.inboxReader.GetLastReadBatchCount()
res["batchProcessed"] = batchProcessed
- processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
- if err != nil {
- res["batchMetadataError"] = err.Error()
- } else {
- res["messageOfProcessedBatch"] = processedBatchMsgs
+ if batchProcessed > 0 {
+ processedBatchMsgs, err := s.inboxReader.Tracker().GetBatchMessageCount(batchProcessed - 1)
+ if err != nil {
+ res["batchMetadataError"] = err.Error()
+ } else {
+ res["messageOfProcessedBatch"] = processedBatchMsgs
+ }
}
l1reader := s.inboxReader.l1Reader
diff --git a/arbnode/transaction_streamer.go b/arbnode/transaction_streamer.go
index 8a8857fde3..61c37e16ed 100644
--- a/arbnode/transaction_streamer.go
+++ b/arbnode/transaction_streamer.go
@@ -8,6 +8,7 @@ import (
"context"
"encoding/binary"
"encoding/json"
+ "errors"
"fmt"
"math/big"
"reflect"
@@ -17,8 +18,6 @@ import (
"testing"
"time"
- "errors"
-
flag "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/common"
diff --git a/arbos/activate_test.go b/arbos/activate_test.go
index a89a38639a..b723c37aa6 100644
--- a/arbos/activate_test.go
+++ b/arbos/activate_test.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/addressSet/addressSet.go b/arbos/addressSet/addressSet.go
index 156f36e7e7..4bb87e614d 100644
--- a/arbos/addressSet/addressSet.go
+++ b/arbos/addressSet/addressSet.go
@@ -9,6 +9,7 @@ import (
"errors"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
)
diff --git a/arbos/addressSet/addressSet_test.go b/arbos/addressSet/addressSet_test.go
index d32e07a546..b65c278b2b 100644
--- a/arbos/addressSet/addressSet_test.go
+++ b/arbos/addressSet/addressSet_test.go
@@ -8,16 +8,17 @@ import (
"math/rand"
"testing"
- "github.com/ethereum/go-ethereum/common/math"
- "github.com/ethereum/go-ethereum/params"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core/state"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -26,7 +27,7 @@ func TestEmptyAddressSet(t *testing.T) {
sto := storage.NewMemoryBacked(burn.NewSystemBurner(nil, false))
Require(t, Initialize(sto))
aset := OpenAddressSet(sto)
- version := params.ArbitrumDevTestParams().InitialArbOSVersion
+ version := chaininfo.ArbitrumDevTestParams().InitialArbOSVersion
if size(t, aset) != 0 {
Fail(t)
@@ -49,7 +50,7 @@ func TestAddressSet(t *testing.T) {
sto := storage.NewGeth(db, burn.NewSystemBurner(nil, false))
Require(t, Initialize(sto))
aset := OpenAddressSet(sto)
- version := params.ArbitrumDevTestParams().InitialArbOSVersion
+ version := chaininfo.ArbitrumDevTestParams().InitialArbOSVersion
statedb, _ := (db).(*state.StateDB)
stateHashBeforeChanges := statedb.IntermediateRoot(false)
@@ -144,7 +145,7 @@ func TestAddressSetAllMembers(t *testing.T) {
sto := storage.NewGeth(db, burn.NewSystemBurner(nil, false))
Require(t, Initialize(sto))
aset := OpenAddressSet(sto)
- version := params.ArbitrumDevTestParams().InitialArbOSVersion
+ version := chaininfo.ArbitrumDevTestParams().InitialArbOSVersion
addr1 := testhelpers.RandomAddress()
addr2 := testhelpers.RandomAddress()
diff --git a/arbos/addressTable/addressTable.go b/arbos/addressTable/addressTable.go
index 6ae271060d..608883c34d 100644
--- a/arbos/addressTable/addressTable.go
+++ b/arbos/addressTable/addressTable.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
+
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
)
diff --git a/arbos/addressTable/addressTable_test.go b/arbos/addressTable/addressTable_test.go
index 6b06ed3406..873d5a4d1c 100644
--- a/arbos/addressTable/addressTable_test.go
+++ b/arbos/addressTable/addressTable_test.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/util/testhelpers"
diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go
index f53d9c892a..a3d1ae8386 100644
--- a/arbos/arbosState/arbosstate.go
+++ b/arbos/arbosState/arbosstate.go
@@ -32,6 +32,7 @@ import (
"github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/testhelpers/env"
)
@@ -128,7 +129,7 @@ func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) {
log.Crit("failed to init empty statedb", "error", err)
}
burner := burn.NewSystemBurner(nil, false)
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
newState, err := InitializeArbosState(statedb, burner, chainConfig, arbostypes.TestInitMessage)
if err != nil {
log.Crit("failed to open the ArbOS state", "error", err)
diff --git a/arbos/arbosState/arbosstate_test.go b/arbos/arbosState/arbosstate_test.go
index ef63c23386..440598991c 100644
--- a/arbos/arbosState/arbosstate_test.go
+++ b/arbos/arbosState/arbosstate_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go
index 697a41e4fd..8ccfbc7cfb 100644
--- a/arbos/arbosState/initialization_test.go
+++ b/arbos/arbosState/initialization_test.go
@@ -13,9 +13,10 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/burn"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/statetransfer"
"github.com/offchainlabs/nitro/util/testhelpers"
"github.com/offchainlabs/nitro/util/testhelpers/env"
@@ -61,7 +62,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin
raw := rawdb.NewMemoryDatabase()
initReader := statetransfer.NewMemoryInitDataReader(&initData)
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme())
stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0)
diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go
index 374eff2cea..29cb75b758 100644
--- a/arbos/arbosState/initialize.go
+++ b/arbos/arbosState/initialize.go
@@ -5,21 +5,23 @@ package arbosState
import (
"errors"
- "github.com/ethereum/go-ethereum/core/tracing"
"math/big"
"regexp"
"sort"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/l2pricing"
@@ -97,6 +99,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 {
diff --git a/arbos/arbostypes/incomingmessage.go b/arbos/arbostypes/incomingmessage.go
index c4c2dc037b..b9a366cbd5 100644
--- a/arbos/arbostypes/incomingmessage.go
+++ b/arbos/arbostypes/incomingmessage.go
@@ -16,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/arbmath"
)
@@ -265,7 +266,7 @@ type ParsedInitMessage struct {
var DefaultInitialL1BaseFee = big.NewInt(50 * params.GWei)
var TestInitMessage = &ParsedInitMessage{
- ChainId: params.ArbitrumDevTestChainConfig().ChainID,
+ ChainId: chaininfo.ArbitrumDevTestChainConfig().ChainID,
InitialL1BaseFee: DefaultInitialL1BaseFee,
}
diff --git a/arbos/arbostypes/messagewithmeta.go b/arbos/arbostypes/messagewithmeta.go
index 4b04a043d9..d42db9a643 100644
--- a/arbos/arbostypes/messagewithmeta.go
+++ b/arbos/arbostypes/messagewithmeta.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rlp"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/arbos/block_processor.go b/arbos/block_processor.go
index 19fc36b351..fe0a39d230 100644
--- a/arbos/block_processor.go
+++ b/arbos/block_processor.go
@@ -10,12 +10,6 @@ import (
"math"
"math/big"
- "github.com/offchainlabs/nitro/arbos/arbosState"
- "github.com/offchainlabs/nitro/arbos/arbostypes"
- "github.com/offchainlabs/nitro/arbos/l2pricing"
- "github.com/offchainlabs/nitro/arbos/util"
- "github.com/offchainlabs/nitro/util/arbmath"
-
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -25,6 +19,12 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
+
+ "github.com/offchainlabs/nitro/arbos/arbosState"
+ "github.com/offchainlabs/nitro/arbos/arbostypes"
+ "github.com/offchainlabs/nitro/arbos/l2pricing"
+ "github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/util/arbmath"
)
// set by the precompile module, to avoid a package dependence cycle
@@ -340,18 +340,6 @@ func ProduceBlockAdvanced(
return receipt, result, nil
})()
- if tx.Type() == types.ArbitrumInternalTxType {
- // ArbOS might have upgraded to a new version, so we need to refresh our state
- state, err = arbosState.OpenSystemArbosState(statedb, nil, true)
- if err != nil {
- return nil, nil, err
- }
- // Update the ArbOS version in the header (if it changed)
- extraInfo := types.DeserializeHeaderExtraInformation(header)
- extraInfo.ArbOSFormatVersion = state.ArbOSVersion()
- extraInfo.UpdateHeaderWithInfo(header)
- }
-
// append the err, even if it is nil
hooks.TxErrors = append(hooks.TxErrors, err)
@@ -373,6 +361,18 @@ func ProduceBlockAdvanced(
continue
}
+ if tx.Type() == types.ArbitrumInternalTxType {
+ // ArbOS might have upgraded to a new version, so we need to refresh our state
+ state, err = arbosState.OpenSystemArbosState(statedb, nil, true)
+ if err != nil {
+ return nil, nil, err
+ }
+ // Update the ArbOS version in the header (if it changed)
+ extraInfo := types.DeserializeHeaderExtraInformation(header)
+ extraInfo.ArbOSFormatVersion = state.ArbOSVersion()
+ extraInfo.UpdateHeaderWithInfo(header)
+ }
+
if tx.Type() == types.ArbitrumInternalTxType && result.Err != nil {
return nil, nil, fmt.Errorf("failed to apply internal transaction: %w", result.Err)
}
diff --git a/arbos/blockhash/blockhash.go b/arbos/blockhash/blockhash.go
index 34c907207c..ff29bbca9a 100644
--- a/arbos/blockhash/blockhash.go
+++ b/arbos/blockhash/blockhash.go
@@ -8,6 +8,7 @@ import (
"errors"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/storage"
)
diff --git a/arbos/blockhash/blockhash_test.go b/arbos/blockhash/blockhash_test.go
index bf3ee5ee11..c7cc04d966 100644
--- a/arbos/blockhash/blockhash_test.go
+++ b/arbos/blockhash/blockhash_test.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/util/testhelpers"
diff --git a/arbos/burn/burn.go b/arbos/burn/burn.go
index 7d30ad12ec..c94f6bec2f 100644
--- a/arbos/burn/burn.go
+++ b/arbos/burn/burn.go
@@ -7,6 +7,7 @@ import (
"fmt"
glog "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos/util"
)
diff --git a/arbos/extra_transaction_checks.go b/arbos/extra_transaction_checks.go
index 0f970c9925..480058cb0f 100644
--- a/arbos/extra_transaction_checks.go
+++ b/arbos/extra_transaction_checks.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
)
diff --git a/arbos/incomingmessage_test.go b/arbos/incomingmessage_test.go
index 2933f6a719..22aba05bce 100644
--- a/arbos/incomingmessage_test.go
+++ b/arbos/incomingmessage_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
)
diff --git a/arbos/internal_tx.go b/arbos/internal_tx.go
index 9832ac8005..64dede6290 100644
--- a/arbos/internal_tx.go
+++ b/arbos/internal_tx.go
@@ -8,15 +8,14 @@ import (
"fmt"
"math/big"
- "github.com/offchainlabs/nitro/util/arbmath"
-
- "github.com/ethereum/go-ethereum/log"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
+ "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/util/arbmath"
)
func InternalTxStartBlock(
diff --git a/arbos/l1pricing/batchPoster.go b/arbos/l1pricing/batchPoster.go
index a3428c441c..5975e95d0f 100644
--- a/arbos/l1pricing/batchPoster.go
+++ b/arbos/l1pricing/batchPoster.go
@@ -9,6 +9,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/addressSet"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/l1pricing/batchPoster_test.go b/arbos/l1pricing/batchPoster_test.go
index 4e9b8565c0..3263ffca81 100644
--- a/arbos/l1pricing/batchPoster_test.go
+++ b/arbos/l1pricing/batchPoster_test.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
)
diff --git a/arbos/l1pricing/l1PricingOldVersions.go b/arbos/l1pricing/l1PricingOldVersions.go
index 821d743e7d..1377351af3 100644
--- a/arbos/l1pricing/l1PricingOldVersions.go
+++ b/arbos/l1pricing/l1PricingOldVersions.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
+
"github.com/offchainlabs/nitro/arbos/util"
am "github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbos/l1pricing/l1pricing.go b/arbos/l1pricing/l1pricing.go
index 392bf36d37..37dae08c33 100644
--- a/arbos/l1pricing/l1pricing.go
+++ b/arbos/l1pricing/l1pricing.go
@@ -10,20 +10,19 @@ import (
"math/big"
"sync/atomic"
- "github.com/ethereum/go-ethereum/crypto"
-
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/arbcompress"
- "github.com/offchainlabs/nitro/util/arbmath"
- am "github.com/offchainlabs/nitro/util/arbmath"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core"
- "github.com/ethereum/go-ethereum/core/types"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
+ "github.com/offchainlabs/nitro/util/arbmath"
+ am "github.com/offchainlabs/nitro/util/arbmath"
)
type L1PricingState struct {
@@ -540,7 +539,7 @@ var randomNonce = binary.BigEndian.Uint64(crypto.Keccak256([]byte("Nonce"))[:8])
var randomGasTipCap = new(big.Int).SetBytes(crypto.Keccak256([]byte("GasTipCap"))[:4])
var randomGasFeeCap = new(big.Int).SetBytes(crypto.Keccak256([]byte("GasFeeCap"))[:4])
var RandomGas = uint64(binary.BigEndian.Uint32(crypto.Keccak256([]byte("Gas"))[:4]))
-var randV = arbmath.BigMulByUint(params.ArbitrumOneChainConfig().ChainID, 3)
+var randV = arbmath.BigMulByUint(chaininfo.ArbitrumOneChainConfig().ChainID, 3)
var randR = crypto.Keccak256Hash([]byte("R")).Big()
var randS = crypto.Keccak256Hash([]byte("S")).Big()
diff --git a/arbos/l1pricing/l1pricing_test.go b/arbos/l1pricing/l1pricing_test.go
index b301c94257..b842c26db7 100644
--- a/arbos/l1pricing/l1pricing_test.go
+++ b/arbos/l1pricing/l1pricing_test.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
)
diff --git a/arbos/l1pricing_test.go b/arbos/l1pricing_test.go
index 6de69db1de..6ab0135be9 100644
--- a/arbos/l1pricing_test.go
+++ b/arbos/l1pricing_test.go
@@ -4,22 +4,24 @@
package arbos
import (
- "github.com/ethereum/go-ethereum/core/tracing"
"math/big"
"testing"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
- "github.com/holiman/uint256"
+ "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
+ "github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/arbmath"
-
- "github.com/ethereum/go-ethereum/params"
- "github.com/offchainlabs/nitro/arbos/burn"
)
type l1PricingTest struct {
@@ -316,7 +318,7 @@ func _withinOnePercent(v1, v2 *big.Int) bool {
}
func newMockEVMForTesting() *vm.EVM {
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
_, statedb := arbosState.NewArbosMemoryBackedArbOSState()
context := vm.BlockContext{
BlockNumber: big.NewInt(0),
diff --git a/arbos/l2pricing/model.go b/arbos/l2pricing/model.go
index 476effa8aa..367e8b6e1a 100644
--- a/arbos/l2pricing/model.go
+++ b/arbos/l2pricing/model.go
@@ -7,6 +7,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbos/merkleAccumulator/merkleAccumulator.go b/arbos/merkleAccumulator/merkleAccumulator.go
index e62303e5fd..0d51602c02 100644
--- a/arbos/merkleAccumulator/merkleAccumulator.go
+++ b/arbos/merkleAccumulator/merkleAccumulator.go
@@ -6,6 +6,7 @@ package merkleAccumulator
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbos/parse_l2.go b/arbos/parse_l2.go
index 06722e4063..cd926f47bf 100644
--- a/arbos/parse_l2.go
+++ b/arbos/parse_l2.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/programs/api.go b/arbos/programs/api.go
index 5ec8c97207..d8f12ffbd3 100644
--- a/arbos/programs/api.go
+++ b/arbos/programs/api.go
@@ -4,12 +4,14 @@
package programs
import (
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
am "github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/programs/native.go b/arbos/programs/native.go
index 725b302ac0..f162704995 100644
--- a/arbos/programs/native.go
+++ b/arbos/programs/native.go
@@ -18,6 +18,7 @@ typedef uint64_t u64;
typedef size_t usize;
*/
import "C"
+
import (
"errors"
"fmt"
@@ -30,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/arbutil"
diff --git a/arbos/programs/native_api.go b/arbos/programs/native_api.go
index 6cecb8ef63..ab15800ef9 100644
--- a/arbos/programs/native_api.go
+++ b/arbos/programs/native_api.go
@@ -22,6 +22,7 @@ void handleReqWrap(usize api, u32 req_type, RustSlice *data, u64 *out_cost, GoSl
}
*/
import "C"
+
import (
"runtime"
"sync"
@@ -29,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/arbos/programs/params.go b/arbos/programs/params.go
index a0b8acd95c..9b219737d9 100644
--- a/arbos/programs/params.go
+++ b/arbos/programs/params.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
am "github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/programs/programs.go b/arbos/programs/programs.go
index 06ff4137da..06ba6ead8c 100644
--- a/arbos/programs/programs.go
+++ b/arbos/programs/programs.go
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
gethParams "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbcompress"
"github.com/offchainlabs/nitro/arbos/addressSet"
"github.com/offchainlabs/nitro/arbos/storage"
diff --git a/arbos/programs/testcompile.go b/arbos/programs/testcompile.go
index 615b0f3f72..8a4e38444a 100644
--- a/arbos/programs/testcompile.go
+++ b/arbos/programs/testcompile.go
@@ -20,6 +20,7 @@ typedef size_t usize;
void handleReqWrap(usize api, u32 req_type, RustSlice *data, u64 *out_cost, GoSliceData *out_result, GoSliceData *out_raw_data);
*/
import "C"
+
import (
"fmt"
"os"
diff --git a/arbos/queue_test.go b/arbos/queue_test.go
index ff993a233f..75d60b82c3 100644
--- a/arbos/queue_test.go
+++ b/arbos/queue_test.go
@@ -7,7 +7,6 @@ import (
"testing"
"github.com/offchainlabs/nitro/arbos/arbosState"
-
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
)
diff --git a/arbos/retryable_test.go b/arbos/retryable_test.go
index 2eccaea6c2..b2989de331 100644
--- a/arbos/retryable_test.go
+++ b/arbos/retryable_test.go
@@ -9,17 +9,17 @@ import (
"testing"
"time"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/vm"
+ "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/testhelpers"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core/state"
- "github.com/ethereum/go-ethereum/core/vm"
- "github.com/ethereum/go-ethereum/params"
)
func TestOpenNonexistentRetryable(t *testing.T) {
diff --git a/arbos/retryables/retryable.go b/arbos/retryables/retryable.go
index 5938244782..23ba2458ff 100644
--- a/arbos/retryables/retryable.go
+++ b/arbos/retryables/retryable.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/storage/queue.go b/arbos/storage/queue.go
index 9c02dc1ee7..3c852a5743 100644
--- a/arbos/storage/queue.go
+++ b/arbos/storage/queue.go
@@ -4,9 +4,9 @@
package storage
import (
- "github.com/offchainlabs/nitro/arbos/util"
-
"github.com/ethereum/go-ethereum/common"
+
+ "github.com/offchainlabs/nitro/arbos/util"
)
type Queue struct {
diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go
index bc16491af0..63db8ee928 100644
--- a/arbos/storage/storage.go
+++ b/arbos/storage/storage.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbos/storage/storage_test.go b/arbos/storage/storage_test.go
index b2e8bdb2ea..dd2c40b8f0 100644
--- a/arbos/storage/storage_test.go
+++ b/arbos/storage/storage_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbos/tx_processor.go b/arbos/tx_processor.go
index e05368dea7..aec08b15b5 100644
--- a/arbos/tx_processor.go
+++ b/arbos/tx_processor.go
@@ -9,22 +9,20 @@ import (
"math/big"
"github.com/holiman/uint256"
- "github.com/offchainlabs/nitro/arbos/l1pricing"
-
- "github.com/offchainlabs/nitro/arbos/util"
- "github.com/offchainlabs/nitro/util/arbmath"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
+ glog "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
- "github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/arbos/arbosState"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core"
- "github.com/ethereum/go-ethereum/core/vm"
- glog "github.com/ethereum/go-ethereum/log"
+ "github.com/offchainlabs/nitro/arbos/l1pricing"
+ "github.com/offchainlabs/nitro/arbos/retryables"
+ "github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/util/arbmath"
)
var arbosAddress = types.ArbosAddress
diff --git a/arbos/util/retryable_encoding_test.go b/arbos/util/retryable_encoding_test.go
index d7a5480138..b74983ed0b 100644
--- a/arbos/util/retryable_encoding_test.go
+++ b/arbos/util/retryable_encoding_test.go
@@ -10,16 +10,15 @@ import (
"testing"
"time"
- "github.com/ethereum/go-ethereum/crypto"
-
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/testhelpers"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core/types"
)
func TestRetryableEncoding(t *testing.T) {
diff --git a/arbos/util/storage_cache.go b/arbos/util/storage_cache.go
index 9573d1ffc7..a9be5fe870 100644
--- a/arbos/util/storage_cache.go
+++ b/arbos/util/storage_cache.go
@@ -4,8 +4,9 @@
package util
import (
- "github.com/ethereum/go-ethereum/common"
"slices"
+
+ "github.com/ethereum/go-ethereum/common"
)
type storageCacheEntry struct {
diff --git a/arbos/util/storage_cache_test.go b/arbos/util/storage_cache_test.go
index 9fd452851d..0ba2c5285e 100644
--- a/arbos/util/storage_cache_test.go
+++ b/arbos/util/storage_cache_test.go
@@ -7,8 +7,10 @@ import (
"slices"
"testing"
- "github.com/ethereum/go-ethereum/common"
"github.com/google/go-cmp/cmp"
+
+ "github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/arbos/util/tracing.go b/arbos/util/tracing.go
index fb39460d44..f092d32c2d 100644
--- a/arbos/util/tracing.go
+++ b/arbos/util/tracing.go
@@ -7,11 +7,12 @@ import (
"encoding/binary"
"math/big"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
- "github.com/holiman/uint256"
)
type TracingScenario uint64
diff --git a/arbos/util/transfer.go b/arbos/util/transfer.go
index ed5e07c8cf..37437e01f6 100644
--- a/arbos/util/transfer.go
+++ b/arbos/util/transfer.go
@@ -9,11 +9,13 @@ import (
"fmt"
"math/big"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/arbos/util/util.go b/arbos/util/util.go
index 69d90171a0..abb7135757 100644
--- a/arbos/util/util.go
+++ b/arbos/util/util.go
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/arbstate/daprovider/reader.go b/arbstate/daprovider/reader.go
index 488b156454..e2fd884340 100644
--- a/arbstate/daprovider/reader.go
+++ b/arbstate/daprovider/reader.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/blobs"
)
diff --git a/arbstate/inbox_fuzz_test.go b/arbstate/inbox_fuzz_test.go
index 5ede321810..5a77b7e298 100644
--- a/arbstate/inbox_fuzz_test.go
+++ b/arbstate/inbox_fuzz_test.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbstate/daprovider"
)
diff --git a/arbutil/hash_test.go b/arbutil/hash_test.go
index 2b93353d08..4b39bf328e 100644
--- a/arbutil/hash_test.go
+++ b/arbutil/hash_test.go
@@ -4,8 +4,9 @@ import (
"bytes"
"testing"
- "github.com/ethereum/go-ethereum/common"
"github.com/google/go-cmp/cmp"
+
+ "github.com/ethereum/go-ethereum/common"
)
func TestSlotAddress(t *testing.T) {
diff --git a/blocks_reexecutor/blocks_reexecutor.go b/blocks_reexecutor/blocks_reexecutor.go
index 5a883e5d42..d074457626 100644
--- a/blocks_reexecutor/blocks_reexecutor.go
+++ b/blocks_reexecutor/blocks_reexecutor.go
@@ -9,6 +9,8 @@ import (
"strings"
"sync"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -19,9 +21,9 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
+
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
type Config struct {
diff --git a/broadcastclient/broadcastclient.go b/broadcastclient/broadcastclient.go
index 4e97ca8cd0..c4a3743276 100644
--- a/broadcastclient/broadcastclient.go
+++ b/broadcastclient/broadcastclient.go
@@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbutil"
m "github.com/offchainlabs/nitro/broadcaster/message"
"github.com/offchainlabs/nitro/util/contracts"
@@ -129,9 +130,10 @@ type BroadcastClient struct {
chainId uint64
- // Protects conn and shuttingDown
- connMutex sync.Mutex
- conn net.Conn
+ // Protects conn, shuttingDown and compression
+ connMutex sync.Mutex
+ conn net.Conn
+ compression bool
retryCount atomic.Int64
@@ -298,7 +300,7 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa
return nil, nil
}
- conn, br, _, err := timeoutDialer.Dial(ctx, bc.websocketUrl)
+ conn, br, hs, err := timeoutDialer.Dial(ctx, bc.websocketUrl)
if errors.Is(err, ErrIncorrectFeedServerVersion) || errors.Is(err, ErrIncorrectChainId) {
return nil, err
}
@@ -324,6 +326,24 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa
return nil, ErrMissingFeedServerVersion
}
+ compressionNegotiated := false
+ for _, ext := range hs.Extensions {
+ if ext.Equal(deflateExt) {
+ compressionNegotiated = true
+ break
+ }
+ }
+ if !compressionNegotiated && config.EnableCompression {
+ log.Warn("Compression was not negotiated when connecting to feed server.")
+ }
+ if compressionNegotiated && !config.EnableCompression {
+ err := conn.Close()
+ if err != nil {
+ return nil, fmt.Errorf("error closing connection when negotiated disabled extension: %w", err)
+ }
+ return nil, errors.New("error dialing feed server: negotiated compression ws extension, but it is disabled")
+ }
+
var earlyFrameData io.Reader
if br != nil {
// Depending on how long the client takes to read the response, there may be
@@ -338,6 +358,7 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa
bc.connMutex.Lock()
bc.conn = conn
+ bc.compression = compressionNegotiated
bc.connMutex.Unlock()
log.Info("Feed connected", "feedServerVersion", feedServerVersion, "chainId", chainId, "requestedSeqNum", nextSeqNum)
@@ -361,7 +382,7 @@ func (bc *BroadcastClient) startBackgroundReader(earlyFrameData io.Reader) {
var op ws.OpCode
var err error
config := bc.config()
- msg, op, err = wsbroadcastserver.ReadData(ctx, bc.conn, earlyFrameData, config.Timeout, ws.StateClientSide, config.EnableCompression, flateReader)
+ msg, op, err = wsbroadcastserver.ReadData(ctx, bc.conn, earlyFrameData, config.Timeout, ws.StateClientSide, bc.compression, flateReader)
if err != nil {
if bc.isShuttingDown() {
return
diff --git a/broadcastclient/broadcastclient_test.go b/broadcastclient/broadcastclient_test.go
index 851ba9efa6..63ce1dbd84 100644
--- a/broadcastclient/broadcastclient_test.go
+++ b/broadcastclient/broadcastclient_test.go
@@ -30,43 +30,30 @@ import (
"github.com/offchainlabs/nitro/wsbroadcastserver"
)
-func TestReceiveMessagesWithoutCompression(t *testing.T) {
+func TestReceiveMessages(t *testing.T) {
t.Parallel()
- testReceiveMessages(t, false, false, false, false)
-}
-
-func TestReceiveMessagesWithCompression(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, true, true, false, false)
-}
-
-func TestReceiveMessagesWithServerOptionalCompression(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, true, true, false, false)
-}
-
-func TestReceiveMessagesWithServerOnlyCompression(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, false, true, false, false)
-}
-
-func TestReceiveMessagesWithClientOnlyCompression(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, true, false, false, false)
-}
-
-func TestReceiveMessagesWithRequiredCompression(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, true, true, true, false)
-}
-
-func TestReceiveMessagesWithRequiredCompressionButClientDisabled(t *testing.T) {
- t.Parallel()
- testReceiveMessages(t, false, true, true, true)
+ t.Run("withoutCompression", func(t *testing.T) {
+ testReceiveMessages(t, false, false, false, false)
+ })
+ t.Run("withServerOptionalCompression", func(t *testing.T) {
+ testReceiveMessages(t, true, true, false, false)
+ })
+ t.Run("withServerOnlyCompression", func(t *testing.T) {
+ testReceiveMessages(t, false, true, false, false)
+ })
+ t.Run("withClientOnlyCompression", func(t *testing.T) {
+ testReceiveMessages(t, true, false, false, false)
+ })
+ t.Run("withRequiredCompression", func(t *testing.T) {
+ testReceiveMessages(t, true, true, true, false)
+ })
+ t.Run("withRequiredCompressionButClientDisabled", func(t *testing.T) {
+ testReceiveMessages(t, false, true, true, true)
+ })
}
func testReceiveMessages(t *testing.T, clientCompression bool, serverCompression bool, serverRequire bool, expectNoMessagesReceived bool) {
- t.Helper()
+ t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -138,7 +125,11 @@ func TestInvalidSignature(t *testing.T) {
badPrivateKey, err := crypto.GenerateKey()
Require(t, err)
badPublicKey := badPrivateKey.Public()
- badSequencerAddr := crypto.PubkeyToAddress(*badPublicKey.(*ecdsa.PublicKey))
+ badECDSA, ok := badPublicKey.(*ecdsa.PublicKey)
+ if !ok {
+ t.Fatal("badPublicKey is not an ecdsa.PublicKey")
+ }
+ badSequencerAddr := crypto.PubkeyToAddress(*badECDSA)
config := DefaultTestConfig
ts := NewDummyTransactionStreamer(chainId, &badSequencerAddr)
@@ -151,6 +142,7 @@ func TestInvalidSignature(t *testing.T) {
nil,
fatalErrChan,
&badSequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
@@ -201,8 +193,9 @@ func (ts *dummyTransactionStreamer) AddBroadcastMessages(feedMessages []*m.Broad
return nil
}
-func newTestBroadcastClient(config Config, listenerAddress net.Addr, chainId uint64, currentMessageCount arbutil.MessageIndex, txStreamer TransactionStreamerInterface, confirmedSequenceNumberListener chan arbutil.MessageIndex, feedErrChan chan error, validAddr *common.Address) (*BroadcastClient, error) {
- port := listenerAddress.(*net.TCPAddr).Port
+func newTestBroadcastClient(config Config, listenerAddress net.Addr, chainId uint64, currentMessageCount arbutil.MessageIndex, txStreamer TransactionStreamerInterface, confirmedSequenceNumberListener chan arbutil.MessageIndex, feedErrChan chan error, validAddr *common.Address, t *testing.T) (*BroadcastClient, error) {
+ t.Helper()
+ port := testhelpers.AddrTCPPort(listenerAddress, t)
var av contracts.AddressVerifierInterface
if validAddr != nil {
config.Verify.AcceptSequencer = true
@@ -225,6 +218,7 @@ func startMakeBroadcastClient(ctx context.Context, t *testing.T, clientConfig Co
nil,
feedErrChan,
sequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
@@ -313,6 +307,7 @@ func TestServerClientDisconnect(t *testing.T) {
nil,
feedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
@@ -384,6 +379,7 @@ func TestBroadcastClientConfirmedMessage(t *testing.T) {
confirmedSequenceNumberListener,
feedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
@@ -456,6 +452,7 @@ func TestServerIncorrectChainId(t *testing.T) {
nil,
badFeedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
badBroadcastClient.Start(ctx)
@@ -515,6 +512,7 @@ func TestServerMissingChainId(t *testing.T) {
nil,
badFeedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
badBroadcastClient.Start(ctx)
@@ -572,6 +570,7 @@ func TestServerIncorrectFeedServerVersion(t *testing.T) {
nil,
badFeedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
badBroadcastClient.Start(ctx)
@@ -631,6 +630,7 @@ func TestServerMissingFeedServerVersion(t *testing.T) {
nil,
badFeedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
badBroadcastClient.Start(ctx)
@@ -682,6 +682,7 @@ func TestBroadcastClientReconnectsOnServerDisconnect(t *testing.T) {
nil,
feedErrChan,
&sequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
@@ -794,6 +795,7 @@ func connectAndGetCachedMessages(ctx context.Context, addr net.Addr, chainId uin
nil,
feedErrChan,
sequencerAddr,
+ t,
)
Require(t, err)
broadcastClient.Start(ctx)
diff --git a/broadcaster/backlog/backlog.go b/broadcaster/backlog/backlog.go
index b7b935fb7a..0897eedd10 100644
--- a/broadcaster/backlog/backlog.go
+++ b/broadcaster/backlog/backlog.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
m "github.com/offchainlabs/nitro/broadcaster/message"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/containers"
@@ -328,7 +329,13 @@ func newBacklogSegment() *backlogSegment {
func IsBacklogSegmentNil(segment BacklogSegment) bool {
if segment == nil {
return true
- } else if segment.(*backlogSegment) == nil {
+ }
+ bs, ok := segment.(*backlogSegment)
+ if !ok {
+ log.Error("error in backlogSegment type assertion: clearing backlog")
+ return false
+ }
+ if bs == nil {
return true
}
return false
diff --git a/broadcaster/message/message.go b/broadcaster/message/message.go
index 44befc56c0..999fde2a74 100644
--- a/broadcaster/message/message.go
+++ b/broadcaster/message/message.go
@@ -2,6 +2,7 @@ package message
import (
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/broadcaster/message/message_serialization_test.go b/broadcaster/message/message_serialization_test.go
index 56ffbc191c..b7a6bbefb5 100644
--- a/broadcaster/message/message_serialization_test.go
+++ b/broadcaster/message/message_serialization_test.go
@@ -10,6 +10,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
)
diff --git a/cmd/autonomous-auctioneer/config.go b/cmd/autonomous-auctioneer/config.go
index 74ca4340ed..bdb5479950 100644
--- a/cmd/autonomous-auctioneer/config.go
+++ b/cmd/autonomous-auctioneer/config.go
@@ -2,18 +2,19 @@ package main
import (
"fmt"
-
"reflect"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/timeboost"
"github.com/offchainlabs/nitro/util/colors"
- flag "github.com/spf13/pflag"
)
type AutonomousAuctioneerConfig struct {
diff --git a/cmd/autonomous-auctioneer/main.go b/cmd/autonomous-auctioneer/main.go
index e1e540c4a1..eb22d0e177 100644
--- a/cmd/autonomous-auctioneer/main.go
+++ b/cmd/autonomous-auctioneer/main.go
@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/exp"
"github.com/ethereum/go-ethereum/node"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
"github.com/offchainlabs/nitro/timeboost"
diff --git a/cmd/bidder-client/main.go b/cmd/bidder-client/main.go
index 133b27f498..722717b6bc 100644
--- a/cmd/bidder-client/main.go
+++ b/cmd/bidder-client/main.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
"github.com/offchainlabs/nitro/timeboost"
)
diff --git a/cmd/chaininfo/chain_defaults.go b/cmd/chaininfo/chain_defaults.go
new file mode 100644
index 0000000000..a69472cafc
--- /dev/null
+++ b/cmd/chaininfo/chain_defaults.go
@@ -0,0 +1,141 @@
+// Copyright 2021-2024, Offchain Labs, Inc.
+// For license information, see https://github.com/nitro/blob/master/LICENSE
+
+package chaininfo
+
+import (
+ "encoding/json"
+ "fmt"
+ "math/big"
+
+ "github.com/ethereum/go-ethereum/params"
+)
+
+var DefaultChainConfigs map[string]*params.ChainConfig
+
+func init() {
+ var chainsInfo []ChainInfo
+ err := json.Unmarshal(DefaultChainsInfoBytes, &chainsInfo)
+ if err != nil {
+ panic(fmt.Errorf("error initializing default chainsInfo: %w", err))
+ }
+ if len(chainsInfo) == 0 {
+ panic("Default chainsInfo is empty")
+ }
+ DefaultChainConfigs = make(map[string]*params.ChainConfig)
+ for _, chainInfo := range chainsInfo {
+ DefaultChainConfigs[chainInfo.ChainName] = chainInfo.ChainConfig
+ }
+}
+
+func CopyArbitrumChainParams(arbChainParams params.ArbitrumChainParams) params.ArbitrumChainParams {
+ return params.ArbitrumChainParams{
+ EnableArbOS: arbChainParams.EnableArbOS,
+ AllowDebugPrecompiles: arbChainParams.AllowDebugPrecompiles,
+ DataAvailabilityCommittee: arbChainParams.DataAvailabilityCommittee,
+ InitialArbOSVersion: arbChainParams.InitialArbOSVersion,
+ InitialChainOwner: arbChainParams.InitialChainOwner,
+ GenesisBlockNum: arbChainParams.GenesisBlockNum,
+ MaxCodeSize: arbChainParams.MaxCodeSize,
+ MaxInitCodeSize: arbChainParams.MaxInitCodeSize,
+ }
+}
+
+func CopyChainConfig(chainConfig *params.ChainConfig) *params.ChainConfig {
+ copy := ¶ms.ChainConfig{
+ DAOForkSupport: chainConfig.DAOForkSupport,
+ ArbitrumChainParams: CopyArbitrumChainParams(chainConfig.ArbitrumChainParams),
+ Clique: ¶ms.CliqueConfig{
+ Period: chainConfig.Clique.Period,
+ Epoch: chainConfig.Clique.Epoch,
+ },
+ }
+ if chainConfig.ChainID != nil {
+ copy.ChainID = new(big.Int).Set(chainConfig.ChainID)
+ }
+ if chainConfig.HomesteadBlock != nil {
+ copy.HomesteadBlock = new(big.Int).Set(chainConfig.HomesteadBlock)
+ }
+ if chainConfig.DAOForkBlock != nil {
+ copy.DAOForkBlock = new(big.Int).Set(chainConfig.DAOForkBlock)
+ }
+ if chainConfig.EIP150Block != nil {
+ copy.EIP150Block = new(big.Int).Set(chainConfig.EIP150Block)
+ }
+ if chainConfig.EIP155Block != nil {
+ copy.EIP155Block = new(big.Int).Set(chainConfig.EIP155Block)
+ }
+ if chainConfig.EIP158Block != nil {
+ copy.EIP158Block = new(big.Int).Set(chainConfig.EIP158Block)
+ }
+ if chainConfig.ByzantiumBlock != nil {
+ copy.ByzantiumBlock = new(big.Int).Set(chainConfig.ByzantiumBlock)
+ }
+ if chainConfig.ConstantinopleBlock != nil {
+ copy.ConstantinopleBlock = new(big.Int).Set(chainConfig.ConstantinopleBlock)
+ }
+ if chainConfig.PetersburgBlock != nil {
+ copy.PetersburgBlock = new(big.Int).Set(chainConfig.PetersburgBlock)
+ }
+ if chainConfig.IstanbulBlock != nil {
+ copy.IstanbulBlock = new(big.Int).Set(chainConfig.IstanbulBlock)
+ }
+ if chainConfig.MuirGlacierBlock != nil {
+ copy.MuirGlacierBlock = new(big.Int).Set(chainConfig.MuirGlacierBlock)
+ }
+ if chainConfig.BerlinBlock != nil {
+ copy.BerlinBlock = new(big.Int).Set(chainConfig.BerlinBlock)
+ }
+ if chainConfig.LondonBlock != nil {
+ copy.LondonBlock = new(big.Int).Set(chainConfig.LondonBlock)
+ }
+ return copy
+}
+
+func fetchArbitrumChainParams(chainName string) params.ArbitrumChainParams {
+ originalConfig, ok := DefaultChainConfigs[chainName]
+ if !ok {
+ panic(fmt.Sprintf("%s chain config not found in DefaultChainConfigs", chainName))
+ }
+ return CopyArbitrumChainParams(originalConfig.ArbitrumChainParams)
+}
+
+func ArbitrumOneParams() params.ArbitrumChainParams {
+ return fetchArbitrumChainParams("arb1")
+}
+func ArbitrumNovaParams() params.ArbitrumChainParams {
+ return fetchArbitrumChainParams("nova")
+}
+func ArbitrumRollupGoerliTestnetParams() params.ArbitrumChainParams {
+ return fetchArbitrumChainParams("goerli-rollup")
+}
+func ArbitrumDevTestParams() params.ArbitrumChainParams {
+ return fetchArbitrumChainParams("arb-dev-test")
+}
+func ArbitrumDevTestDASParams() params.ArbitrumChainParams {
+ return fetchArbitrumChainParams("anytrust-dev-test")
+}
+
+func fetchChainConfig(chainName string) *params.ChainConfig {
+ originalConfig, ok := DefaultChainConfigs[chainName]
+ if !ok {
+ panic(fmt.Sprintf("%s chain config not found in DefaultChainConfigs", chainName))
+ }
+ return CopyChainConfig(originalConfig)
+}
+
+func ArbitrumOneChainConfig() *params.ChainConfig {
+ return fetchChainConfig("arb1")
+}
+func ArbitrumNovaChainConfig() *params.ChainConfig {
+ return fetchChainConfig("nova")
+}
+func ArbitrumRollupGoerliTestnetChainConfig() *params.ChainConfig {
+ return fetchChainConfig("goerli-rollup")
+}
+func ArbitrumDevTestChainConfig() *params.ChainConfig {
+ return fetchChainConfig("arb-dev-test")
+}
+func ArbitrumDevTestDASChainConfig() *params.ChainConfig {
+ return fetchChainConfig("anytrust-dev-test")
+}
diff --git a/cmd/chaininfo/chain_defaults_test.go b/cmd/chaininfo/chain_defaults_test.go
new file mode 100644
index 0000000000..a19e5849a6
--- /dev/null
+++ b/cmd/chaininfo/chain_defaults_test.go
@@ -0,0 +1,17 @@
+// Copyright 2021-2024, Offchain Labs, Inc.
+// For license information, see https://github.com/nitro/blob/master/LICENSE
+
+package chaininfo
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestDefaultChainConfigsCopyCorrectly(t *testing.T) {
+ for _, chainName := range []string{"arb1", "nova", "goerli-rollup", "arb-dev-test", "anytrust-dev-test"} {
+ if !reflect.DeepEqual(DefaultChainConfigs[chainName], fetchChainConfig(chainName)) {
+ t.Fatalf("copy of %s default chain config mismatch", chainName)
+ }
+ }
+}
diff --git a/cmd/chaininfo/chain_info.go b/cmd/chaininfo/chain_info.go
index 13e586ced2..aa40d6514f 100644
--- a/cmd/chaininfo/chain_info.go
+++ b/cmd/chaininfo/chain_info.go
@@ -16,7 +16,7 @@ import (
)
//go:embed arbitrum_chain_info.json
-var DefaultChainInfo []byte
+var DefaultChainsInfoBytes []byte
type ChainInfo struct {
ChainName string `json:"chain-name"`
@@ -80,7 +80,7 @@ func ProcessChainInfo(chainId uint64, chainName string, l2ChainInfoFiles []strin
}
}
- chainInfo, err := findChainInfo(chainId, chainName, DefaultChainInfo)
+ chainInfo, err := findChainInfo(chainId, chainName, DefaultChainsInfoBytes)
if err != nil || chainInfo != nil {
return chainInfo, err
}
diff --git a/cmd/conf/chain.go b/cmd/conf/chain.go
index 28b06aad2b..435246e357 100644
--- a/cmd/conf/chain.go
+++ b/cmd/conf/chain.go
@@ -6,10 +6,11 @@ package conf
import (
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/util/rpcclient"
- flag "github.com/spf13/pflag"
)
type ParentChainConfig struct {
diff --git a/cmd/conf/database.go b/cmd/conf/database.go
index af18bacd57..8857b615f3 100644
--- a/cmd/conf/database.go
+++ b/cmd/conf/database.go
@@ -12,8 +12,9 @@ import (
"runtime"
"time"
- "github.com/ethereum/go-ethereum/ethdb/pebble"
flag "github.com/spf13/pflag"
+
+ "github.com/ethereum/go-ethereum/ethdb/pebble"
)
type PersistentConfig struct {
diff --git a/cmd/conf/init.go b/cmd/conf/init.go
index f01d99f8b7..cd2b6c8805 100644
--- a/cmd/conf/init.go
+++ b/cmd/conf/init.go
@@ -6,8 +6,9 @@ import (
"strings"
"time"
- "github.com/ethereum/go-ethereum/log"
"github.com/spf13/pflag"
+
+ "github.com/ethereum/go-ethereum/log"
)
type InitConfig struct {
@@ -20,6 +21,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"`
@@ -47,6 +49,7 @@ var InitConfigDefault = InitConfig{
DownloadPoll: time.Minute,
DevInit: false,
DevInitAddress: "",
+ DevMaxCodeSize: 0,
DevInitBlockNum: 0,
Empty: false,
ImportWasm: false,
@@ -75,6 +78,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")
diff --git a/cmd/dataavailability/data_availability_check.go b/cmd/dataavailability/data_availability_check.go
index d80c0475bf..e961215925 100644
--- a/cmd/dataavailability/data_availability_check.go
+++ b/cmd/dataavailability/data_availability_check.go
@@ -13,6 +13,8 @@ import (
"syscall"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@@ -27,8 +29,6 @@ import (
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/util/metricsutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
-
- flag "github.com/spf13/pflag"
)
// Data availability check is done to as to make sure that the data that is being stored by DAS is available at all time.
diff --git a/cmd/datool/datool.go b/cmd/datool/datool.go
index f791d8cbc4..06f94dc952 100644
--- a/cmd/datool/datool.go
+++ b/cmd/datool/datool.go
@@ -22,10 +22,10 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util"
-
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
"github.com/offchainlabs/nitro/das"
"github.com/offchainlabs/nitro/das/dastree"
diff --git a/cmd/dbconv/dbconv/config.go b/cmd/dbconv/dbconv/config.go
index 917f34261d..fdebda2d54 100644
--- a/cmd/dbconv/dbconv/config.go
+++ b/cmd/dbconv/dbconv/config.go
@@ -4,9 +4,10 @@ import (
"errors"
"fmt"
+ flag "github.com/spf13/pflag"
+
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/genericconf"
- flag "github.com/spf13/pflag"
)
type DBConfig struct {
diff --git a/cmd/dbconv/dbconv/dbconv.go b/cmd/dbconv/dbconv/dbconv.go
index 6a97df31c0..fdba1907c2 100644
--- a/cmd/dbconv/dbconv/dbconv.go
+++ b/cmd/dbconv/dbconv/dbconv.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/dbutil"
)
diff --git a/cmd/dbconv/main.go b/cmd/dbconv/main.go
index 2d61c96552..f5aaced40b 100644
--- a/cmd/dbconv/main.go
+++ b/cmd/dbconv/main.go
@@ -6,13 +6,15 @@ import (
"os"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/exp"
+
"github.com/offchainlabs/nitro/cmd/dbconv/dbconv"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
- flag "github.com/spf13/pflag"
)
func parseDBConv(args []string) (*dbconv.DBConvConfig, error) {
diff --git a/cmd/deploy/deploy.go b/cmd/deploy/deploy.go
index c70ceb1d94..a597799b06 100644
--- a/cmd/deploy/deploy.go
+++ b/cmd/deploy/deploy.go
@@ -14,20 +14,20 @@ import (
"strings"
"time"
- "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/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbnode"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
+ "github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util"
deploycode "github.com/offchainlabs/nitro/deploy"
+ "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
+ "github.com/offchainlabs/nitro/util/headerreader"
+ "github.com/offchainlabs/nitro/validator/server_common"
)
func main() {
diff --git a/cmd/genericconf/config.go b/cmd/genericconf/config.go
index 7c0c5034b3..408ba9a552 100644
--- a/cmd/genericconf/config.go
+++ b/cmd/genericconf/config.go
@@ -9,9 +9,10 @@ import (
"log/slog"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
- flag "github.com/spf13/pflag"
)
type ConfConfig struct {
diff --git a/cmd/genericconf/filehandler_test.go b/cmd/genericconf/filehandler_test.go
index daa9ed397c..7d24fbb69f 100644
--- a/cmd/genericconf/filehandler_test.go
+++ b/cmd/genericconf/filehandler_test.go
@@ -12,6 +12,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -55,7 +56,11 @@ func readLogMessagesFromJSONFile(t *testing.T, path string) ([]string, error) {
if !ok {
testhelpers.FailImpl(t, "Incorrect record, msg key is missing", "record", record)
}
- messages = append(messages, msg.(string))
+ msgString, ok := msg.(string)
+ if !ok {
+ testhelpers.FailImpl(t, "Incorrect record, msg is not a string", "record", record)
+ }
+ messages = append(messages, msgString)
}
if errors.Is(err, io.EOF) {
return messages, nil
diff --git a/cmd/genericconf/liveconfig.go b/cmd/genericconf/liveconfig.go
index 1054140e9e..f256fe6612 100644
--- a/cmd/genericconf/liveconfig.go
+++ b/cmd/genericconf/liveconfig.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/stopwaiter"
)
diff --git a/cmd/genericconf/logging.go b/cmd/genericconf/logging.go
index fa45953278..4cdaa5f3e8 100644
--- a/cmd/genericconf/logging.go
+++ b/cmd/genericconf/logging.go
@@ -8,8 +8,9 @@ import (
"os"
"sync"
- "github.com/ethereum/go-ethereum/log"
"gopkg.in/natefinch/lumberjack.v2"
+
+ "github.com/ethereum/go-ethereum/log"
)
var globalFileLoggerFactory = fileLoggerFactory{}
diff --git a/cmd/genericconf/pprof.go b/cmd/genericconf/pprof.go
index 9fd3a6f2a4..0bde03decd 100644
--- a/cmd/genericconf/pprof.go
+++ b/cmd/genericconf/pprof.go
@@ -3,7 +3,6 @@ package genericconf
import (
"fmt"
"net/http"
-
// Blank import pprof registers its HTTP handlers.
_ "net/http/pprof" // #nosec G108
diff --git a/cmd/nitro-val/config.go b/cmd/nitro-val/config.go
index 2adbe5e9aa..bca83277b3 100644
--- a/cmd/nitro-val/config.go
+++ b/cmd/nitro-val/config.go
@@ -2,19 +2,20 @@ package main
import (
"fmt"
-
"reflect"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/validator/valnode"
- flag "github.com/spf13/pflag"
)
type ValidationNodeConfig struct {
diff --git a/cmd/nitro/config_test.go b/cmd/nitro/config_test.go
index 9626893083..ef41d704f1 100644
--- a/cmd/nitro/config_test.go
+++ b/cmd/nitro/config_test.go
@@ -14,14 +14,14 @@ import (
"testing"
"time"
+ "github.com/r3labs/diff/v3"
+ flag "github.com/spf13/pflag"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
"github.com/offchainlabs/nitro/das"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/testhelpers"
-
- "github.com/r3labs/diff/v3"
- flag "github.com/spf13/pflag"
)
func TestEmptyCliConfig(t *testing.T) {
diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go
index f0b303817c..eb6d7df6fc 100644
--- a/cmd/nitro/init.go
+++ b/cmd/nitro/init.go
@@ -25,6 +25,7 @@ import (
"github.com/cavaliergopher/grab/v3"
"github.com/codeclysm/extract/v3"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
@@ -681,6 +682,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
Nonce: 0,
},
},
+ ChainOwner: common.HexToAddress(config.Init.DevInitAddress),
}
initDataReader = statetransfer.NewMemoryInitDataReader(&initData)
}
@@ -716,6 +718,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 {
diff --git a/cmd/nitro/init_test.go b/cmd/nitro/init_test.go
index 48d969f053..8e7afe369d 100644
--- a/cmd/nitro/init_test.go
+++ b/cmd/nitro/init_test.go
@@ -23,11 +23,13 @@ import (
"testing"
"time"
+ "github.com/google/go-cmp/cmp"
+
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/node"
- "github.com/google/go-cmp/cmp"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/cmd/conf"
diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go
index 228868db4a..5e94bb0abb 100644
--- a/cmd/nitro/nitro.go
+++ b/cmd/nitro/nitro.go
@@ -466,28 +466,29 @@ func mainImpl() int {
fatalErrChan := make(chan error, 10)
- var blocksReExecutor *blocksreexecutor.BlocksReExecutor
if nodeConfig.BlocksReExecutor.Enable && l2BlockChain != nil {
- blocksReExecutor, err = blocksreexecutor.New(&nodeConfig.BlocksReExecutor, l2BlockChain, chainDb, fatalErrChan)
+ if !nodeConfig.Init.ThenQuit {
+ log.Error("blocks-reexecutor cannot be enabled without --init.then-quit")
+ return 1
+ }
+ blocksReExecutor, err := blocksreexecutor.New(&nodeConfig.BlocksReExecutor, l2BlockChain, chainDb, fatalErrChan)
if err != nil {
log.Error("error initializing blocksReExecutor", "err", err)
return 1
}
- if nodeConfig.Init.ThenQuit {
- if err := gethexec.PopulateStylusTargetCache(&nodeConfig.Execution.StylusTarget); err != nil {
- log.Error("error populating stylus target cache", "err", err)
- return 1
- }
- success := make(chan struct{})
- blocksReExecutor.Start(ctx, success)
- deferFuncs = append(deferFuncs, func() { blocksReExecutor.StopAndWait() })
- select {
- case err := <-fatalErrChan:
- log.Error("shutting down due to fatal error", "err", err)
- defer log.Error("shut down due to fatal error", "err", err)
- return 1
- case <-success:
- }
+ if err := gethexec.PopulateStylusTargetCache(&nodeConfig.Execution.StylusTarget); err != nil {
+ log.Error("error populating stylus target cache", "err", err)
+ return 1
+ }
+ success := make(chan struct{})
+ blocksReExecutor.Start(ctx, success)
+ deferFuncs = append(deferFuncs, func() { blocksReExecutor.StopAndWait() })
+ select {
+ case err := <-fatalErrChan:
+ log.Error("shutting down due to fatal error", "err", err)
+ defer log.Error("shut down due to fatal error", "err", err)
+ return 1
+ case <-success:
}
}
@@ -639,10 +640,6 @@ func mainImpl() int {
// remove previous deferFuncs, StopAndWait closes database and blockchain.
deferFuncs = []func(){func() { currentNode.StopAndWait() }}
}
- if blocksReExecutor != nil && !nodeConfig.Init.ThenQuit {
- blocksReExecutor.Start(ctx, nil)
- deferFuncs = append(deferFuncs, func() { blocksReExecutor.StopAndWait() })
- }
sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)
@@ -660,6 +657,8 @@ func mainImpl() int {
if execNodeConfig.Sequencer.Enable && execNodeConfig.Sequencer.Timeboost.Enable {
execNode.Sequencer.StartExpressLane(
ctx,
+ execNode.Backend.APIBackend(),
+ execNode.FilterSystem,
common.HexToAddress(execNodeConfig.Sequencer.Timeboost.AuctionContractAddress),
common.HexToAddress(execNodeConfig.Sequencer.Timeboost.AuctioneerAddress))
}
diff --git a/cmd/pruning/pruning.go b/cmd/pruning/pruning.go
index 0755f5ff9e..e89c79bc89 100644
--- a/cmd/pruning/pruning.go
+++ b/cmd/pruning/pruning.go
@@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
"github.com/offchainlabs/nitro/arbutil"
diff --git a/cmd/replay/db.go b/cmd/replay/db.go
index 7147c48f75..3dc9f15da0 100644
--- a/cmd/replay/db.go
+++ b/cmd/replay/db.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/wavmio"
)
diff --git a/cmd/seq-coordinator-manager/rediscoordinator/redis_coordinator.go b/cmd/seq-coordinator-manager/rediscoordinator/redis_coordinator.go
index b897b23252..b6b5342ca2 100644
--- a/cmd/seq-coordinator-manager/rediscoordinator/redis_coordinator.go
+++ b/cmd/seq-coordinator-manager/rediscoordinator/redis_coordinator.go
@@ -5,8 +5,9 @@ import (
"errors"
"strings"
- "github.com/offchainlabs/nitro/util/redisutil"
"github.com/redis/go-redis/v9"
+
+ "github.com/offchainlabs/nitro/util/redisutil"
)
// RedisCoordinator builds upon RedisCoordinator of redisutil with additional functionality
diff --git a/cmd/seq-coordinator-manager/seq-coordinator-manager.go b/cmd/seq-coordinator-manager/seq-coordinator-manager.go
index 43d90441ef..7b5dc68699 100644
--- a/cmd/seq-coordinator-manager/seq-coordinator-manager.go
+++ b/cmd/seq-coordinator-manager/seq-coordinator-manager.go
@@ -7,11 +7,13 @@ import (
"strconv"
"github.com/enescakir/emoji"
- "github.com/ethereum/go-ethereum/log"
"github.com/gdamore/tcell/v2"
+ "github.com/rivo/tview"
+
+ "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/cmd/seq-coordinator-manager/rediscoordinator"
"github.com/offchainlabs/nitro/util/redisutil"
- "github.com/rivo/tview"
)
// Tview
diff --git a/cmd/util/confighelpers/configuration.go b/cmd/util/confighelpers/configuration.go
index 19b5b1a24c..8c4ef2a70b 100644
--- a/cmd/util/confighelpers/configuration.go
+++ b/cmd/util/confighelpers/configuration.go
@@ -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
}
diff --git a/das/aggregator_test.go b/das/aggregator_test.go
index 4bc209513e..217315eef0 100644
--- a/das/aggregator_test.go
+++ b/das/aggregator_test.go
@@ -16,10 +16,10 @@ import (
"testing"
"time"
+ "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/blsSignatures"
-
- "github.com/ethereum/go-ethereum/log"
)
func TestDAS_BasicAggregationLocal(t *testing.T) {
diff --git a/das/cache_storage_service.go b/das/cache_storage_service.go
index 439ccda086..0ba20ac55b 100644
--- a/das/cache_storage_service.go
+++ b/das/cache_storage_service.go
@@ -7,14 +7,15 @@ import (
"context"
"fmt"
- "github.com/offchainlabs/nitro/arbstate/daprovider"
- "github.com/offchainlabs/nitro/das/dastree"
- "github.com/offchainlabs/nitro/util/pretty"
flag "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
"github.com/ethereum/go-ethereum/log"
+
+ "github.com/offchainlabs/nitro/arbstate/daprovider"
+ "github.com/offchainlabs/nitro/das/dastree"
+ "github.com/offchainlabs/nitro/util/pretty"
)
type CacheConfig struct {
diff --git a/das/chain_fetch_das.go b/das/chain_fetch_das.go
index 4de6c981cf..34b10d45ec 100644
--- a/das/chain_fetch_das.go
+++ b/das/chain_fetch_das.go
@@ -8,14 +8,14 @@ import (
"errors"
"sync"
- "github.com/offchainlabs/nitro/util/pretty"
-
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
+ "github.com/offchainlabs/nitro/util/pretty"
)
type syncedKeysetCache struct {
diff --git a/das/das.go b/das/das.go
index 0b03c05ad6..e870761ac2 100644
--- a/das/das.go
+++ b/das/das.go
@@ -10,10 +10,11 @@ import (
"math"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
- flag "github.com/spf13/pflag"
"github.com/offchainlabs/nitro/arbstate/daprovider"
)
diff --git a/das/dasRpcClient.go b/das/dasRpcClient.go
index d6e2c389c9..3ea6c4e2c6 100644
--- a/das/dasRpcClient.go
+++ b/das/dasRpcClient.go
@@ -9,13 +9,14 @@ import (
"strings"
"time"
+ "golang.org/x/sync/errgroup"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
- "golang.org/x/sync/errgroup"
-
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/blsSignatures"
"github.com/offchainlabs/nitro/util/pretty"
diff --git a/das/dasRpcServer.go b/das/dasRpcServer.go
index bb1be0384e..adddf26571 100644
--- a/das/dasRpcServer.go
+++ b/das/dasRpcServer.go
@@ -17,7 +17,6 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
-
"github.com/ethereum/go-ethereum/rpc"
"github.com/offchainlabs/nitro/blsSignatures"
diff --git a/das/dastree/dastree.go b/das/dastree/dastree.go
index 2bcbccaae3..29a6b2495c 100644
--- a/das/dastree/dastree.go
+++ b/das/dastree/dastree.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/das/dastree/dastree_test.go b/das/dastree/dastree_test.go
index 4d24c9ae98..b24d6ce69b 100644
--- a/das/dastree/dastree_test.go
+++ b/das/dastree/dastree_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/pretty"
diff --git a/das/db_storage_service.go b/das/db_storage_service.go
index 74bf12b927..0e38505a13 100644
--- a/das/db_storage_service.go
+++ b/das/db_storage_service.go
@@ -14,13 +14,15 @@ import (
"time"
badger "github.com/dgraph-io/badger/v4"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/util/pretty"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
type LocalDBStorageConfig struct {
diff --git a/das/fallback_storage_service.go b/das/fallback_storage_service.go
index 0a451678d0..64bc3c2a7a 100644
--- a/das/fallback_storage_service.go
+++ b/das/fallback_storage_service.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/das/fallback_storage_service_test.go b/das/fallback_storage_service_test.go
index b73df31624..4c7c0351e9 100644
--- a/das/fallback_storage_service_test.go
+++ b/das/fallback_storage_service_test.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common/math"
+
"github.com/offchainlabs/nitro/das/dastree"
)
diff --git a/das/google_cloud_storage_service_test.go b/das/google_cloud_storage_service_test.go
index 799d999bad..94d6f3ee44 100644
--- a/das/google_cloud_storage_service_test.go
+++ b/das/google_cloud_storage_service_test.go
@@ -2,13 +2,16 @@ package das
import (
"bytes"
- googlestorage "cloud.google.com/go/storage"
"context"
"errors"
- "github.com/ethereum/go-ethereum/common"
- "github.com/offchainlabs/nitro/das/dastree"
"testing"
"time"
+
+ googlestorage "cloud.google.com/go/storage"
+
+ "github.com/ethereum/go-ethereum/common"
+
+ "github.com/offchainlabs/nitro/das/dastree"
)
type mockGCSClient struct {
diff --git a/das/key_utils.go b/das/key_utils.go
index 33f29788b6..0262e7f666 100644
--- a/das/key_utils.go
+++ b/das/key_utils.go
@@ -11,6 +11,7 @@ import (
"os"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/blsSignatures"
)
diff --git a/das/local_file_storage_service.go b/das/local_file_storage_service.go
index 5e64c34b10..71c98c7879 100644
--- a/das/local_file_storage_service.go
+++ b/das/local_file_storage_service.go
@@ -20,14 +20,16 @@ import (
"syscall"
"time"
+ flag "github.com/spf13/pflag"
+ "golang.org/x/sys/unix"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/util/pretty"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
- "golang.org/x/sys/unix"
)
type LocalFileStorageConfig struct {
diff --git a/das/memory_backed_storage_service.go b/das/memory_backed_storage_service.go
index c013b501b9..8a2df28902 100644
--- a/das/memory_backed_storage_service.go
+++ b/das/memory_backed_storage_service.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
)
diff --git a/das/panic_wrapper.go b/das/panic_wrapper.go
index 3530cb651d..4729792c33 100644
--- a/das/panic_wrapper.go
+++ b/das/panic_wrapper.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
)
diff --git a/das/reader_aggregator_strategies_test.go b/das/reader_aggregator_strategies_test.go
index cdb85b25e9..e211ee38fe 100644
--- a/das/reader_aggregator_strategies_test.go
+++ b/das/reader_aggregator_strategies_test.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
)
@@ -72,8 +73,10 @@ func TestDAS_SimpleExploreExploit(t *testing.T) {
}
for i := 0; i < len(was) && doMatch; i++ {
- if expected[i].(*dummyReader).int != was[i].(*dummyReader).int {
- Fail(t, fmt.Sprintf("expected %d, was %d", expected[i].(*dummyReader).int, was[i].(*dummyReader).int))
+ expR, expOK := expected[i].(*dummyReader)
+ wasR, wasOK := was[i].(*dummyReader)
+ if !expOK || !wasOK || expR.int != wasR.int {
+ Fail(t, fmt.Sprintf("expected %d, was %d", expected[i], was[i]))
}
}
}
diff --git a/das/redis_storage_service.go b/das/redis_storage_service.go
index e57240992c..cdd18ea974 100644
--- a/das/redis_storage_service.go
+++ b/das/redis_storage_service.go
@@ -10,17 +10,17 @@ import (
"fmt"
"time"
+ "github.com/redis/go-redis/v9"
+ flag "github.com/spf13/pflag"
"golang.org/x/crypto/sha3"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/util/pretty"
"github.com/offchainlabs/nitro/util/redisutil"
- "github.com/redis/go-redis/v9"
- flag "github.com/spf13/pflag"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/log"
)
type RedisConfig struct {
diff --git a/das/redis_storage_service_test.go b/das/redis_storage_service_test.go
index 77d3e8cd0f..41ca6bac90 100644
--- a/das/redis_storage_service_test.go
+++ b/das/redis_storage_service_test.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/alicebob/miniredis/v2"
+
"github.com/offchainlabs/nitro/das/dastree"
)
diff --git a/das/redundant_storage_service.go b/das/redundant_storage_service.go
index 3158d28076..85274188d6 100644
--- a/das/redundant_storage_service.go
+++ b/das/redundant_storage_service.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/util/pretty"
)
diff --git a/das/restful_client.go b/das/restful_client.go
index b65426e7cd..3004ea1b59 100644
--- a/das/restful_client.go
+++ b/das/restful_client.go
@@ -14,6 +14,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
)
diff --git a/das/restful_server.go b/das/restful_server.go
index b1607729e2..6c5e2ec453 100644
--- a/das/restful_server.go
+++ b/das/restful_server.go
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/util/pretty"
diff --git a/das/rpc_aggregator.go b/das/rpc_aggregator.go
index 9cf481e015..916637aac6 100644
--- a/das/rpc_aggregator.go
+++ b/das/rpc_aggregator.go
@@ -14,14 +14,15 @@ import (
"github.com/knadh/koanf"
"github.com/knadh/koanf/providers/confmap"
+
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/ethclient"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/blsSignatures"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/util/metricsutil"
"github.com/offchainlabs/nitro/util/signature"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/ethclient"
)
type BackendConfig struct {
diff --git a/das/rpc_test.go b/das/rpc_test.go
index 370ec0a872..ebc4b736d5 100644
--- a/das/rpc_test.go
+++ b/das/rpc_test.go
@@ -14,6 +14,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/blsSignatures"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/util/signature"
diff --git a/das/s3_storage_service.go b/das/s3_storage_service.go
index d251f12214..4c0dcaf5a3 100644
--- a/das/s3_storage_service.go
+++ b/das/s3_storage_service.go
@@ -16,14 +16,14 @@ import (
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
- "github.com/offchainlabs/nitro/arbstate/daprovider"
- "github.com/offchainlabs/nitro/das/dastree"
- "github.com/offchainlabs/nitro/util/pretty"
+ flag "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
- flag "github.com/spf13/pflag"
+ "github.com/offchainlabs/nitro/arbstate/daprovider"
+ "github.com/offchainlabs/nitro/das/dastree"
+ "github.com/offchainlabs/nitro/util/pretty"
)
type S3Uploader interface {
diff --git a/das/signature_verifier.go b/das/signature_verifier.go
index 0aa42bceb6..453b2fe305 100644
--- a/das/signature_verifier.go
+++ b/das/signature_verifier.go
@@ -11,6 +11,7 @@ import (
"os"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/util/contracts"
)
diff --git a/das/simple_das_reader_aggregator.go b/das/simple_das_reader_aggregator.go
index f45c56afe0..ff28d6a22a 100644
--- a/das/simple_das_reader_aggregator.go
+++ b/das/simple_das_reader_aggregator.go
@@ -12,13 +12,15 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/util/pretty"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
// Most of the time we will use the SimpleDASReaderAggregator only to aggregate
diff --git a/das/storage_service.go b/das/storage_service.go
index b7526077e9..925bbb520a 100644
--- a/das/storage_service.go
+++ b/das/storage_service.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
)
diff --git a/das/syncing_fallback_storage.go b/das/syncing_fallback_storage.go
index 0670a29c73..1aec2b7328 100644
--- a/das/syncing_fallback_storage.go
+++ b/das/syncing_fallback_storage.go
@@ -12,6 +12,8 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -19,13 +21,13 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
var sequencerInboxABI *abi.ABI
diff --git a/das/util.go b/das/util.go
index 114e075e79..cd300175bb 100644
--- a/das/util.go
+++ b/das/util.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/util/pretty"
)
diff --git a/deploy/deploy.go b/deploy/deploy.go
index bb4b2e6594..2738373c72 100644
--- a/deploy/deploy.go
+++ b/deploy/deploy.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/solgen/go/challengegen"
diff --git a/execution/gethexec/api.go b/execution/gethexec/api.go
index 9f94df0489..a11cc91d86 100644
--- a/execution/gethexec/api.go
+++ b/execution/gethexec/api.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/timeboost"
diff --git a/execution/gethexec/arb_interface.go b/execution/gethexec/arb_interface.go
index 7e43338f08..375d650359 100644
--- a/execution/gethexec/arb_interface.go
+++ b/execution/gethexec/arb_interface.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/timeboost"
)
diff --git a/execution/gethexec/block_recorder.go b/execution/gethexec/block_recorder.go
index 6f30e16e5c..2e3d51fec9 100644
--- a/execution/gethexec/block_recorder.go
+++ b/execution/gethexec/block_recorder.go
@@ -6,18 +6,20 @@ import (
"sync"
"testing"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
- flag "github.com/spf13/pflag"
)
// BlockRecorder uses a separate statedatabase from the blockchain.
diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go
index fda8f49093..53b494a3c2 100644
--- a/execution/gethexec/blockchain.go
+++ b/execution/gethexec/blockchain.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
diff --git a/execution/gethexec/executionengine.go b/execution/gethexec/executionengine.go
index de58fbc055..800cffe989 100644
--- a/execution/gethexec/executionengine.go
+++ b/execution/gethexec/executionengine.go
@@ -12,6 +12,7 @@ package gethexec
#include "arbitrator.h"
*/
import "C"
+
import (
"bytes"
"context"
@@ -26,6 +27,8 @@ import (
"testing"
"time"
+ "github.com/google/uuid"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
@@ -33,14 +36,14 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
- "github.com/ethereum/go-ethereum/params"
- "github.com/google/uuid"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/arbutil"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/sharedmetrics"
@@ -921,7 +924,7 @@ func (s *ExecutionEngine) digestMessageWithBlockMutex(num arbutil.MessageIndex,
timestamp = time.Unix(int64(timestampInt), 0)
timeUntilUpgrade = time.Until(timestamp)
}
- maxSupportedVersion := params.ArbitrumDevTestChainConfig().ArbitrumChainParams.InitialArbOSVersion
+ maxSupportedVersion := chaininfo.ArbitrumDevTestChainConfig().ArbitrumChainParams.InitialArbOSVersion
logLevel := log.Warn
if timeUntilUpgrade < time.Hour*24 {
logLevel = log.Error
diff --git a/execution/gethexec/express_lane_service.go b/execution/gethexec/express_lane_service.go
index 2505afaebe..a5618ee719 100644
--- a/execution/gethexec/express_lane_service.go
+++ b/execution/gethexec/express_lane_service.go
@@ -6,24 +6,32 @@ package gethexec
import (
"context"
"fmt"
+ "math"
+ "math/big"
"sync"
"time"
+ "github.com/pkg/errors"
+
+ "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
+ "github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethclient"
+ "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+ "github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/solgen/go/express_lane_auctiongen"
"github.com/offchainlabs/nitro/timeboost"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/pkg/errors"
)
type expressLaneControl struct {
@@ -31,35 +39,110 @@ type expressLaneControl struct {
controller common.Address
}
+type transactionPublisher interface {
+ PublishTimeboostedTransaction(context.Context, *types.Transaction, *arbitrum_types.ConditionalOptions) error
+}
+
type expressLaneService struct {
stopwaiter.StopWaiter
sync.RWMutex
+ transactionPublisher transactionPublisher
auctionContractAddr common.Address
+ apiBackend *arbitrum.APIBackend
initialTimestamp time.Time
roundDuration time.Duration
auctionClosing time.Duration
chainConfig *params.ChainConfig
logs chan []*types.Log
- seqClient *ethclient.Client
auctionContract *express_lane_auctiongen.ExpressLaneAuction
- roundControl *lru.Cache[uint64, *expressLaneControl]
+ roundControl *lru.Cache[uint64, *expressLaneControl] // thread safe
messagesBySequenceNumber map[uint64]*timeboost.ExpressLaneSubmission
}
+type contractAdapter struct {
+ *filters.FilterAPI
+ bind.ContractTransactor // We leave this member unset as it is not used.
+
+ apiBackend *arbitrum.APIBackend
+}
+
+func (a *contractAdapter) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) {
+ logPointers, err := a.GetLogs(ctx, filters.FilterCriteria(q))
+ if err != nil {
+ return nil, err
+ }
+ logs := make([]types.Log, 0, len(logPointers))
+ for _, log := range logPointers {
+ logs = append(logs, *log)
+ }
+ return logs, nil
+}
+
+func (a *contractAdapter) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
+ panic("contractAdapter doesn't implement SubscribeFilterLogs - shouldn't be needed")
+}
+
+func (a *contractAdapter) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) {
+ panic("contractAdapter doesn't implement CodeAt - shouldn't be needed")
+}
+
+func (a *contractAdapter) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
+ var num rpc.BlockNumber = rpc.LatestBlockNumber
+ if blockNumber != nil {
+ num = rpc.BlockNumber(blockNumber.Int64())
+ }
+
+ state, header, err := a.apiBackend.StateAndHeaderByNumber(ctx, num)
+ if err != nil {
+ return nil, err
+ }
+
+ msg := &core.Message{
+ From: call.From,
+ To: call.To,
+ Value: big.NewInt(0),
+ GasLimit: math.MaxUint64,
+ GasPrice: big.NewInt(0),
+ GasFeeCap: big.NewInt(0),
+ GasTipCap: big.NewInt(0),
+ Data: call.Data,
+ AccessList: call.AccessList,
+ SkipAccountChecks: true,
+ TxRunMode: core.MessageEthcallMode, // Indicate this is an eth_call
+ SkipL1Charging: true, // Skip L1 data fees
+ }
+
+ evm := a.apiBackend.GetEVM(ctx, msg, state, header, &vm.Config{NoBaseFee: true}, nil)
+ gp := new(core.GasPool).AddGas(math.MaxUint64)
+ result, err := core.ApplyMessage(evm, msg, gp)
+ if err != nil {
+ return nil, err
+ }
+
+ return result.ReturnData, nil
+}
+
func newExpressLaneService(
+ transactionPublisher transactionPublisher,
+ apiBackend *arbitrum.APIBackend,
+ filterSystem *filters.FilterSystem,
auctionContractAddr common.Address,
- sequencerClient *ethclient.Client,
bc *core.BlockChain,
) (*expressLaneService, error) {
chainConfig := bc.Config()
- auctionContract, err := express_lane_auctiongen.NewExpressLaneAuction(auctionContractAddr, sequencerClient)
+
+ var contractBackend bind.ContractBackend = &contractAdapter{filters.NewFilterAPI(filterSystem), nil, apiBackend}
+
+ auctionContract, err := express_lane_auctiongen.NewExpressLaneAuction(auctionContractAddr, contractBackend)
if err != nil {
return nil, err
}
retries := 0
+
pending:
- roundTimingInfo, err := auctionContract.RoundTimingInfo(&bind.CallOpts{})
+ var roundTimingInfo timeboost.RoundTimingInfo
+ roundTimingInfo, err = auctionContract.RoundTimingInfo(&bind.CallOpts{})
if err != nil {
const maxRetries = 5
if errors.Is(err, bind.ErrNoCode) && retries < maxRetries {
@@ -71,18 +154,22 @@ pending:
}
return nil, err
}
+ if err = roundTimingInfo.Validate(nil); err != nil {
+ return nil, err
+ }
initialTimestamp := time.Unix(roundTimingInfo.OffsetTimestamp, 0)
roundDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.RoundDurationSeconds) * time.Second
auctionClosingDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.AuctionClosingSeconds) * time.Second
return &expressLaneService{
+ transactionPublisher: transactionPublisher,
auctionContract: auctionContract,
+ apiBackend: apiBackend,
chainConfig: chainConfig,
initialTimestamp: initialTimestamp,
auctionClosing: auctionClosingDuration,
roundControl: lru.NewCache[uint64, *expressLaneControl](8), // Keep 8 rounds cached.
auctionContractAddr: auctionContractAddr,
roundDuration: roundDuration,
- seqClient: sequencerClient,
logs: make(chan []*types.Log, 10_000),
messagesBySequenceNumber: make(map[uint64]*timeboost.ExpressLaneSubmission),
}, nil
@@ -94,11 +181,18 @@ func (es *expressLaneService) Start(ctxIn context.Context) {
// Log every new express lane auction round.
es.LaunchThread(func(ctx context.Context) {
log.Info("Watching for new express lane rounds")
- now := time.Now()
- waitTime := es.roundDuration - time.Duration(now.Second())*time.Second - time.Duration(now.Nanosecond())
- time.Sleep(waitTime)
- ticker := time.NewTicker(time.Minute)
+ waitTime := timeboost.TimeTilNextRound(es.initialTimestamp, es.roundDuration)
+ // Wait until the next round starts
+ select {
+ case <-ctx.Done():
+ return
+ case <-time.After(waitTime):
+ // First tick happened, now set up regular ticks
+ }
+
+ ticker := time.NewTicker(es.roundDuration)
defer ticker.Stop()
+
for {
select {
case <-ctx.Done():
@@ -121,7 +215,7 @@ func (es *expressLaneService) Start(ctxIn context.Context) {
log.Info("Monitoring express lane auction contract")
// Monitor for auction resolutions from the auction manager smart contract
// and set the express lane controller for the upcoming round accordingly.
- latestBlock, err := es.seqClient.HeaderByNumber(ctx, nil)
+ latestBlock, err := es.apiBackend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
if err != nil {
// TODO: Should not be a crit.
log.Crit("Could not get latest header", "err", err)
@@ -132,7 +226,7 @@ func (es *expressLaneService) Start(ctxIn context.Context) {
case <-ctx.Done():
return
case <-time.After(time.Millisecond * 250):
- latestBlock, err := es.seqClient.HeaderByNumber(ctx, nil)
+ latestBlock, err := es.apiBackend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
if err != nil {
log.Crit("Could not get latest header", "err", err)
}
@@ -194,8 +288,6 @@ func (es *expressLaneService) Start(ctxIn context.Context) {
}
func (es *expressLaneService) currentRoundHasController() bool {
- es.Lock()
- defer es.Unlock()
currRound := timeboost.CurrentRound(es.initialTimestamp, es.roundDuration)
control, ok := es.roundControl.Get(currRound)
if !ok {
@@ -220,19 +312,15 @@ func (es *expressLaneService) isWithinAuctionCloseWindow(arrivalTime time.Time)
func (es *expressLaneService) sequenceExpressLaneSubmission(
ctx context.Context,
msg *timeboost.ExpressLaneSubmission,
- publishTxFn func(
- parentCtx context.Context,
- tx *types.Transaction,
- options *arbitrum_types.ConditionalOptions,
- delay bool,
- ) error,
) error {
- es.Lock()
- defer es.Unlock()
+ // no service lock needed since roundControl is thread-safe
control, ok := es.roundControl.Get(msg.Round)
if !ok {
return timeboost.ErrNoOnchainController
}
+
+ es.Lock()
+ defer es.Unlock()
// Check if the submission nonce is too low.
if msg.SequenceNumber < control.sequence {
return timeboost.ErrSequenceNumberTooLow
@@ -243,7 +331,7 @@ func (es *expressLaneService) sequenceExpressLaneSubmission(
}
// Log an informational warning if the message's sequence number is in the future.
if msg.SequenceNumber > control.sequence {
- log.Warn("Received express lane submission with future sequence number", "SequenceNumber", msg.SequenceNumber)
+ log.Info("Received express lane submission with future sequence number", "SequenceNumber", msg.SequenceNumber)
}
// Put into the sequence number map.
es.messagesBySequenceNumber[msg.SequenceNumber] = msg
@@ -254,11 +342,10 @@ func (es *expressLaneService) sequenceExpressLaneSubmission(
if !exists {
break
}
- if err := publishTxFn(
+ if err := es.transactionPublisher.PublishTimeboostedTransaction(
ctx,
nextMsg.Transaction,
msg.Options,
- false, /* no delay, as it should go through express lane */
); err != nil {
// If the tx failed, clear it from the sequence map.
delete(es.messagesBySequenceNumber, msg.SequenceNumber)
@@ -281,13 +368,13 @@ func (es *expressLaneService) validateExpressLaneTx(msg *timeboost.ExpressLaneSu
if msg.AuctionContractAddress != es.auctionContractAddr {
return errors.Wrapf(timeboost.ErrWrongAuctionContract, "msg auction contract address %s does not match sequencer auction contract address %s", msg.AuctionContractAddress, es.auctionContractAddr)
}
- if !es.currentRoundHasController() {
- return timeboost.ErrNoOnchainController
- }
currentRound := timeboost.CurrentRound(es.initialTimestamp, es.roundDuration)
if msg.Round != currentRound {
return errors.Wrapf(timeboost.ErrBadRoundNumber, "express lane tx round %d does not match current round %d", msg.Round, currentRound)
}
+ if !es.currentRoundHasController() {
+ return timeboost.ErrNoOnchainController
+ }
// Reconstruct the message being signed over and recover the sender address.
signingMessage, err := msg.ToMessageBytes()
if err != nil {
diff --git a/execution/gethexec/express_lane_service_test.go b/execution/gethexec/express_lane_service_test.go
index 7b01dc757e..bbb2c3c240 100644
--- a/execution/gethexec/express_lane_service_test.go
+++ b/execution/gethexec/express_lane_service_test.go
@@ -12,14 +12,16 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/timeboost"
- "github.com/stretchr/testify/require"
)
var testPriv *ecdsa.PrivateKey
@@ -231,6 +233,28 @@ func Test_expressLaneService_validateExpressLaneTx(t *testing.T) {
}
}
+type stubPublisher struct {
+ els *expressLaneService
+ publishedTxOrder []uint64
+}
+
+func makeStubPublisher(els *expressLaneService) *stubPublisher {
+ return &stubPublisher{
+ els: els,
+ publishedTxOrder: make([]uint64, 0),
+ }
+}
+
+func (s *stubPublisher) PublishTimeboostedTransaction(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions) error {
+ if tx == nil {
+ return errors.New("oops, bad tx")
+ }
+ control, _ := s.els.roundControl.Get(0)
+ s.publishedTxOrder = append(s.publishedTxOrder, control.sequence)
+ return nil
+
+}
+
func Test_expressLaneService_sequenceExpressLaneSubmission_nonceTooLow(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -238,16 +262,16 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_nonceTooLow(t *testin
messagesBySequenceNumber: make(map[uint64]*timeboost.ExpressLaneSubmission),
roundControl: lru.NewCache[uint64, *expressLaneControl](8),
}
+ stubPublisher := makeStubPublisher(els)
+ els.transactionPublisher = stubPublisher
els.roundControl.Add(0, &expressLaneControl{
sequence: 1,
})
msg := &timeboost.ExpressLaneSubmission{
SequenceNumber: 0,
}
- publishFn := func(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, delay bool) error {
- return nil
- }
- err := els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+
+ err := els.sequenceExpressLaneSubmission(ctx, msg)
require.ErrorIs(t, err, timeboost.ErrSequenceNumberTooLow)
}
@@ -258,24 +282,21 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_duplicateNonce(t *tes
roundControl: lru.NewCache[uint64, *expressLaneControl](8),
messagesBySequenceNumber: make(map[uint64]*timeboost.ExpressLaneSubmission),
}
+ stubPublisher := makeStubPublisher(els)
+ els.transactionPublisher = stubPublisher
els.roundControl.Add(0, &expressLaneControl{
sequence: 1,
})
msg := &timeboost.ExpressLaneSubmission{
SequenceNumber: 2,
}
- numPublished := 0
- publishFn := func(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, delay bool) error {
- numPublished += 1
- return nil
- }
- err := els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+ err := els.sequenceExpressLaneSubmission(ctx, msg)
require.NoError(t, err)
// Because the message is for a future sequence number, it
// should get queued, but not yet published.
- require.Equal(t, 0, numPublished)
+ require.Equal(t, 0, len(stubPublisher.publishedTxOrder))
// Sending it again should give us an error.
- err = els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+ err = els.sequenceExpressLaneSubmission(ctx, msg)
require.ErrorIs(t, err, timeboost.ErrDuplicateSequenceNumber)
}
@@ -286,45 +307,46 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_outOfOrder(t *testing
roundControl: lru.NewCache[uint64, *expressLaneControl](8),
messagesBySequenceNumber: make(map[uint64]*timeboost.ExpressLaneSubmission),
}
+ stubPublisher := makeStubPublisher(els)
+ els.transactionPublisher = stubPublisher
+
els.roundControl.Add(0, &expressLaneControl{
sequence: 1,
})
- numPublished := 0
- publishedTxOrder := make([]uint64, 0)
- control, _ := els.roundControl.Get(0)
- publishFn := func(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, delay bool) error {
- numPublished += 1
- publishedTxOrder = append(publishedTxOrder, control.sequence)
- return nil
- }
+
messages := []*timeboost.ExpressLaneSubmission{
{
SequenceNumber: 10,
+ Transaction: &types.Transaction{},
},
{
SequenceNumber: 5,
+ Transaction: &types.Transaction{},
},
{
SequenceNumber: 1,
+ Transaction: &types.Transaction{},
},
{
SequenceNumber: 4,
+ Transaction: &types.Transaction{},
},
{
SequenceNumber: 2,
+ Transaction: &types.Transaction{},
},
}
for _, msg := range messages {
- err := els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+ err := els.sequenceExpressLaneSubmission(ctx, msg)
require.NoError(t, err)
}
// We should have only published 2, as we are missing sequence number 3.
- require.Equal(t, 2, numPublished)
+ require.Equal(t, 2, len(stubPublisher.publishedTxOrder))
require.Equal(t, len(messages), len(els.messagesBySequenceNumber))
- err := els.sequenceExpressLaneSubmission(ctx, &timeboost.ExpressLaneSubmission{SequenceNumber: 3}, publishFn)
+ err := els.sequenceExpressLaneSubmission(ctx, &timeboost.ExpressLaneSubmission{SequenceNumber: 3, Transaction: &types.Transaction{}})
require.NoError(t, err)
- require.Equal(t, 5, numPublished)
+ require.Equal(t, 5, len(stubPublisher.publishedTxOrder))
}
func Test_expressLaneService_sequenceExpressLaneSubmission_erroredTx(t *testing.T) {
@@ -337,17 +359,9 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_erroredTx(t *testing.
els.roundControl.Add(0, &expressLaneControl{
sequence: 1,
})
- numPublished := 0
- publishedTxOrder := make([]uint64, 0)
- control, _ := els.roundControl.Get(0)
- publishFn := func(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, delay bool) error {
- if tx == nil {
- return errors.New("oops, bad tx")
- }
- numPublished += 1
- publishedTxOrder = append(publishedTxOrder, control.sequence)
- return nil
- }
+ stubPublisher := makeStubPublisher(els)
+ els.transactionPublisher = stubPublisher
+
messages := []*timeboost.ExpressLaneSubmission{
{
SequenceNumber: 1,
@@ -368,16 +382,16 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_erroredTx(t *testing.
}
for _, msg := range messages {
if msg.Transaction == nil {
- err := els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+ err := els.sequenceExpressLaneSubmission(ctx, msg)
require.ErrorContains(t, err, "oops, bad tx")
} else {
- err := els.sequenceExpressLaneSubmission(ctx, msg, publishFn)
+ err := els.sequenceExpressLaneSubmission(ctx, msg)
require.NoError(t, err)
}
}
// One tx out of the four should have failed, so we should have only published 3.
- require.Equal(t, 3, numPublished)
- require.Equal(t, []uint64{1, 2, 3}, publishedTxOrder)
+ require.Equal(t, 3, len(stubPublisher.publishedTxOrder))
+ require.Equal(t, []uint64{1, 2, 3}, stubPublisher.publishedTxOrder)
}
func TestIsWithinAuctionCloseWindow(t *testing.T) {
diff --git a/execution/gethexec/forwarder.go b/execution/gethexec/forwarder.go
index 9779dec446..e7a829a431 100644
--- a/execution/gethexec/forwarder.go
+++ b/execution/gethexec/forwarder.go
@@ -14,9 +14,6 @@ import (
"sync/atomic"
"time"
- "github.com/offchainlabs/nitro/timeboost"
- "github.com/offchainlabs/nitro/util/redisutil"
- "github.com/offchainlabs/nitro/util/stopwaiter"
flag "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/arbitrum"
@@ -25,6 +22,10 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
+ "github.com/offchainlabs/nitro/timeboost"
+ "github.com/offchainlabs/nitro/util/redisutil"
+ "github.com/offchainlabs/nitro/util/stopwaiter"
)
type ForwarderConfig struct {
diff --git a/execution/gethexec/node.go b/execution/gethexec/node.go
index b4ef7d5da4..000a067055 100644
--- a/execution/gethexec/node.go
+++ b/execution/gethexec/node.go
@@ -9,6 +9,8 @@ import (
"sync/atomic"
"testing"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -21,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/arbutil"
@@ -28,7 +31,6 @@ import (
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/dbutil"
"github.com/offchainlabs/nitro/util/headerreader"
- flag "github.com/spf13/pflag"
)
type StylusTargetConfig struct {
diff --git a/execution/gethexec/sequencer.go b/execution/gethexec/sequencer.go
index c04ebb2de5..220b678435 100644
--- a/execution/gethexec/sequencer.go
+++ b/execution/gethexec/sequencer.go
@@ -15,12 +15,6 @@ import (
"sync/atomic"
"time"
- "github.com/offchainlabs/nitro/arbutil"
- "github.com/offchainlabs/nitro/execution"
- "github.com/offchainlabs/nitro/timeboost"
- "github.com/offchainlabs/nitro/util/arbmath"
- "github.com/offchainlabs/nitro/util/containers"
- "github.com/offchainlabs/nitro/util/headerreader"
flag "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/arbitrum"
@@ -32,15 +26,21 @@ import (
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
- "github.com/ethereum/go-ethereum/ethclient"
+ "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
- "github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/l1pricing"
+ "github.com/offchainlabs/nitro/arbutil"
+ "github.com/offchainlabs/nitro/execution"
+ "github.com/offchainlabs/nitro/timeboost"
+ "github.com/offchainlabs/nitro/util/arbmath"
+ "github.com/offchainlabs/nitro/util/containers"
+ "github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/util/stopwaiter"
)
@@ -89,7 +89,6 @@ type TimeboostConfig struct {
AuctionContractAddress string `koanf:"auction-contract-address"`
AuctioneerAddress string `koanf:"auctioneer-address"`
ExpressLaneAdvantage time.Duration `koanf:"express-lane-advantage"`
- SequencerHTTPEndpoint string `koanf:"sequencer-http-endpoint"`
}
var DefaultTimeboostConfig = TimeboostConfig{
@@ -97,7 +96,6 @@ var DefaultTimeboostConfig = TimeboostConfig{
AuctionContractAddress: "",
AuctioneerAddress: "",
ExpressLaneAdvantage: time.Millisecond * 200,
- SequencerHTTPEndpoint: "http://localhost:8547",
}
func (c *SequencerConfig) Validate() error {
@@ -190,7 +188,6 @@ func TimeboostAddOptions(prefix string, f *flag.FlagSet) {
f.String(prefix+".auction-contract-address", DefaultTimeboostConfig.AuctionContractAddress, "Address of the proxy pointing to the ExpressLaneAuction contract")
f.String(prefix+".auctioneer-address", DefaultTimeboostConfig.AuctioneerAddress, "Address of the Timeboost Autonomous Auctioneer")
f.Duration(prefix+".express-lane-advantage", DefaultTimeboostConfig.ExpressLaneAdvantage, "specify the express lane advantage")
- f.String(prefix+".sequencer-http-endpoint", DefaultTimeboostConfig.SequencerHTTPEndpoint, "this sequencer's http endpoint")
}
type txQueueItem struct {
@@ -333,12 +330,36 @@ func (c nonceFailureCache) Add(err NonceError, queueItem txQueueItem) {
}
}
+type synchronizedTxQueue struct {
+ queue containers.Queue[txQueueItem]
+ mutex sync.RWMutex
+}
+
+func (q *synchronizedTxQueue) Push(item txQueueItem) {
+ q.mutex.Lock()
+ q.queue.Push(item)
+ q.mutex.Unlock()
+}
+
+func (q *synchronizedTxQueue) Pop() txQueueItem {
+ q.mutex.Lock()
+ defer q.mutex.Unlock()
+ return q.queue.Pop()
+
+}
+
+func (q *synchronizedTxQueue) Len() int {
+ q.mutex.RLock()
+ defer q.mutex.RUnlock()
+ return q.queue.Len()
+}
+
type Sequencer struct {
stopwaiter.StopWaiter
execEngine *ExecutionEngine
txQueue chan txQueueItem
- txRetryQueue containers.Queue[txQueueItem]
+ txRetryQueue synchronizedTxQueue
l1Reader *headerreader.HeaderReader
config SequencerConfigFetcher
senderWhitelist map[common.Address]struct{}
@@ -362,7 +383,7 @@ type Sequencer struct {
expectedSurplus int64
expectedSurplusUpdated bool
auctioneerAddr common.Address
- timeboostAuctionResolutionTxQueue containers.Queue[txQueueItem]
+ timeboostAuctionResolutionTxQueue chan txQueueItem
}
func NewSequencer(execEngine *ExecutionEngine, l1Reader *headerreader.HeaderReader, configFetcher SequencerConfigFetcher) (*Sequencer, error) {
@@ -378,15 +399,16 @@ func NewSequencer(execEngine *ExecutionEngine, l1Reader *headerreader.HeaderRead
senderWhitelist[common.HexToAddress(address)] = struct{}{}
}
s := &Sequencer{
- execEngine: execEngine,
- txQueue: make(chan txQueueItem, config.QueueSize),
- l1Reader: l1Reader,
- config: configFetcher,
- senderWhitelist: senderWhitelist,
- nonceCache: newNonceCache(config.NonceCacheSize),
- l1Timestamp: 0,
- pauseChan: nil,
- onForwarderSet: make(chan struct{}, 1),
+ execEngine: execEngine,
+ txQueue: make(chan txQueueItem, config.QueueSize),
+ l1Reader: l1Reader,
+ config: configFetcher,
+ senderWhitelist: senderWhitelist,
+ nonceCache: newNonceCache(config.NonceCacheSize),
+ l1Timestamp: 0,
+ pauseChan: nil,
+ onForwarderSet: make(chan struct{}, 1),
+ timeboostAuctionResolutionTxQueue: make(chan txQueueItem, 10), // There should never be more than 1 outstanding auction resolutions
}
s.nonceFailures = &nonceFailureCache{
containers.NewLruCacheWithOnEvict(config.NonceCacheSize, s.onNonceFailureEvict),
@@ -434,10 +456,14 @@ func ctxWithTimeout(ctx context.Context, timeout time.Duration) (context.Context
}
func (s *Sequencer) PublishTransaction(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions) error {
- return s.publishTransactionImpl(parentCtx, tx, options, true /* delay tx if express lane is active */)
+ return s.publishTransactionImpl(parentCtx, tx, options, false /* delay tx if express lane is active */)
}
-func (s *Sequencer) publishTransactionImpl(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, delay bool) error {
+func (s *Sequencer) PublishTimeboostedTransaction(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions) error {
+ return s.publishTransactionImpl(parentCtx, tx, options, true)
+}
+
+func (s *Sequencer) publishTransactionImpl(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions, isExpressLaneController bool) error {
config := s.config()
// Only try to acquire Rlock and check for hard threshold if l1reader is not nil
// And hard threshold was enabled, this prevents spamming of read locks when not needed
@@ -483,7 +509,7 @@ func (s *Sequencer) publishTransactionImpl(parentCtx context.Context, tx *types.
}
if s.config().Timeboost.Enable && s.expressLaneService != nil {
- if delay && s.expressLaneService.currentRoundHasController() {
+ if !isExpressLaneController && s.expressLaneService.currentRoundHasController() {
time.Sleep(s.config().Timeboost.ExpressLaneAdvantage)
}
}
@@ -505,7 +531,7 @@ func (s *Sequencer) publishTransactionImpl(parentCtx context.Context, tx *types.
&atomic.Bool{},
queueCtx,
time.Now(),
- !delay,
+ isExpressLaneController,
}
select {
case s.txQueue <- queueItem:
@@ -538,7 +564,7 @@ func (s *Sequencer) PublishExpressLaneTransaction(ctx context.Context, msg *time
if err := s.expressLaneService.validateExpressLaneTx(msg); err != nil {
return err
}
- return s.expressLaneService.sequenceExpressLaneSubmission(ctx, msg, s.publishTransactionImpl)
+ return s.expressLaneService.sequenceExpressLaneSubmission(ctx, msg)
}
func (s *Sequencer) PublishAuctionResolutionTransaction(ctx context.Context, tx *types.Transaction) error {
@@ -572,7 +598,7 @@ func (s *Sequencer) PublishAuctionResolutionTransaction(ctx context.Context, tx
return err
}
log.Info("Prioritizing auction resolution transaction from auctioneer", "txHash", tx.Hash().Hex())
- s.timeboostAuctionResolutionTxQueue.Push(txQueueItem{
+ s.timeboostAuctionResolutionTxQueue <- txQueueItem{
tx: tx,
txSize: len(txBytes),
options: nil,
@@ -581,7 +607,7 @@ func (s *Sequencer) PublishAuctionResolutionTransaction(ctx context.Context, tx
ctx: context.TODO(),
firstAppearance: time.Now(),
isTimeboosted: true,
- })
+ }
return nil
}
@@ -909,10 +935,12 @@ func (s *Sequencer) createBlock(ctx context.Context) (returnValue bool) {
for {
var queueItem txQueueItem
- if s.timeboostAuctionResolutionTxQueue.Len() > 0 {
- queueItem = s.timeboostAuctionResolutionTxQueue.Pop()
- log.Info("Popped the auction resolution tx", queueItem.tx.Hash())
- } else if s.txRetryQueue.Len() > 0 {
+
+ if s.txRetryQueue.Len() > 0 {
+ // The txRetryQueue is not modeled as a channel because it is only added to from
+ // this function (Sequencer.createBlock). So it is sufficient to check its
+ // len at the start of this loop, since items can't be added to it asynchronously,
+ // which is not true for the main txQueue or timeboostAuctionResolutionQueue.
queueItem = s.txRetryQueue.Pop()
} else if len(queueItems) == 0 {
var nextNonceExpiryChan <-chan time.Time
@@ -921,6 +949,8 @@ func (s *Sequencer) createBlock(ctx context.Context) (returnValue bool) {
}
select {
case queueItem = <-s.txQueue:
+ case queueItem = <-s.timeboostAuctionResolutionTxQueue:
+ log.Info("Popped the auction resolution tx", "txHash", queueItem.tx.Hash())
case <-nextNonceExpiryChan:
// No need to stop the previous timer since it already elapsed
nextNonceExpiryTimer = s.expireNonceFailures()
@@ -939,6 +969,8 @@ func (s *Sequencer) createBlock(ctx context.Context) (returnValue bool) {
done := false
select {
case queueItem = <-s.txQueue:
+ case queueItem = <-s.timeboostAuctionResolutionTxQueue:
+ log.Info("Popped the auction resolution tx", "txHash", queueItem.tx.Hash())
default:
done = true
}
@@ -1249,19 +1281,16 @@ func (s *Sequencer) Start(ctxIn context.Context) error {
return nil
}
-func (s *Sequencer) StartExpressLane(ctx context.Context, auctionContractAddr common.Address, auctioneerAddr common.Address) {
+func (s *Sequencer) StartExpressLane(ctx context.Context, apiBackend *arbitrum.APIBackend, filterSystem *filters.FilterSystem, auctionContractAddr common.Address, auctioneerAddr common.Address) {
if !s.config().Timeboost.Enable {
log.Crit("Timeboost is not enabled, but StartExpressLane was called")
}
- rpcClient, err := rpc.DialContext(ctx, s.config().Timeboost.SequencerHTTPEndpoint)
- if err != nil {
- log.Crit("Failed to connect to sequencer RPC client", "err", err)
- }
- seqClient := ethclient.NewClient(rpcClient)
els, err := newExpressLaneService(
+ s,
+ apiBackend,
+ filterSystem,
auctionContractAddr,
- seqClient,
s.execEngine.bc,
)
if err != nil {
@@ -1277,11 +1306,18 @@ func (s *Sequencer) StopAndWait() {
if s.config().Timeboost.Enable && s.expressLaneService != nil {
s.expressLaneService.StopAndWait()
}
- if s.txRetryQueue.Len() == 0 && len(s.txQueue) == 0 && s.nonceFailures.Len() == 0 {
+ if s.txRetryQueue.Len() == 0 &&
+ len(s.txQueue) == 0 &&
+ s.nonceFailures.Len() == 0 &&
+ len(s.timeboostAuctionResolutionTxQueue) == 0 {
return
}
// this usually means that coordinator's safe-shutdown-delay is too low
- log.Warn("Sequencer has queued items while shutting down", "txQueue", len(s.txQueue), "retryQueue", s.txRetryQueue.Len(), "nonceFailures", s.nonceFailures.Len())
+ log.Warn("Sequencer has queued items while shutting down",
+ "txQueue", len(s.txQueue),
+ "retryQueue", s.txRetryQueue.Len(),
+ "nonceFailures", s.nonceFailures.Len(),
+ "timeboostAuctionResolutionTxQueue", len(s.timeboostAuctionResolutionTxQueue))
_, forwarder := s.GetPauseAndForwarder()
if forwarder != nil {
var wg sync.WaitGroup
@@ -1302,6 +1338,8 @@ func (s *Sequencer) StopAndWait() {
select {
case item = <-s.txQueue:
source = "txQueue"
+ case item = <-s.timeboostAuctionResolutionTxQueue:
+ source = "timeboostAuctionResolutionTxQueue"
default:
break emptyqueues
}
diff --git a/execution/gethexec/stylus_tracer.go b/execution/gethexec/stylus_tracer.go
index cb4e858048..8a024941d3 100644
--- a/execution/gethexec/stylus_tracer.go
+++ b/execution/gethexec/stylus_tracer.go
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/containers"
)
diff --git a/execution/gethexec/sync_monitor.go b/execution/gethexec/sync_monitor.go
index 86949c7767..7f04b2ee4a 100644
--- a/execution/gethexec/sync_monitor.go
+++ b/execution/gethexec/sync_monitor.go
@@ -3,9 +3,10 @@ package gethexec
import (
"context"
- "github.com/offchainlabs/nitro/execution"
"github.com/pkg/errors"
flag "github.com/spf13/pflag"
+
+ "github.com/offchainlabs/nitro/execution"
)
type SyncMonitorConfig struct {
diff --git a/execution/gethexec/tx_pre_checker.go b/execution/gethexec/tx_pre_checker.go
index f764474149..4c1270fa0d 100644
--- a/execution/gethexec/tx_pre_checker.go
+++ b/execution/gethexec/tx_pre_checker.go
@@ -8,6 +8,8 @@ import (
"fmt"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -15,12 +17,12 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/timeboost"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/headerreader"
- flag "github.com/spf13/pflag"
)
var (
diff --git a/execution/gethexec/wasmstorerebuilder.go b/execution/gethexec/wasmstorerebuilder.go
index e3eb8e9268..b40a7cd128 100644
--- a/execution/gethexec/wasmstorerebuilder.go
+++ b/execution/gethexec/wasmstorerebuilder.go
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
)
diff --git a/execution/interface.go b/execution/interface.go
index 94c60a31bb..59080e755f 100644
--- a/execution/interface.go
+++ b/execution/interface.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/execution/nodeInterface/NodeInterface.go b/execution/nodeInterface/NodeInterface.go
index 00da1ba4b6..20282f8231 100644
--- a/execution/nodeInterface/NodeInterface.go
+++ b/execution/nodeInterface/NodeInterface.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/retryables"
@@ -525,7 +526,11 @@ func (n NodeInterface) GasEstimateL1Component(
if err := args.CallDefaults(randomGas, evm.Context.BaseFee, evm.ChainConfig().ChainID); err != nil {
return 0, nil, nil, err
}
- msg := args.ToMessage(evm.Context.BaseFee, randomGas, n.header, evm.StateDB.(*state.StateDB), core.MessageEthcallMode)
+ sdb, ok := evm.StateDB.(*state.StateDB)
+ if !ok {
+ return 0, nil, nil, errors.New("failed to cast to stateDB")
+ }
+ msg := args.ToMessage(evm.Context.BaseFee, randomGas, n.header, sdb, core.MessageEthcallMode)
pricing := c.State.L1PricingState()
l1BaseFeeEstimate, err := pricing.PricePerUnit()
@@ -581,7 +586,11 @@ func (n NodeInterface) GasEstimateComponents(
if err := args.CallDefaults(gasCap, evm.Context.BaseFee, evm.ChainConfig().ChainID); err != nil {
return 0, 0, nil, nil, err
}
- msg := args.ToMessage(evm.Context.BaseFee, gasCap, n.header, evm.StateDB.(*state.StateDB), core.MessageGasEstimationMode)
+ sdb, ok := evm.StateDB.(*state.StateDB)
+ if !ok {
+ return 0, 0, nil, nil, errors.New("failed to cast to stateDB")
+ }
+ msg := args.ToMessage(evm.Context.BaseFee, gasCap, n.header, sdb, core.MessageGasEstimationMode)
brotliCompressionLevel, err := c.State.BrotliCompressionLevel()
if err != nil {
return 0, 0, nil, nil, fmt.Errorf("failed to get brotli compression level: %w", err)
diff --git a/execution/nodeInterface/NodeInterfaceDebug.go b/execution/nodeInterface/NodeInterfaceDebug.go
index ae9c157ce4..7066bf2ed2 100644
--- a/execution/nodeInterface/NodeInterfaceDebug.go
+++ b/execution/nodeInterface/NodeInterfaceDebug.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/solgen/go/node_interfacegen"
)
diff --git a/execution/nodeInterface/virtual-contracts.go b/execution/nodeInterface/virtual-contracts.go
index 86382870b7..5b9f4b3474 100644
--- a/execution/nodeInterface/virtual-contracts.go
+++ b/execution/nodeInterface/virtual-contracts.go
@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/l1pricing"
diff --git a/gethhook/geth-hook.go b/gethhook/geth-hook.go
index 776e8cc452..3ad275b352 100644
--- a/gethhook/geth-hook.go
+++ b/gethhook/geth-hook.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/precompiles"
)
diff --git a/gethhook/geth_test.go b/gethhook/geth_test.go
index 57ce2ddec0..381c128071 100644
--- a/gethhook/geth_test.go
+++ b/gethhook/geth_test.go
@@ -20,6 +20,7 @@ import (
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -49,7 +50,7 @@ var testChainConfig = ¶ms.ChainConfig{
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
- ArbitrumChainParams: params.ArbitrumDevTestParams(),
+ ArbitrumChainParams: chaininfo.ArbitrumDevTestParams(),
}
func TestEthDepositMessage(t *testing.T) {
diff --git a/go.mod b/go.mod
index 4cfd1f6548..2ef5cef441 100644
--- a/go.mod
+++ b/go.mod
@@ -86,9 +86,9 @@ require (
google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect
- google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
+ google.golang.org/grpc v1.64.1 // indirect
)
require (
diff --git a/go.sum b/go.sum
index 0148da44b3..3f03f6b95b 100644
--- a/go.sum
+++ b/go.sum
@@ -1005,8 +1005,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
-google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
-google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
+google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
+google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
diff --git a/linters/koanf/handlers.go b/linters/koanf/handlers.go
index 5ee3b80f9f..e3f7c67f68 100644
--- a/linters/koanf/handlers.go
+++ b/linters/koanf/handlers.go
@@ -126,7 +126,11 @@ func checkFlagDefs(pass *analysis.Pass, f *ast.FuncDecl, cnt map[string]int) Res
if !ok {
continue
}
- handleSelector(pass, callE.Args[1].(*ast.SelectorExpr), -1, cnt)
+ sel, ok := callE.Args[1].(*ast.SelectorExpr)
+ if !ok {
+ continue
+ }
+ handleSelector(pass, sel, -1, cnt)
if normSL := normalizeTag(sl); !strings.EqualFold(normSL, s) {
res.Errors = append(res.Errors, koanfError{
Pos: f.Pos(),
diff --git a/linters/linters.go b/linters/linters.go
index a6c9f6d55e..8d2807c0b2 100644
--- a/linters/linters.go
+++ b/linters/linters.go
@@ -1,11 +1,12 @@
package main
import (
+ "golang.org/x/tools/go/analysis/multichecker"
+
"github.com/offchainlabs/nitro/linters/koanf"
"github.com/offchainlabs/nitro/linters/pointercheck"
"github.com/offchainlabs/nitro/linters/rightshift"
"github.com/offchainlabs/nitro/linters/structinit"
- "golang.org/x/tools/go/analysis/multichecker"
)
func main() {
diff --git a/precompiles/ArbAddressTable_test.go b/precompiles/ArbAddressTable_test.go
index 62ce177480..3feaca6279 100644
--- a/precompiles/ArbAddressTable_test.go
+++ b/precompiles/ArbAddressTable_test.go
@@ -12,9 +12,10 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -173,7 +174,7 @@ func newMockEVMForTestingWithVersionAndRunMode(version *uint64, runMode core.Mes
}
func newMockEVMForTestingWithVersion(version *uint64) *vm.EVM {
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
if version != nil {
chainConfig.ArbitrumChainParams.InitialArbOSVersion = *version
}
diff --git a/precompiles/ArbAggregator_test.go b/precompiles/ArbAggregator_test.go
index 879fc737e4..eb72f12f25 100644
--- a/precompiles/ArbAggregator_test.go
+++ b/precompiles/ArbAggregator_test.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/l1pricing"
)
diff --git a/precompiles/ArbGasInfo.go b/precompiles/ArbGasInfo.go
index b41dfda8a2..8d916926f3 100644
--- a/precompiles/ArbGasInfo.go
+++ b/precompiles/ArbGasInfo.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/precompiles/ArbGasInfo_test.go b/precompiles/ArbGasInfo_test.go
index 260d7b3cef..76489c3c9a 100644
--- a/precompiles/ArbGasInfo_test.go
+++ b/precompiles/ArbGasInfo_test.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/storage"
diff --git a/precompiles/ArbInfo.go b/precompiles/ArbInfo.go
index 9f8cf34532..60e23ffb6e 100644
--- a/precompiles/ArbInfo.go
+++ b/precompiles/ArbInfo.go
@@ -5,6 +5,7 @@ package precompiles
import (
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/precompiles/ArbOwner.go b/precompiles/ArbOwner.go
index 8b87445e0e..90a7b4ccc2 100644
--- a/precompiles/ArbOwner.go
+++ b/precompiles/ArbOwner.go
@@ -10,13 +10,13 @@ import (
"fmt"
"math/big"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/util/arbmath"
am "github.com/offchainlabs/nitro/util/arbmath"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/params"
)
// ArbOwner precompile provides owners with tools for managing the rollup.
diff --git a/precompiles/ArbOwner_test.go b/precompiles/ArbOwner_test.go
index fe995c6b32..51b2fc0cd9 100644
--- a/precompiles/ArbOwner_test.go
+++ b/precompiles/ArbOwner_test.go
@@ -6,21 +6,22 @@ package precompiles
import (
"bytes"
"encoding/json"
- "github.com/ethereum/go-ethereum/core/tracing"
"math/big"
"testing"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/params"
- "github.com/holiman/uint256"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -181,7 +182,7 @@ func TestArbOwnerSetChainConfig(t *testing.T) {
prec := &ArbOwner{}
callCtx := testContext(caller, evm)
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams.AllowDebugPrecompiles = false
serializedChainConfig, err := json.Marshal(chainConfig)
Require(t, err)
diff --git a/precompiles/ArbRetryableTx.go b/precompiles/ArbRetryableTx.go
index d925499180..49cc9a3264 100644
--- a/precompiles/ArbRetryableTx.go
+++ b/precompiles/ArbRetryableTx.go
@@ -9,8 +9,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
-
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
diff --git a/precompiles/ArbRetryableTx_test.go b/precompiles/ArbRetryableTx_test.go
index 47450299ce..d5b93640c9 100644
--- a/precompiles/ArbRetryableTx_test.go
+++ b/precompiles/ArbRetryableTx_test.go
@@ -7,12 +7,12 @@ import (
"math/big"
"testing"
- "github.com/offchainlabs/nitro/arbos"
- "github.com/offchainlabs/nitro/arbos/storage"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/vm"
+
+ "github.com/offchainlabs/nitro/arbos"
+ "github.com/offchainlabs/nitro/arbos/storage"
templates "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
)
diff --git a/precompiles/ArbSys.go b/precompiles/ArbSys.go
index 689d3b18de..04cde46ebe 100644
--- a/precompiles/ArbSys.go
+++ b/precompiles/ArbSys.go
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/merkletree"
diff --git a/precompiles/ArbWasm.go b/precompiles/ArbWasm.go
index bc24c8a6e8..eecca35ce6 100644
--- a/precompiles/ArbWasm.go
+++ b/precompiles/ArbWasm.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
gethparams "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/precompiles/precompile.go b/precompiles/precompile.go
index 9a356c5a8e..5b5376a4ca 100644
--- a/precompiles/precompile.go
+++ b/precompiles/precompile.go
@@ -14,13 +14,6 @@ import (
"strings"
"unicode"
- "github.com/offchainlabs/nitro/arbos"
- "github.com/offchainlabs/nitro/arbos/arbosState"
- "github.com/offchainlabs/nitro/arbos/programs"
- "github.com/offchainlabs/nitro/arbos/util"
- pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
- "github.com/offchainlabs/nitro/util/arbmath"
-
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
@@ -30,6 +23,13 @@ import (
"github.com/ethereum/go-ethereum/log"
glog "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
+ "github.com/offchainlabs/nitro/arbos"
+ "github.com/offchainlabs/nitro/arbos/arbosState"
+ "github.com/offchainlabs/nitro/arbos/programs"
+ "github.com/offchainlabs/nitro/arbos/util"
+ pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
+ "github.com/offchainlabs/nitro/util/arbmath"
)
type ArbosPrecompile interface {
diff --git a/precompiles/precompile_test.go b/precompiles/precompile_test.go
index 18b33714aa..c8b8a46b96 100644
--- a/precompiles/precompile_test.go
+++ b/precompiles/precompile_test.go
@@ -10,12 +10,12 @@ import (
"os"
"testing"
- "github.com/ethereum/go-ethereum/core/state"
- "github.com/ethereum/go-ethereum/log"
-
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/storage"
templates "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/precompiles/wrapper.go b/precompiles/wrapper.go
index b9363c40a2..edc079fc5b 100644
--- a/precompiles/wrapper.go
+++ b/precompiles/wrapper.go
@@ -7,12 +7,12 @@ import (
"errors"
"math/big"
- "github.com/offchainlabs/nitro/arbos/arbosState"
- "github.com/offchainlabs/nitro/arbos/util"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
+
+ "github.com/offchainlabs/nitro/arbos/arbosState"
+ "github.com/offchainlabs/nitro/arbos/util"
)
// DebugPrecompile is a precompile wrapper for those not allowed in production
diff --git a/pubsub/common.go b/pubsub/common.go
index ad36b6e622..a4fc141bb5 100644
--- a/pubsub/common.go
+++ b/pubsub/common.go
@@ -5,8 +5,9 @@ import (
"fmt"
"strings"
- "github.com/ethereum/go-ethereum/log"
"github.com/redis/go-redis/v9"
+
+ "github.com/ethereum/go-ethereum/log"
)
func ResultKeyFor(streamName, id string) string { return fmt.Sprintf("%s.%s", streamName, id) }
diff --git a/pubsub/consumer.go b/pubsub/consumer.go
index 391042bd7e..3f28749473 100644
--- a/pubsub/consumer.go
+++ b/pubsub/consumer.go
@@ -10,11 +10,13 @@ import (
"strconv"
"time"
- "github.com/ethereum/go-ethereum/log"
"github.com/google/uuid"
- "github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/redis/go-redis/v9"
"github.com/spf13/pflag"
+
+ "github.com/ethereum/go-ethereum/log"
+
+ "github.com/offchainlabs/nitro/util/stopwaiter"
)
type ConsumerConfig struct {
diff --git a/pubsub/producer.go b/pubsub/producer.go
index 722c145a09..5aaca77aa7 100644
--- a/pubsub/producer.go
+++ b/pubsub/producer.go
@@ -18,12 +18,14 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/log"
"github.com/google/uuid"
- "github.com/offchainlabs/nitro/util/containers"
- "github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/redis/go-redis/v9"
"github.com/spf13/pflag"
+
+ "github.com/ethereum/go-ethereum/log"
+
+ "github.com/offchainlabs/nitro/util/containers"
+ "github.com/offchainlabs/nitro/util/stopwaiter"
)
const (
diff --git a/pubsub/pubsub_test.go b/pubsub/pubsub_test.go
index 8bd1aed25d..c82a35e0b8 100644
--- a/pubsub/pubsub_test.go
+++ b/pubsub/pubsub_test.go
@@ -9,12 +9,14 @@ import (
"testing"
"time"
- "github.com/ethereum/go-ethereum/log"
"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
+ "github.com/redis/go-redis/v9"
+
+ "github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/redisutil"
- "github.com/redis/go-redis/v9"
)
var (
diff --git a/relay/relay_stress_test.go b/relay/relay_stress_test.go
index 575a77ee6f..93ba510193 100644
--- a/relay/relay_stress_test.go
+++ b/relay/relay_stress_test.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/broadcastclient"
diff --git a/scripts/split-val-entry.sh b/scripts/split-val-entry.sh
index 42e0c5fe08..ab8c520918 100755
--- a/scripts/split-val-entry.sh
+++ b/scripts/split-val-entry.sh
@@ -39,4 +39,4 @@ for port in 52000 52001; do
done
done
echo launching nitro-node
-/usr/local/bin/nitro --validation.wasm.allowed-wasm-module-roots /home/user/nitro-legacy/machines,/home/user/target/machines --node.block-validator.validation-server-configs-list='[{"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52000"}, {"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52001"}]' "$@"
+exec /usr/local/bin/nitro --validation.wasm.allowed-wasm-module-roots /home/user/nitro-legacy/machines,/home/user/target/machines --node.block-validator.validation-server-configs-list='[{"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52000"}, {"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52001"}]' "$@"
diff --git a/staker/block_challenge_backend.go b/staker/block_challenge_backend.go
index 0dd89865bd..a8a6e917a2 100644
--- a/staker/block_challenge_backend.go
+++ b/staker/block_challenge_backend.go
@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/challengegen"
"github.com/offchainlabs/nitro/validator"
diff --git a/staker/block_validator.go b/staker/block_validator.go
index 5a1f123693..0a1a38ba17 100644
--- a/staker/block_validator.go
+++ b/staker/block_validator.go
@@ -16,12 +16,15 @@ import (
"testing"
"time"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rlp"
+
"github.com/offchainlabs/nitro/arbnode/resourcemanager"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/containers"
@@ -31,7 +34,6 @@ import (
"github.com/offchainlabs/nitro/validator/client/redis"
"github.com/offchainlabs/nitro/validator/inputs"
"github.com/offchainlabs/nitro/validator/server_api"
- "github.com/spf13/pflag"
)
var (
diff --git a/staker/block_validator_schema.go b/staker/block_validator_schema.go
index f6eb39f015..330116dda0 100644
--- a/staker/block_validator_schema.go
+++ b/staker/block_validator_schema.go
@@ -5,6 +5,7 @@ package staker
import (
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator"
)
diff --git a/staker/challenge_manager.go b/staker/challenge_manager.go
index 27cb92a5c7..96e496acf8 100644
--- a/staker/challenge_manager.go
+++ b/staker/challenge_manager.go
@@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/challengegen"
"github.com/offchainlabs/nitro/validator"
diff --git a/staker/challenge_test.go b/staker/challenge_test.go
index 33f1644c63..ede1295a13 100644
--- a/staker/challenge_test.go
+++ b/staker/challenge_test.go
@@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/ospgen"
"github.com/offchainlabs/nitro/validator"
diff --git a/staker/execution_challenge_bakend.go b/staker/execution_challenge_bakend.go
index 8ab60efced..6616d8f8c1 100644
--- a/staker/execution_challenge_bakend.go
+++ b/staker/execution_challenge_bakend.go
@@ -7,6 +7,7 @@ import (
"context"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator"
)
diff --git a/staker/l1_validator.go b/staker/l1_validator.go
index 5b0c211324..8ee05dda22 100644
--- a/staker/l1_validator.go
+++ b/staker/l1_validator.go
@@ -10,19 +10,19 @@ import (
"math/big"
"time"
- "github.com/offchainlabs/nitro/staker/txbuilder"
- "github.com/offchainlabs/nitro/util/arbmath"
- "github.com/offchainlabs/nitro/util/headerreader"
- "github.com/offchainlabs/nitro/validator"
-
"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/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
+ "github.com/offchainlabs/nitro/staker/txbuilder"
+ "github.com/offchainlabs/nitro/util/arbmath"
+ "github.com/offchainlabs/nitro/util/headerreader"
+ "github.com/offchainlabs/nitro/validator"
)
type ConfirmType uint8
diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go
index 4d7db52322..8b27e544b1 100644
--- a/staker/rollup_watcher.go
+++ b/staker/rollup_watcher.go
@@ -13,17 +13,17 @@ import (
"strings"
"sync/atomic"
+ "github.com/ethereum/go-ethereum"
+ "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/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/util/headerreader"
-
- "github.com/ethereum/go-ethereum"
- "github.com/ethereum/go-ethereum/accounts/abi/bind"
- "github.com/ethereum/go-ethereum/core/types"
)
var rollupInitializedID common.Hash
diff --git a/staker/staker.go b/staker/staker.go
index 45e6f6f551..c5f9c1cd65 100644
--- a/staker/staker.go
+++ b/staker/staker.go
@@ -12,6 +12,9 @@ import (
"strings"
"time"
+ "github.com/google/btree"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@@ -19,8 +22,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/google/btree"
- flag "github.com/spf13/pflag"
"github.com/offchainlabs/nitro/arbnode/dataposter"
"github.com/offchainlabs/nitro/arbutil"
diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go
index d9c9c5446b..bb25a38f5d 100644
--- a/staker/stateless_block_validator.go
+++ b/staker/stateless_block_validator.go
@@ -9,23 +9,22 @@ import (
"fmt"
"testing"
- "github.com/offchainlabs/nitro/arbstate/daprovider"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
+ "github.com/offchainlabs/nitro/arbstate/daprovider"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/validator"
+ validatorclient "github.com/offchainlabs/nitro/validator/client"
"github.com/offchainlabs/nitro/validator/client/redis"
"github.com/offchainlabs/nitro/validator/server_api"
-
- validatorclient "github.com/offchainlabs/nitro/validator/client"
)
type StatelessBlockValidator struct {
diff --git a/staker/validatorwallet/contract.go b/staker/validatorwallet/contract.go
index 3202d58569..4d4f8288ef 100644
--- a/staker/validatorwallet/contract.go
+++ b/staker/validatorwallet/contract.go
@@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbnode/dataposter"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/staker/txbuilder"
diff --git a/staker/validatorwallet/eoa.go b/staker/validatorwallet/eoa.go
index 7c7f472579..870a959152 100644
--- a/staker/validatorwallet/eoa.go
+++ b/staker/validatorwallet/eoa.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
+
"github.com/offchainlabs/nitro/arbnode/dataposter"
"github.com/offchainlabs/nitro/solgen/go/challengegen"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
diff --git a/staker/validatorwallet/noop.go b/staker/validatorwallet/noop.go
index fec39ac2b1..24c7280811 100644
--- a/staker/validatorwallet/noop.go
+++ b/staker/validatorwallet/noop.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
+
"github.com/offchainlabs/nitro/arbnode/dataposter"
"github.com/offchainlabs/nitro/staker/txbuilder"
)
diff --git a/statetransfer/data.go b/statetransfer/data.go
index df4694aa17..21268a443a 100644
--- a/statetransfer/data.go
+++ b/statetransfer/data.go
@@ -14,6 +14,7 @@ type ArbosInitializationInfo struct {
AddressTableContents []common.Address
RetryableData []InitializationDataForRetryable
Accounts []AccountInitializationInfo
+ ChainOwner common.Address
}
type InitializationDataForRetryable struct {
diff --git a/statetransfer/interface.go b/statetransfer/interface.go
index 7d592b4430..cb70fdd14d 100644
--- a/statetransfer/interface.go
+++ b/statetransfer/interface.go
@@ -17,6 +17,7 @@ type InitDataReader interface {
GetNextBlockNumber() (uint64, error)
GetRetryableDataReader() (RetryableDataReader, error)
GetAccountDataReader() (AccountDataReader, error)
+ GetChainOwner() (common.Address, error)
}
type ListReader interface {
diff --git a/statetransfer/jsondatareader.go b/statetransfer/jsondatareader.go
index c36061c0b0..5e992df3f0 100644
--- a/statetransfer/jsondatareader.go
+++ b/statetransfer/jsondatareader.go
@@ -210,3 +210,7 @@ func (r *JsonInitDataReader) GetAccountDataReader() (AccountDataReader, error) {
JsonListReader: listreader,
}, nil
}
+
+func (r *JsonInitDataReader) GetChainOwner() (common.Address, error) {
+ return common.Address{}, nil
+}
diff --git a/statetransfer/memdatareader.go b/statetransfer/memdatareader.go
index 1d60888937..3d6b68343c 100644
--- a/statetransfer/memdatareader.go
+++ b/statetransfer/memdatareader.go
@@ -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
}
diff --git a/system_tests/aliasing_test.go b/system_tests/aliasing_test.go
index 60a89468a5..e6c9dab45f 100644
--- a/system_tests/aliasing_test.go
+++ b/system_tests/aliasing_test.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
diff --git a/system_tests/batch_poster_test.go b/system_tests/batch_poster_test.go
index 0ec03e84c4..39d7fa576c 100644
--- a/system_tests/batch_poster_test.go
+++ b/system_tests/batch_poster_test.go
@@ -13,6 +13,7 @@ import (
"time"
"github.com/andybalholm/brotli"
+
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
diff --git a/system_tests/block_hash_test.go b/system_tests/block_hash_test.go
index b437f3dad9..454b4359ad 100644
--- a/system_tests/block_hash_test.go
+++ b/system_tests/block_hash_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
+
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
)
diff --git a/system_tests/blocks_reexecutor_test.go b/system_tests/blocks_reexecutor_test.go
index 1a97919e66..e9ef5a2260 100644
--- a/system_tests/blocks_reexecutor_test.go
+++ b/system_tests/blocks_reexecutor_test.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
+
blocksreexecutor "github.com/offchainlabs/nitro/blocks_reexecutor"
)
diff --git a/system_tests/bloom_test.go b/system_tests/bloom_test.go
index 68fb7c3add..df6c549dda 100644
--- a/system_tests/bloom_test.go
+++ b/system_tests/bloom_test.go
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
)
diff --git a/system_tests/common_test.go b/system_tests/common_test.go
index 9d491f522b..277c97858a 100644
--- a/system_tests/common_test.go
+++ b/system_tests/common_test.go
@@ -22,27 +22,6 @@ import (
"testing"
"time"
- "github.com/offchainlabs/nitro/arbos"
- "github.com/offchainlabs/nitro/arbos/arbostypes"
- "github.com/offchainlabs/nitro/arbos/util"
- "github.com/offchainlabs/nitro/arbstate/daprovider"
- "github.com/offchainlabs/nitro/arbutil"
- "github.com/offchainlabs/nitro/blsSignatures"
- "github.com/offchainlabs/nitro/cmd/chaininfo"
- "github.com/offchainlabs/nitro/cmd/conf"
- "github.com/offchainlabs/nitro/cmd/genericconf"
- "github.com/offchainlabs/nitro/das"
- "github.com/offchainlabs/nitro/deploy"
- "github.com/offchainlabs/nitro/execution/gethexec"
- "github.com/offchainlabs/nitro/util/arbmath"
- "github.com/offchainlabs/nitro/util/headerreader"
- "github.com/offchainlabs/nitro/util/redisutil"
- "github.com/offchainlabs/nitro/util/signature"
- "github.com/offchainlabs/nitro/validator/inputs"
- "github.com/offchainlabs/nitro/validator/server_api"
- "github.com/offchainlabs/nitro/validator/server_common"
- "github.com/offchainlabs/nitro/validator/valnode"
- rediscons "github.com/offchainlabs/nitro/validator/valnode/redis"
"github.com/redis/go-redis/v9"
"github.com/ethereum/go-ethereum"
@@ -73,15 +52,36 @@ import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/offchainlabs/nitro/arbnode"
+ "github.com/offchainlabs/nitro/arbos"
+ "github.com/offchainlabs/nitro/arbos/arbostypes"
+ "github.com/offchainlabs/nitro/arbos/util"
+ "github.com/offchainlabs/nitro/arbstate/daprovider"
+ "github.com/offchainlabs/nitro/arbutil"
+ "github.com/offchainlabs/nitro/blsSignatures"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
+ "github.com/offchainlabs/nitro/cmd/conf"
+ "github.com/offchainlabs/nitro/cmd/genericconf"
+ "github.com/offchainlabs/nitro/das"
+ "github.com/offchainlabs/nitro/deploy"
+ "github.com/offchainlabs/nitro/execution/gethexec"
_ "github.com/offchainlabs/nitro/execution/nodeInterface"
"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/arbmath"
+ "github.com/offchainlabs/nitro/util/headerreader"
+ "github.com/offchainlabs/nitro/util/redisutil"
+ "github.com/offchainlabs/nitro/util/signature"
"github.com/offchainlabs/nitro/util/testhelpers"
"github.com/offchainlabs/nitro/util/testhelpers/env"
"github.com/offchainlabs/nitro/util/testhelpers/github"
+ "github.com/offchainlabs/nitro/validator/inputs"
+ "github.com/offchainlabs/nitro/validator/server_api"
+ "github.com/offchainlabs/nitro/validator/server_common"
+ "github.com/offchainlabs/nitro/validator/valnode"
+ rediscons "github.com/offchainlabs/nitro/validator/valnode/redis"
)
type info = *BlockchainTestInfo
@@ -286,7 +286,7 @@ func L3NitroConfigDefaultTest(t *testing.T) *NitroConfig {
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
- ArbitrumChainParams: params.ArbitrumDevTestParams(),
+ ArbitrumChainParams: chaininfo.ArbitrumDevTestParams(),
Clique: ¶ms.CliqueConfig{
Period: 0,
Epoch: 0,
@@ -320,7 +320,7 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder {
b.takeOwnership = true
b.nodeConfig = arbnode.ConfigDefaultL2Test()
}
- b.chainConfig = params.ArbitrumDevTestChainConfig()
+ b.chainConfig = chaininfo.ArbitrumDevTestChainConfig()
b.L1Info = NewL1TestInfo(t)
b.L2Info = NewArbTestInfo(t, b.chainConfig.ChainID)
b.dataDir = t.TempDir()
@@ -375,7 +375,7 @@ func (b *NodeBuilder) Build(t *testing.T) func() {
func (b *NodeBuilder) CheckConfig(t *testing.T) {
if b.chainConfig == nil {
- b.chainConfig = params.ArbitrumDevTestChainConfig()
+ b.chainConfig = chaininfo.ArbitrumDevTestChainConfig()
}
if b.nodeConfig == nil {
b.nodeConfig = arbnode.ConfigDefaultL1Test()
@@ -1179,7 +1179,7 @@ func createTestL1BlockChain(t *testing.T, l1info info) (info, *ethclient.Client,
stackConfig := testhelpers.CreateStackConfigForTest(t.TempDir())
l1info.GenerateAccount("Faucet")
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams = params.ArbitrumChainParams{}
stack, err := node.New(stackConfig)
@@ -1509,7 +1509,7 @@ func setupConfigWithDAS(
t *testing.T, ctx context.Context, dasModeString string,
) (*params.ChainConfig, *arbnode.Config, *das.LifecycleManager, string, *blsSignatures.PublicKey) {
l1NodeConfigA := arbnode.ConfigDefaultL1Test()
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
var dbPath string
var err error
@@ -1517,10 +1517,10 @@ func setupConfigWithDAS(
switch dasModeString {
case "db":
enableDbStorage = true
- chainConfig = params.ArbitrumDevTestDASChainConfig()
+ chainConfig = chaininfo.ArbitrumDevTestDASChainConfig()
case "files":
enableFileStorage = true
- chainConfig = params.ArbitrumDevTestDASChainConfig()
+ chainConfig = chaininfo.ArbitrumDevTestDASChainConfig()
case "onchain":
enableDas = false
default:
diff --git a/system_tests/conditionaltx_test.go b/system_tests/conditionaltx_test.go
index 286060e666..2d9140ffcd 100644
--- a/system_tests/conditionaltx_test.go
+++ b/system_tests/conditionaltx_test.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
)
diff --git a/system_tests/contract_tx_test.go b/system_tests/contract_tx_test.go
index c1ef840c43..306b8fada3 100644
--- a/system_tests/contract_tx_test.go
+++ b/system_tests/contract_tx_test.go
@@ -14,9 +14,10 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbostypes"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/util/arbmath"
)
@@ -54,7 +55,7 @@ func TestContractTxDeploy(t *testing.T) {
// #nosec G115
requestId[0] = uint8(stateNonce)
contractTx := &types.ArbitrumContractTx{
- ChainId: params.ArbitrumDevTestChainConfig().ChainID,
+ ChainId: chaininfo.ArbitrumDevTestChainConfig().ChainID,
RequestId: requestId,
From: from,
GasFeeCap: big.NewInt(1e9),
diff --git a/system_tests/das_test.go b/system_tests/das_test.go
index 689ee924e1..52703c879d 100644
--- a/system_tests/das_test.go
+++ b/system_tests/das_test.go
@@ -21,10 +21,10 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
- "github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/blsSignatures"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/das"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
@@ -201,7 +201,7 @@ func TestDASComplexConfigAndRestMirror(t *testing.T) {
// Setup L1 chain and contracts
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
- builder.chainConfig = params.ArbitrumDevTestDASChainConfig()
+ builder.chainConfig = chaininfo.ArbitrumDevTestDASChainConfig()
builder.BuildL1(t)
arbSys, _ := precompilesgen.NewArbSys(types.ArbSysAddress, builder.L1.Client)
@@ -329,7 +329,7 @@ func TestDASBatchPosterFallback(t *testing.T) {
// Setup L1
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
- builder.chainConfig = params.ArbitrumDevTestDASChainConfig()
+ builder.chainConfig = chaininfo.ArbitrumDevTestDASChainConfig()
builder.BuildL1(t)
l1client := builder.L1.Client
l1info := builder.L1Info
diff --git a/system_tests/db_conversion_test.go b/system_tests/db_conversion_test.go
index aca28262cb..d19629fade 100644
--- a/system_tests/db_conversion_test.go
+++ b/system_tests/db_conversion_test.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/trie"
+
"github.com/offchainlabs/nitro/cmd/dbconv/dbconv"
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/system_tests/debugapi_test.go b/system_tests/debugapi_test.go
index eb2bcd095d..6be79ed4c9 100644
--- a/system_tests/debugapi_test.go
+++ b/system_tests/debugapi_test.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
)
diff --git a/system_tests/delayedinbox_test.go b/system_tests/delayedinbox_test.go
index ca3e7b5999..346b0fbc2f 100644
--- a/system_tests/delayedinbox_test.go
+++ b/system_tests/delayedinbox_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
)
diff --git a/system_tests/estimation_test.go b/system_tests/estimation_test.go
index 6285702342..e489b1864e 100644
--- a/system_tests/estimation_test.go
+++ b/system_tests/estimation_test.go
@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/gasestimator"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/node_interfacegen"
diff --git a/system_tests/forwarder_test.go b/system_tests/forwarder_test.go
index 6a1d1c68d8..843668454d 100644
--- a/system_tests/forwarder_test.go
+++ b/system_tests/forwarder_test.go
@@ -15,7 +15,9 @@ import (
"time"
"github.com/alicebob/miniredis/v2"
+
"github.com/ethereum/go-ethereum/ethclient"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/util/redisutil"
)
diff --git a/system_tests/infra_fee_test.go b/system_tests/infra_fee_test.go
index 9366fc204e..2e03eb0815 100644
--- a/system_tests/infra_fee_test.go
+++ b/system_tests/infra_fee_test.go
@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
diff --git a/system_tests/initialization_test.go b/system_tests/initialization_test.go
index 17e020e6ab..4807a8e67a 100644
--- a/system_tests/initialization_test.go
+++ b/system_tests/initialization_test.go
@@ -10,7 +10,8 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/params"
+
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/statetransfer"
"github.com/offchainlabs/nitro/util/testhelpers"
)
@@ -50,7 +51,7 @@ func TestInitContract(t *testing.T) {
defer cancel()
expectedSums := make(map[common.Address]*big.Int)
prand := testhelpers.NewPseudoRandomDataSource(t, 1)
- l2info := NewArbTestInfo(t, params.ArbitrumDevTestChainConfig().ChainID)
+ l2info := NewArbTestInfo(t, chaininfo.ArbitrumDevTestChainConfig().ChainID)
for i := 0; i < 50; i++ {
contractData, sum := InitOneContract(prand)
accountAddress := prand.GetAddress()
diff --git a/system_tests/log_subscription_test.go b/system_tests/log_subscription_test.go
index e4402533a6..4d38ea6e9c 100644
--- a/system_tests/log_subscription_test.go
+++ b/system_tests/log_subscription_test.go
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
)
diff --git a/system_tests/meaningless_reorg_test.go b/system_tests/meaningless_reorg_test.go
index 06a5d3d2b3..350b21a6cf 100644
--- a/system_tests/meaningless_reorg_test.go
+++ b/system_tests/meaningless_reorg_test.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
)
diff --git a/system_tests/nodeinterface_test.go b/system_tests/nodeinterface_test.go
index 927dc1b630..5c32dcf20f 100644
--- a/system_tests/nodeinterface_test.go
+++ b/system_tests/nodeinterface_test.go
@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/solgen/go/node_interfacegen"
)
diff --git a/system_tests/outbox_test.go b/system_tests/outbox_test.go
index 25c52396f9..ea6dc2be8b 100644
--- a/system_tests/outbox_test.go
+++ b/system_tests/outbox_test.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/gethhook"
"github.com/offchainlabs/nitro/solgen/go/node_interfacegen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
diff --git a/system_tests/precompile_doesnt_revert_test.go b/system_tests/precompile_doesnt_revert_test.go
index e6751d347d..fc4b0e745e 100644
--- a/system_tests/precompile_doesnt_revert_test.go
+++ b/system_tests/precompile_doesnt_revert_test.go
@@ -13,8 +13,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/l1pricing"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
)
@@ -156,7 +157,7 @@ func TestArbOwnerDoesntRevert(t *testing.T) {
arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, builder.L2.Client)
Require(t, err)
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams.MaxCodeSize = 100
serializedChainConfig, err := json.Marshal(chainConfig)
Require(t, err)
diff --git a/system_tests/precompile_fuzz_test.go b/system_tests/precompile_fuzz_test.go
index 8ab133cf58..82dd393ea2 100644
--- a/system_tests/precompile_fuzz_test.go
+++ b/system_tests/precompile_fuzz_test.go
@@ -12,10 +12,11 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/burn"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/gethhook"
"github.com/offchainlabs/nitro/precompiles"
)
@@ -32,7 +33,7 @@ func FuzzPrecompiles(f *testing.F) {
panic(err)
}
burner := burn.NewSystemBurner(nil, false)
- chainConfig := params.ArbitrumDevTestChainConfig()
+ chainConfig := chaininfo.ArbitrumDevTestChainConfig()
_, err = arbosState.InitializeArbosState(sdb, burner, chainConfig, arbostypes.TestInitMessage)
if err != nil {
panic(err)
diff --git a/system_tests/precompile_test.go b/system_tests/precompile_test.go
index 9d5737c249..78f34df6c7 100644
--- a/system_tests/precompile_test.go
+++ b/system_tests/precompile_test.go
@@ -14,9 +14,10 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/l1pricing"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
@@ -37,7 +38,7 @@ func TestPurePrecompileMethodCalls(t *testing.T) {
Require(t, err, "could not deploy ArbSys contract")
chainId, err := arbSys.ArbChainID(&bind.CallOpts{})
Require(t, err, "failed to get the ChainID")
- if chainId.Uint64() != params.ArbitrumDevTestChainConfig().ChainID.Uint64() {
+ if chainId.Uint64() != chaininfo.ArbitrumDevTestChainConfig().ChainID.Uint64() {
Fatal(t, "Wrong ChainID", chainId.Uint64())
}
@@ -433,12 +434,15 @@ func TestGasAccountingParams(t *testing.T) {
Require(t, err)
arbGasInfoSpeedLimit, arbGasInfoPoolSize, arbGasInfoTxGasLimit, err := arbGasInfo.GetGasAccountingParams(&bind.CallOpts{Context: ctx})
Require(t, err)
+ // #nosec G115
if arbGasInfoSpeedLimit.Cmp(big.NewInt(int64(speedLimit))) != 0 {
Fatal(t, "expected speed limit to be", speedLimit, "got", arbGasInfoSpeedLimit)
}
+ // #nosec G115
if arbGasInfoPoolSize.Cmp(big.NewInt(int64(txGasLimit))) != 0 {
Fatal(t, "expected pool size to be", txGasLimit, "got", arbGasInfoPoolSize)
}
+ // #nosec G115
if arbGasInfoTxGasLimit.Cmp(big.NewInt(int64(txGasLimit))) != 0 {
Fatal(t, "expected tx gas limit to be", txGasLimit, "got", arbGasInfoTxGasLimit)
}
diff --git a/system_tests/program_gas_test.go b/system_tests/program_gas_test.go
index 10a371532d..3450214a14 100644
--- a/system_tests/program_gas_test.go
+++ b/system_tests/program_gas_test.go
@@ -2,6 +2,7 @@ package arbtest
import (
"context"
+ "encoding/binary"
"fmt"
"math"
"math/big"
@@ -13,9 +14,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
@@ -23,6 +26,162 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)
+const HOSTIO_INK = 8400
+
+func checkInkUsage(
+ t *testing.T,
+ builder *NodeBuilder,
+ stylusProgram common.Address,
+ hostio string,
+ signature string,
+ params []uint32,
+ expectedInk uint64,
+) {
+ toU256ByteSlice := func(i uint32) []byte {
+ arr := make([]byte, 32)
+ binary.BigEndian.PutUint32(arr[28:32], i)
+ return arr
+ }
+
+ testName := fmt.Sprintf("%v_%v", signature, params)
+
+ data := crypto.Keccak256([]byte(signature))[:4]
+ for _, p := range params {
+ data = append(data, toU256ByteSlice(p)...)
+ }
+
+ const txGas uint64 = 32_000_000
+ tx := builder.L2Info.PrepareTxTo("Owner", &stylusProgram, txGas, nil, data)
+
+ err := builder.L2.Client.SendTransaction(builder.ctx, tx)
+ Require(t, err, "testName", testName)
+ _, err = builder.L2.EnsureTxSucceeded(tx)
+ Require(t, err, "testName", testName)
+
+ stylusGasUsage, err := stylusHostiosGasUsage(builder.ctx, builder.L2.Client.Client(), tx)
+ Require(t, err, "testName", testName)
+
+ _, ok := stylusGasUsage[hostio]
+ if !ok {
+ Fatal(t, "hostio not found in gas usage", "hostio", hostio, "stylusGasUsage", stylusGasUsage, "testName", testName)
+ }
+
+ if len(stylusGasUsage[hostio]) != 1 {
+ Fatal(t, "unexpected number of gas usage", "hostio", hostio, "stylusGasUsage", stylusGasUsage, "testName", testName)
+ }
+
+ expectedGas := float64(expectedInk) / 10000
+ returnedGas := stylusGasUsage[hostio][0]
+ if math.Abs(expectedGas-returnedGas) > 1e-9 {
+ Fatal(t, "unexpected gas usage", "hostio", hostio, "expected", expectedGas, "returned", returnedGas, "testName", testName)
+ }
+}
+
+func TestWriteResultGasUsage(t *testing.T) {
+ t.Parallel()
+
+ builder := setupGasCostTest(t)
+ auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
+ stylusProgram := deployWasm(t, builder.ctx, auth, builder.L2.Client, rustFile("hostio-test"))
+
+ hostio := "write_result"
+
+ // writeResultEmpty doesn't return any value
+ signature := "writeResultEmpty()"
+ expectedInk := HOSTIO_INK + 16381*2
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, nil, uint64(expectedInk))
+
+ // writeResult(uint256) returns an array of uint256
+ signature = "writeResult(uint256)"
+ numberOfElementsInReturnedArray := 10000
+ arrayOverhead := 32 + 32 // 32 bytes for the array length and 32 bytes for the array offset
+ expectedInk = HOSTIO_INK + (16381+55*(32*numberOfElementsInReturnedArray+arrayOverhead-32))*2
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{uint32(numberOfElementsInReturnedArray)}, uint64(expectedInk))
+
+ signature = "writeResult(uint256)"
+ numberOfElementsInReturnedArray = 0
+ expectedInk = HOSTIO_INK + (16381+55*(arrayOverhead-32))*2
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{uint32(numberOfElementsInReturnedArray)}, uint64(expectedInk))
+}
+
+func TestReadArgsGasUsage(t *testing.T) {
+ t.Parallel()
+
+ builder := setupGasCostTest(t)
+ auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
+ stylusProgram := deployWasm(t, builder.ctx, auth, builder.L2.Client, rustFile("hostio-test"))
+
+ hostio := "read_args"
+
+ signature := "readArgsNoArgs()"
+ expectedInk := HOSTIO_INK + 5040
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, nil, uint64(expectedInk))
+
+ signature = "readArgsOneArg(uint256)"
+ signatureOverhead := 4
+ expectedInk = HOSTIO_INK + 5040 + 30*(32+signatureOverhead-32)
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{1}, uint64(expectedInk))
+
+ signature = "readArgsThreeArgs(uint256,uint256,uint256)"
+ expectedInk = HOSTIO_INK + 5040 + 30*(3*32+signatureOverhead-32)
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{1, 1, 1}, uint64(expectedInk))
+}
+
+func TestMsgReentrantGasUsage(t *testing.T) {
+ t.Parallel()
+
+ builder := setupGasCostTest(t)
+ auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
+ stylusProgram := deployWasm(t, builder.ctx, auth, builder.L2.Client, rustFile("hostio-test"))
+
+ hostio := "msg_reentrant"
+
+ signature := "writeResultEmpty()"
+ expectedInk := HOSTIO_INK
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, nil, uint64(expectedInk))
+}
+
+func TestStorageCacheBytes32GasUsage(t *testing.T) {
+ t.Parallel()
+
+ builder := setupGasCostTest(t)
+ auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
+ stylusProgram := deployWasm(t, builder.ctx, auth, builder.L2.Client, rustFile("hostio-test"))
+
+ hostio := "storage_cache_bytes32"
+
+ signature := "storageCacheBytes32()"
+ expectedInk := HOSTIO_INK + (13440-HOSTIO_INK)*2
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, nil, uint64(expectedInk))
+}
+
+func TestPayForMemoryGrowGasUsage(t *testing.T) {
+ t.Parallel()
+
+ builder := setupGasCostTest(t)
+ auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
+ stylusProgram := deployWasm(t, builder.ctx, auth, builder.L2.Client, rustFile("hostio-test"))
+
+ hostio := "pay_for_memory_grow"
+ signature := "payForMemoryGrow(uint256)"
+
+ expectedInk := 9320660000
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{100}, uint64(expectedInk))
+
+ expectedInk = HOSTIO_INK
+ // #nosec G115
+ checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{0}, uint64(expectedInk))
+}
+
func TestProgramSimpleCost(t *testing.T) {
builder := setupGasCostTest(t)
auth := builder.L2Info.GetDefaultTransactOpts("Owner", builder.ctx)
diff --git a/system_tests/program_norace_test.go b/system_tests/program_norace_test.go
index 56b2046716..b1e5af8395 100644
--- a/system_tests/program_norace_test.go
+++ b/system_tests/program_norace_test.go
@@ -16,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/tracers"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
diff --git a/system_tests/program_recursive_test.go b/system_tests/program_recursive_test.go
index e928f9f3aa..ca726c684d 100644
--- a/system_tests/program_recursive_test.go
+++ b/system_tests/program_recursive_test.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
diff --git a/system_tests/program_test.go b/system_tests/program_test.go
index ea4ccddd03..5fbb1189c7 100644
--- a/system_tests/program_test.go
+++ b/system_tests/program_test.go
@@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbcompress"
"github.com/offchainlabs/nitro/arbos/programs"
"github.com/offchainlabs/nitro/arbos/util"
@@ -1000,6 +1001,31 @@ func testCreate(t *testing.T, jit bool) {
validateBlockRange(t, blocks, jit, builder)
}
+func TestProgramInfiniteLoopShouldCauseErrOutOfGas(t *testing.T) {
+ t.Parallel()
+ testInfiniteLoopCausesErrOutOfGas(t, true)
+ testInfiniteLoopCausesErrOutOfGas(t, false)
+}
+
+func testInfiniteLoopCausesErrOutOfGas(t *testing.T, jit bool) {
+ builder, auth, cleanup := setupProgramTest(t, jit)
+ ctx := builder.ctx
+ l2info := builder.L2Info
+ l2client := builder.L2.Client
+ defer cleanup()
+
+ userWasm := deployWasm(t, ctx, auth, l2client, "../arbitrator/prover/test-cases/user.wat")
+ // Passing input of size 4 invokes $infinite_loop function that calls the infinite loop
+ tx := l2info.PrepareTxTo("Owner", &userWasm, 1000000, nil, make([]byte, 4))
+ Require(t, l2client.SendTransaction(ctx, tx))
+ receipt, err := EnsureTxSucceeded(ctx, l2client, tx)
+ if !strings.Contains(err.Error(), vm.ErrOutOfGas.Error()) {
+ t.Fatalf("transaction should have failed with out of gas error but instead failed with: %v", err)
+ }
+
+ validateBlocks(t, receipt.BlockNumber.Uint64(), jit, builder)
+}
+
func TestProgramMemory(t *testing.T) {
t.Parallel()
testMemory(t, true)
diff --git a/system_tests/pruning_test.go b/system_tests/pruning_test.go
index 90ac3c6909..f49ed8ddcf 100644
--- a/system_tests/pruning_test.go
+++ b/system_tests/pruning_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/trie"
+
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/pruning"
"github.com/offchainlabs/nitro/execution/gethexec"
diff --git a/system_tests/recreatestate_rpc_test.go b/system_tests/recreatestate_rpc_test.go
index 22329a1be5..dc1356347c 100644
--- a/system_tests/recreatestate_rpc_test.go
+++ b/system_tests/recreatestate_rpc_test.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
+
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/util"
)
diff --git a/system_tests/retryable_test.go b/system_tests/retryable_test.go
index 89446e3c4b..55d26c8372 100644
--- a/system_tests/retryable_test.go
+++ b/system_tests/retryable_test.go
@@ -16,13 +16,14 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/gasestimator"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbos/retryables"
"github.com/offchainlabs/nitro/arbos/util"
-
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/node_interfacegen"
@@ -75,7 +76,7 @@ func retryableSetup(t *testing.T, modifyNodeConfig ...func(*NodeBuilder)) (
if !msgTypes[message.Message.Header.Kind] {
continue
}
- txs, err := arbos.ParseL2Transactions(message.Message, params.ArbitrumDevTestChainConfig().ChainID)
+ txs, err := arbos.ParseL2Transactions(message.Message, chaininfo.ArbitrumDevTestChainConfig().ChainID)
Require(t, err)
for _, tx := range txs {
if txTypes[tx.Type()] {
diff --git a/system_tests/seq_coordinator_test.go b/system_tests/seq_coordinator_test.go
index e7d8bf6b39..76cff95f04 100644
--- a/system_tests/seq_coordinator_test.go
+++ b/system_tests/seq_coordinator_test.go
@@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"math/big"
- "net"
"testing"
"time"
@@ -153,7 +152,15 @@ func TestRedisSeqCoordinatorPriorities(t *testing.T) {
nodeForwardTarget := func(nodeNum int) int {
execNode := testNodes[nodeNum].ExecNode
- fwTarget := execNode.TxPublisher.(*gethexec.TxPreChecker).TransactionPublisher.(*gethexec.Sequencer).ForwardTarget()
+ preChecker, ok := execNode.TxPublisher.(*gethexec.TxPreChecker)
+ if !ok {
+ return -1
+ }
+ sequencer, ok := preChecker.TransactionPublisher.(*gethexec.Sequencer)
+ if !ok {
+ return -1
+ }
+ fwTarget := sequencer.ForwardTarget()
if fwTarget == "" {
return -1
}
@@ -323,7 +330,7 @@ func testCoordinatorMessageSync(t *testing.T, successCase bool) {
// nodeB doesn't sequence transactions, but adds messages related to them to its output feed.
// nodeBOutputFeedReader reads those messages from this feed and processes them.
// nodeBOutputFeedReader doesn't read messages from L1 since none of the nodes posts to L1.
- nodeBPort := testClientB.ConsensusNode.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ nodeBPort := testhelpers.AddrTCPPort(testClientB.ConsensusNode.BroadcastServer.ListenerAddr(), t)
nodeConfigNodeBOutputFeedReader := arbnode.ConfigDefaultL1NonSequencerTest()
nodeConfigNodeBOutputFeedReader.Feed.Input = *newBroadcastClientConfigTest(nodeBPort)
testClientNodeBOutputFeedReader, cleanupNodeBOutputFeedReader := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: nodeConfigNodeBOutputFeedReader})
diff --git a/system_tests/seq_nonce_test.go b/system_tests/seq_nonce_test.go
index c099563e29..7486b8a4ae 100644
--- a/system_tests/seq_nonce_test.go
+++ b/system_tests/seq_nonce_test.go
@@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
+
"github.com/offchainlabs/nitro/util/arbmath"
)
diff --git a/system_tests/seq_pause_test.go b/system_tests/seq_pause_test.go
index 6ce464d8da..c867a98271 100644
--- a/system_tests/seq_pause_test.go
+++ b/system_tests/seq_pause_test.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/execution/gethexec"
)
diff --git a/system_tests/seq_reject_test.go b/system_tests/seq_reject_test.go
index 2dbdba6804..be230e26f5 100644
--- a/system_tests/seq_reject_test.go
+++ b/system_tests/seq_reject_test.go
@@ -7,7 +7,6 @@ import (
"context"
"fmt"
"math/big"
- "net"
"strings"
"sync"
"sync/atomic"
@@ -17,9 +16,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/colors"
+ "github.com/offchainlabs/nitro/util/testhelpers"
)
func TestSequencerRejection(t *testing.T) {
@@ -35,7 +36,7 @@ func TestSequencerRejection(t *testing.T) {
builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder.takeOwnership = false
- port := builderSeq.L2.ConsensusNode.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(builderSeq.L2.ConsensusNode.BroadcastServer.ListenerAddr(), t)
builder.nodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
cleanup := builder.Build(t)
defer cleanup()
diff --git a/system_tests/seqcompensation_test.go b/system_tests/seqcompensation_test.go
index 156ced6bfc..41133b8a42 100644
--- a/system_tests/seqcompensation_test.go
+++ b/system_tests/seqcompensation_test.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos/l1pricing"
)
diff --git a/system_tests/seqfeed_test.go b/system_tests/seqfeed_test.go
index 21f0755225..b757291561 100644
--- a/system_tests/seqfeed_test.go
+++ b/system_tests/seqfeed_test.go
@@ -7,7 +7,6 @@ import (
"context"
"fmt"
"math/big"
- "net"
"reflect"
"testing"
"time"
@@ -15,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/l1pricing"
@@ -61,7 +61,7 @@ func TestSequencerFeed(t *testing.T) {
defer cleanupSeq()
seqInfo, seqNode, seqClient := builderSeq.L2Info, builderSeq.L2.ConsensusNode, builderSeq.L2.Client
- port := seqNode.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(seqNode.BroadcastServer.ListenerAddr(), t)
builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder.nodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
builder.takeOwnership = false
@@ -107,7 +107,7 @@ func TestRelayedSequencerFeed(t *testing.T) {
Require(t, err)
config := relay.ConfigDefault
- port := seqNode.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(seqNode.BroadcastServer.ListenerAddr(), t)
config.Node.Feed.Input = *newBroadcastClientConfigTest(port)
config.Node.Feed.Output = *newBroadcasterConfigTest()
config.Chain.ID = bigChainId.Uint64()
@@ -119,7 +119,7 @@ func TestRelayedSequencerFeed(t *testing.T) {
Require(t, err)
defer currentRelay.StopAndWait()
- port = currentRelay.GetListenerAddr().(*net.TCPAddr).Port
+ port = testhelpers.AddrTCPPort(currentRelay.GetListenerAddr(), t)
builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder.nodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
builder.takeOwnership = false
@@ -219,7 +219,7 @@ func testLyingSequencer(t *testing.T, dasModeStr string) {
defer cleanupC()
l2clientC, nodeC := testClientC.Client, testClientC.ConsensusNode
- port := nodeC.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(nodeC.BroadcastServer.ListenerAddr(), t)
// The client node, connects to lying sequencer's feed
nodeConfigB := arbnode.ConfigDefaultL1NonSequencerTest()
@@ -361,7 +361,7 @@ func testBlockHashComparison(t *testing.T, blockHash *common.Hash, mustMismatch
}
defer wsBroadcastServer.StopAndWait()
- port := wsBroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(wsBroadcastServer.ListenerAddr(), t)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder.nodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
@@ -468,7 +468,7 @@ func TestPopulateFeedBacklog(t *testing.T) {
// Creates a sink node that will read from the output feed of the previous node.
nodeConfigSink := builder.nodeConfig
- port := builder.L2.ConsensusNode.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
+ port := testhelpers.AddrTCPPort(builder.L2.ConsensusNode.BroadcastServer.ListenerAddr(), t)
nodeConfigSink.Feed.Input = *newBroadcastClientConfigTest(port)
testClientSink, cleanupSink := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: nodeConfigSink})
defer cleanupSink()
diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go
index c8312350e6..8388e8417c 100644
--- a/system_tests/state_fuzz_test.go
+++ b/system_tests/state_fuzz_test.go
@@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
+
"github.com/offchainlabs/nitro/arbcompress"
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
@@ -27,6 +28,7 @@ import (
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbstate"
"github.com/offchainlabs/nitro/arbstate/daprovider"
+ "github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/statetransfer"
"github.com/offchainlabs/nitro/util/testhelpers/env"
)
@@ -135,7 +137,7 @@ func FuzzStateTransition(f *testing.F) {
return
}
chainDb := rawdb.NewMemoryDatabase()
- chainConfig := params.ArbitrumRollupGoerliTestnetChainConfig()
+ chainConfig := chaininfo.ArbitrumRollupGoerliTestnetChainConfig()
serializedChainConfig, err := json.Marshal(chainConfig)
if err != nil {
panic(err)
@@ -206,7 +208,7 @@ func FuzzStateTransition(f *testing.F) {
}
numberOfMessageRunModes := uint8(core.MessageReplayMode) + 1 // TODO update number of run modes when new mode is added
runMode := core.MessageRunMode(runModeSeed % numberOfMessageRunModes)
- _, err = BuildBlock(statedb, genesis, noopChainContext{}, params.ArbitrumOneChainConfig(), inbox, seqBatch, runMode)
+ _, err = BuildBlock(statedb, genesis, noopChainContext{}, chaininfo.ArbitrumOneChainConfig(), inbox, seqBatch, runMode)
if err != nil {
// With the fixed header it shouldn't be possible to read a delayed message,
// and no other type of error should be possible.
diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go
index 42faee7e0d..d5ed3fcd33 100644
--- a/system_tests/staterecovery_test.go
+++ b/system_tests/staterecovery_test.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/trie"
+
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/staterecovery"
"github.com/offchainlabs/nitro/execution/gethexec"
diff --git a/system_tests/stylus_trace_test.go b/system_tests/stylus_trace_test.go
index 52039df460..fe5de21dad 100644
--- a/system_tests/stylus_trace_test.go
+++ b/system_tests/stylus_trace_test.go
@@ -10,12 +10,14 @@ import (
"math/big"
"testing"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
- "github.com/holiman/uint256"
+
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
diff --git a/system_tests/stylus_tracer_test.go b/system_tests/stylus_tracer_test.go
index 7fda39f04e..b833d7df17 100644
--- a/system_tests/stylus_tracer_test.go
+++ b/system_tests/stylus_tracer_test.go
@@ -7,9 +7,11 @@ import (
"encoding/binary"
"testing"
+ "github.com/google/go-cmp/cmp"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
- "github.com/google/go-cmp/cmp"
+
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/util/containers"
diff --git a/system_tests/test_info.go b/system_tests/test_info.go
index 6313e392ca..105d491006 100644
--- a/system_tests/test_info.go
+++ b/system_tests/test_info.go
@@ -11,16 +11,16 @@ import (
"sync/atomic"
"testing"
- "github.com/offchainlabs/nitro/arbos/l2pricing"
- "github.com/offchainlabs/nitro/util"
-
"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/log"
"github.com/ethereum/go-ethereum/params"
+
+ "github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/statetransfer"
+ "github.com/offchainlabs/nitro/util"
)
var simulatedChainID = big.NewInt(1337)
diff --git a/system_tests/timeboost_test.go b/system_tests/timeboost_test.go
index 9163b02419..e2be1f965d 100644
--- a/system_tests/timeboost_test.go
+++ b/system_tests/timeboost_test.go
@@ -12,6 +12,8 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -23,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/broadcastclient"
@@ -38,7 +41,6 @@ import (
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/stretchr/testify/require"
)
func TestSequencerFeed_ExpressLaneAuction_ExpressLaneTxsHaveAdvantage_TimeboostedFieldIsCorrect(t *testing.T) {
@@ -316,9 +318,8 @@ func setupExpressLaneAuction(
builderSeq.nodeConfig.Feed.Output = *newBroadcasterConfigTest()
builderSeq.execConfig.Sequencer.Enable = true
builderSeq.execConfig.Sequencer.Timeboost = gethexec.TimeboostConfig{
- Enable: false, // We need to start without timeboost initially to create the auction contract
- ExpressLaneAdvantage: time.Second * 5,
- SequencerHTTPEndpoint: fmt.Sprintf("http://localhost:%d", seqPort),
+ Enable: false, // We need to start without timeboost initially to create the auction contract
+ ExpressLaneAdvantage: time.Second * 5,
}
cleanupSeq := builderSeq.Build(t)
seqInfo, seqNode, seqClient := builderSeq.L2Info, builderSeq.L2.ConsensusNode, builderSeq.L2.Client
@@ -479,7 +480,7 @@ func setupExpressLaneAuction(
// This is hacky- we are manually starting the ExpressLaneService here instead of letting it be started
// by the sequencer. This is due to needing to deploy the auction contract first.
builderSeq.execConfig.Sequencer.Timeboost.Enable = true
- builderSeq.L2.ExecNode.Sequencer.StartExpressLane(ctx, proxyAddr, seqInfo.GetAddress("AuctionContract"))
+ builderSeq.L2.ExecNode.Sequencer.StartExpressLane(ctx, builderSeq.L2.ExecNode.Backend.APIBackend(), builderSeq.L2.ExecNode.FilterSystem, proxyAddr, seqInfo.GetAddress("AuctionContract"))
t.Log("Started express lane service in sequencer")
// Set up an autonomous auction contract service that runs in the background in this test.
diff --git a/system_tests/triedb_race_test.go b/system_tests/triedb_race_test.go
index 7828cf386d..78a7258aea 100644
--- a/system_tests/triedb_race_test.go
+++ b/system_tests/triedb_race_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/system_tests/twonodeslong_test.go b/system_tests/twonodeslong_test.go
index 60707b83fb..5791661b16 100644
--- a/system_tests/twonodeslong_test.go
+++ b/system_tests/twonodeslong_test.go
@@ -14,10 +14,10 @@ import (
"testing"
"time"
+ "github.com/ethereum/go-ethereum/core/types"
+
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbutil"
-
- "github.com/ethereum/go-ethereum/core/types"
)
func testTwoNodesLong(t *testing.T, dasModeStr string) {
diff --git a/system_tests/unsupported_txtypes_test.go b/system_tests/unsupported_txtypes_test.go
index a228cb2454..6e92243c85 100644
--- a/system_tests/unsupported_txtypes_test.go
+++ b/system_tests/unsupported_txtypes_test.go
@@ -13,10 +13,11 @@ import (
"math/big"
"testing"
+ "github.com/holiman/uint256"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
- "github.com/holiman/uint256"
)
func TestBlobAndInternalTxsReject(t *testing.T) {
diff --git a/system_tests/validation_mock_test.go b/system_tests/validation_mock_test.go
index 912b48ea6a..ad19203093 100644
--- a/system_tests/validation_mock_test.go
+++ b/system_tests/validation_mock_test.go
@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
@@ -21,11 +22,10 @@ import (
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/validator"
+ validatorclient "github.com/offchainlabs/nitro/validator/client"
"github.com/offchainlabs/nitro/validator/server_api"
"github.com/offchainlabs/nitro/validator/server_arb"
"github.com/offchainlabs/nitro/validator/valnode"
-
- validatorclient "github.com/offchainlabs/nitro/validator/client"
)
type mockSpawner struct {
diff --git a/system_tests/wrap_transaction_test.go b/system_tests/wrap_transaction_test.go
index 36052fb2db..dd68c25d6a 100644
--- a/system_tests/wrap_transaction_test.go
+++ b/system_tests/wrap_transaction_test.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/headerreader"
diff --git a/timeboost/auctioneer.go b/timeboost/auctioneer.go
index 946bbf4d50..6c18890188 100644
--- a/timeboost/auctioneer.go
+++ b/timeboost/auctioneer.go
@@ -11,6 +11,11 @@ import (
"os"
"time"
+ "github.com/golang-jwt/jwt/v4"
+ "github.com/pkg/errors"
+ "github.com/spf13/pflag"
+ "golang.org/x/crypto/sha3"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -19,7 +24,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/golang-jwt/jwt/v4"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util"
"github.com/offchainlabs/nitro/pubsub"
@@ -27,9 +32,6 @@ import (
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/pkg/errors"
- "github.com/spf13/pflag"
- "golang.org/x/crypto/sha3"
)
// domainValue holds the Keccak256 hash of the string "TIMEBOOST_BID".
@@ -61,26 +63,29 @@ type AuctioneerServerConfig struct {
RedisURL string `koanf:"redis-url"`
ConsumerConfig pubsub.ConsumerConfig `koanf:"consumer-config"`
// Timeout on polling for existence of each redis stream.
- StreamTimeout time.Duration `koanf:"stream-timeout"`
- Wallet genericconf.WalletConfig `koanf:"wallet"`
- SequencerEndpoint string `koanf:"sequencer-endpoint"`
- SequencerJWTPath string `koanf:"sequencer-jwt-path"`
- AuctionContractAddress string `koanf:"auction-contract-address"`
- DbDirectory string `koanf:"db-directory"`
+ StreamTimeout time.Duration `koanf:"stream-timeout"`
+ Wallet genericconf.WalletConfig `koanf:"wallet"`
+ SequencerEndpoint string `koanf:"sequencer-endpoint"`
+ SequencerJWTPath string `koanf:"sequencer-jwt-path"`
+ AuctionContractAddress string `koanf:"auction-contract-address"`
+ DbDirectory string `koanf:"db-directory"`
+ AuctionResolutionWaitTime time.Duration `koanf:"auction-resolution-wait-time"`
}
var DefaultAuctioneerServerConfig = AuctioneerServerConfig{
- Enable: true,
- RedisURL: "",
- ConsumerConfig: pubsub.DefaultConsumerConfig,
- StreamTimeout: 10 * time.Minute,
+ Enable: true,
+ RedisURL: "",
+ ConsumerConfig: pubsub.DefaultConsumerConfig,
+ StreamTimeout: 10 * time.Minute,
+ AuctionResolutionWaitTime: 2 * time.Second,
}
var TestAuctioneerServerConfig = AuctioneerServerConfig{
- Enable: true,
- RedisURL: "",
- ConsumerConfig: pubsub.TestConsumerConfig,
- StreamTimeout: time.Minute,
+ Enable: true,
+ RedisURL: "",
+ ConsumerConfig: pubsub.TestConsumerConfig,
+ StreamTimeout: time.Minute,
+ AuctionResolutionWaitTime: 2 * time.Second,
}
func AuctioneerServerConfigAddOptions(prefix string, f *pflag.FlagSet) {
@@ -93,26 +98,28 @@ func AuctioneerServerConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.String(prefix+".sequencer-jwt-path", DefaultAuctioneerServerConfig.SequencerJWTPath, "sequencer jwt file path")
f.String(prefix+".auction-contract-address", DefaultAuctioneerServerConfig.AuctionContractAddress, "express lane auction contract address")
f.String(prefix+".db-directory", DefaultAuctioneerServerConfig.DbDirectory, "path to database directory for persisting validated bids in a sqlite file")
+ f.Duration(prefix+".auction-resolution-wait-time", DefaultAuctioneerServerConfig.AuctionResolutionWaitTime, "wait time after auction closing before resolving the auction")
}
// AuctioneerServer is a struct that represents an autonomous auctioneer.
// It is responsible for receiving bids, validating them, and resolving auctions.
type AuctioneerServer struct {
stopwaiter.StopWaiter
- consumer *pubsub.Consumer[*JsonValidatedBid, error]
- txOpts *bind.TransactOpts
- chainId *big.Int
- sequencerRpc *rpc.Client
- client *ethclient.Client
- auctionContract *express_lane_auctiongen.ExpressLaneAuction
- auctionContractAddr common.Address
- bidsReceiver chan *JsonValidatedBid
- bidCache *bidCache
- initialRoundTimestamp time.Time
- auctionClosingDuration time.Duration
- roundDuration time.Duration
- streamTimeout time.Duration
- database *SqliteDatabase
+ consumer *pubsub.Consumer[*JsonValidatedBid, error]
+ txOpts *bind.TransactOpts
+ chainId *big.Int
+ sequencerRpc *rpc.Client
+ client *ethclient.Client
+ auctionContract *express_lane_auctiongen.ExpressLaneAuction
+ auctionContractAddr common.Address
+ bidsReceiver chan *JsonValidatedBid
+ bidCache *bidCache
+ initialRoundTimestamp time.Time
+ auctionClosingDuration time.Duration
+ roundDuration time.Duration
+ streamTimeout time.Duration
+ auctionResolutionWaitTime time.Duration
+ database *SqliteDatabase
}
// NewAuctioneerServer creates a new autonomous auctioneer struct.
@@ -182,27 +189,32 @@ func NewAuctioneerServer(ctx context.Context, configFetcher AuctioneerServerConf
if err != nil {
return nil, err
}
- roundTimingInfo, err := auctionContract.RoundTimingInfo(&bind.CallOpts{})
+ var roundTimingInfo RoundTimingInfo
+ roundTimingInfo, err = auctionContract.RoundTimingInfo(&bind.CallOpts{})
if err != nil {
return nil, err
}
+ if err = roundTimingInfo.Validate(&cfg.AuctionResolutionWaitTime); err != nil {
+ return nil, err
+ }
auctionClosingDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.AuctionClosingSeconds) * time.Second
initialTimestamp := time.Unix(roundTimingInfo.OffsetTimestamp, 0)
roundDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.RoundDurationSeconds) * time.Second
return &AuctioneerServer{
- txOpts: txOpts,
- sequencerRpc: client,
- chainId: chainId,
- client: sequencerClient,
- database: database,
- consumer: c,
- auctionContract: auctionContract,
- auctionContractAddr: auctionContractAddr,
- bidsReceiver: make(chan *JsonValidatedBid, 100_000), // TODO(Terence): Is 100k enough? Make this configurable?
- bidCache: newBidCache(),
- initialRoundTimestamp: initialTimestamp,
- auctionClosingDuration: auctionClosingDuration,
- roundDuration: roundDuration,
+ txOpts: txOpts,
+ sequencerRpc: client,
+ chainId: chainId,
+ client: sequencerClient,
+ database: database,
+ consumer: c,
+ auctionContract: auctionContract,
+ auctionContractAddr: auctionContractAddr,
+ bidsReceiver: make(chan *JsonValidatedBid, 100_000), // TODO(Terence): Is 100k enough? Make this configurable?
+ bidCache: newBidCache(),
+ initialRoundTimestamp: initialTimestamp,
+ auctionClosingDuration: auctionClosingDuration,
+ roundDuration: roundDuration,
+ auctionResolutionWaitTime: cfg.AuctionResolutionWaitTime,
}, nil
}
@@ -302,8 +314,7 @@ func (a *AuctioneerServer) Start(ctx_in context.Context) {
return
case auctionClosingTime := <-ticker.c:
log.Info("New auction closing time reached", "closingTime", auctionClosingTime, "totalBids", a.bidCache.size())
- // Wait for two seconds, just to give some leeway for latency of bids received last minute.
- time.Sleep(2 * time.Second)
+ time.Sleep(a.auctionResolutionWaitTime)
if err := a.resolveAuction(ctx); err != nil {
log.Error("Could not resolve auction for round", "error", err)
}
diff --git a/timeboost/auctioneer_test.go b/timeboost/auctioneer_test.go
index 951dee8845..3e5e24a829 100644
--- a/timeboost/auctioneer_test.go
+++ b/timeboost/auctioneer_test.go
@@ -10,16 +10,18 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/pubsub"
"github.com/offchainlabs/nitro/util/redisutil"
- "github.com/stretchr/testify/require"
)
func TestBidValidatorAuctioneerRedisStream(t *testing.T) {
@@ -134,7 +136,7 @@ func TestBidValidatorAuctioneerRedisStream(t *testing.T) {
require.NoError(t, err)
_, err = bob.Bid(ctx, big.NewInt(int64(i)+1), bobAddr) // Bob bids 1 wei higher than Alice.
require.NoError(t, err)
- _, err = charlie.Bid(ctx, big.NewInt(int64(i)+2), charlieAddr) // Charlie bids 2 wei higher than the Bob.
+ _, err = charlie.Bid(ctx, big.NewInt(int64(i)+2), charlieAddr) // Charlie bids 2 wei higher than the Alice.
require.NoError(t, err)
}
@@ -153,10 +155,10 @@ func TestBidValidatorAuctioneerRedisStream(t *testing.T) {
// We also verify the top two bids are those we expect.
require.Equal(t, 3, len(am.bidCache.bidsByExpressLaneControllerAddr))
result := am.bidCache.topTwoBids()
- require.Equal(t, result.firstPlace.Amount, big.NewInt(6))
- require.Equal(t, result.firstPlace.Bidder, charlieAddr)
- require.Equal(t, result.secondPlace.Amount, big.NewInt(5))
- require.Equal(t, result.secondPlace.Bidder, bobAddr)
+ require.Equal(t, big.NewInt(7), result.firstPlace.Amount) // Best bid should be Charlie's last bid 7
+ require.Equal(t, charlieAddr, result.firstPlace.Bidder)
+ require.Equal(t, big.NewInt(6), result.secondPlace.Amount) // Second best bid should be Bob's last bid of 6
+ require.Equal(t, bobAddr, result.secondPlace.Bidder)
}
func TestRetryUntil(t *testing.T) {
diff --git a/timeboost/bid_cache_test.go b/timeboost/bid_cache_test.go
index c0aa7eafd5..8266fca202 100644
--- a/timeboost/bid_cache_test.go
+++ b/timeboost/bid_cache_test.go
@@ -7,13 +7,15 @@ import (
"net"
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/pubsub"
"github.com/offchainlabs/nitro/util/redisutil"
- "github.com/stretchr/testify/require"
)
func TestTopTwoBids(t *testing.T) {
diff --git a/timeboost/bid_validator.go b/timeboost/bid_validator.go
index b4b966d38b..218230bd59 100644
--- a/timeboost/bid_validator.go
+++ b/timeboost/bid_validator.go
@@ -7,6 +7,10 @@ import (
"sync"
"time"
+ "github.com/pkg/errors"
+ "github.com/redis/go-redis/v9"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
@@ -14,14 +18,12 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/pubsub"
"github.com/offchainlabs/nitro/solgen/go/express_lane_auctiongen"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/pkg/errors"
- "github.com/redis/go-redis/v9"
- "github.com/spf13/pflag"
)
type BidValidatorConfigFetcher func() *BidValidatorConfig
@@ -109,10 +111,14 @@ func NewBidValidator(
if err != nil {
return nil, err
}
- roundTimingInfo, err := auctionContract.RoundTimingInfo(&bind.CallOpts{})
+ var roundTimingInfo RoundTimingInfo
+ roundTimingInfo, err = auctionContract.RoundTimingInfo(&bind.CallOpts{})
if err != nil {
return nil, err
}
+ if err = roundTimingInfo.Validate(nil); err != nil {
+ return nil, err
+ }
initialTimestamp := time.Unix(int64(roundTimingInfo.OffsetTimestamp), 0)
roundDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.RoundDurationSeconds) * time.Second
auctionClosingDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.AuctionClosingSeconds) * time.Second
@@ -330,7 +336,7 @@ func (bv *BidValidator) validateBid(
bv.Lock()
numBids, ok := bv.bidsPerSenderInRound[bidder]
if !ok {
- bv.bidsPerSenderInRound[bidder] = 1
+ bv.bidsPerSenderInRound[bidder] = 0
}
if numBids >= bv.maxBidsPerSenderInRound {
bv.Unlock()
diff --git a/timeboost/bid_validator_test.go b/timeboost/bid_validator_test.go
index 6532596ab3..336e5a3429 100644
--- a/timeboost/bid_validator_test.go
+++ b/timeboost/bid_validator_test.go
@@ -8,10 +8,11 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/stretchr/testify/require"
)
func TestBidValidator_validateBid(t *testing.T) {
@@ -103,19 +104,19 @@ func TestBidValidator_validateBid(t *testing.T) {
for _, tt := range tests {
bv := BidValidator{
chainId: big.NewInt(1),
- initialRoundTimestamp: time.Now().Add(-time.Second),
+ initialRoundTimestamp: time.Now().Add(-time.Second * 3),
reservePrice: big.NewInt(2),
- roundDuration: time.Minute,
- auctionClosingDuration: 45 * time.Second,
+ roundDuration: 10 * time.Second,
+ auctionClosingDuration: 5 * time.Second,
auctionContract: setup.expressLaneAuction,
auctionContractAddr: setup.expressLaneAuctionAddr,
bidsPerSenderInRound: make(map[common.Address]uint8),
maxBidsPerSenderInRound: 5,
}
- if tt.auctionClosed {
- bv.roundDuration = 0
- }
t.Run(tt.name, func(t *testing.T) {
+ if tt.auctionClosed {
+ time.Sleep(time.Second * 3)
+ }
_, err := bv.validateBid(tt.bid, setup.expressLaneAuction.BalanceOf)
require.ErrorIs(t, err, tt.expectedErr)
require.Contains(t, err.Error(), tt.errMsg)
diff --git a/timeboost/bidder_client.go b/timeboost/bidder_client.go
index b48d8d4513..5581d8544c 100644
--- a/timeboost/bidder_client.go
+++ b/timeboost/bidder_client.go
@@ -6,6 +6,9 @@ import (
"math/big"
"time"
+ "github.com/pkg/errors"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@@ -13,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util"
"github.com/offchainlabs/nitro/solgen/go/express_lane_auctiongen"
@@ -21,8 +25,6 @@ import (
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/signature"
"github.com/offchainlabs/nitro/util/stopwaiter"
- "github.com/pkg/errors"
- "github.com/spf13/pflag"
)
type BidderClientConfigFetcher func() *BidderClientConfig
@@ -76,7 +78,8 @@ func NewBidderClient(
configFetcher BidderClientConfigFetcher,
) (*BidderClient, error) {
cfg := configFetcher()
- _, _ = cfg.BidGwei, cfg.DepositGwei
+ _ = cfg.BidGwei // These fields are used from cmd/bidder-client
+ _ = cfg.DepositGwei // this marks them as used for the linter.
if cfg.AuctionContractAddress == "" {
return nil, fmt.Errorf("auction contract address cannot be empty")
}
@@ -94,12 +97,16 @@ func NewBidderClient(
if err != nil {
return nil, err
}
- roundTimingInfo, err := auctionContract.RoundTimingInfo(&bind.CallOpts{
+ var roundTimingInfo RoundTimingInfo
+ roundTimingInfo, err = auctionContract.RoundTimingInfo(&bind.CallOpts{
Context: ctx,
})
if err != nil {
return nil, err
}
+ if err = roundTimingInfo.Validate(nil); err != nil {
+ return nil, err
+ }
initialTimestamp := time.Unix(int64(roundTimingInfo.OffsetTimestamp), 0)
roundDuration := arbmath.SaturatingCast[time.Duration](roundTimingInfo.RoundDurationSeconds) * time.Second
txOpts, signer, err := util.OpenWallet("bidder-client", &cfg.Wallet, chainId)
diff --git a/timeboost/db_test.go b/timeboost/db_test.go
index a193cdaf8f..600e5adc8e 100644
--- a/timeboost/db_test.go
+++ b/timeboost/db_test.go
@@ -6,10 +6,11 @@ import (
"testing"
"github.com/DATA-DOG/go-sqlmock"
- "github.com/ethereum/go-ethereum/common"
"github.com/jmoiron/sqlx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+
+ "github.com/ethereum/go-ethereum/common"
)
func TestInsertAndFetchBids(t *testing.T) {
diff --git a/timeboost/roundtiminginfo.go b/timeboost/roundtiminginfo.go
new file mode 100644
index 0000000000..74ceab4364
--- /dev/null
+++ b/timeboost/roundtiminginfo.go
@@ -0,0 +1,62 @@
+// Copyright 2024-2025, Offchain Labs, Inc.
+// For license information, see https://github.com/nitro/blob/master/LICENSE
+
+package timeboost
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/offchainlabs/nitro/util/arbmath"
+)
+
+// Solgen solidity bindings don't give names to return structs, give it a name for convenience.
+type RoundTimingInfo struct {
+ OffsetTimestamp int64
+ RoundDurationSeconds uint64
+ AuctionClosingSeconds uint64
+ ReserveSubmissionSeconds uint64
+}
+
+// Validate the RoundTimingInfo fields.
+// resolutionWaitTime is an additional parameter passed into the auctioneer that it
+// needs to validate against the other fields.
+func (c *RoundTimingInfo) Validate(resolutionWaitTime *time.Duration) error {
+ roundDuration := arbmath.SaturatingCast[time.Duration](c.RoundDurationSeconds) * time.Second
+ auctionClosing := arbmath.SaturatingCast[time.Duration](c.AuctionClosingSeconds) * time.Second
+ reserveSubmission := arbmath.SaturatingCast[time.Duration](c.ReserveSubmissionSeconds) * time.Second
+
+ // Validate minimum durations
+ if roundDuration < time.Second*10 {
+ return fmt.Errorf("RoundDurationSeconds (%d) must be at least 10 seconds", c.RoundDurationSeconds)
+ }
+
+ if auctionClosing < time.Second*5 {
+ return fmt.Errorf("AuctionClosingSeconds (%d) must be at least 5 seconds", c.AuctionClosingSeconds)
+ }
+
+ if reserveSubmission < time.Second {
+ return fmt.Errorf("ReserveSubmissionSeconds (%d) must be at least 1 second", c.ReserveSubmissionSeconds)
+ }
+
+ // Validate combined auction closing and reserve submission against round duration
+ combinedClosingTime := auctionClosing + reserveSubmission
+ if roundDuration <= combinedClosingTime {
+ return fmt.Errorf("RoundDurationSeconds (%d) must be greater than AuctionClosingSeconds (%d) + ReserveSubmissionSeconds (%d) = %d",
+ c.RoundDurationSeconds,
+ c.AuctionClosingSeconds,
+ c.ReserveSubmissionSeconds,
+ combinedClosingTime/time.Second)
+ }
+
+ // Validate resolution wait time if provided
+ if resolutionWaitTime != nil {
+ // Resolution wait time shouldn't be more than 50% of auction closing time
+ if *resolutionWaitTime > auctionClosing/2 {
+ return fmt.Errorf("resolution wait time (%v) must not exceed 50%% of auction closing time (%v)",
+ *resolutionWaitTime, auctionClosing)
+ }
+ }
+
+ return nil
+}
diff --git a/timeboost/setup_test.go b/timeboost/setup_test.go
index db9918b583..c093ab2d67 100644
--- a/timeboost/setup_test.go
+++ b/timeboost/setup_test.go
@@ -8,6 +8,8 @@ import (
"testing"
"time"
+ "github.com/stretchr/testify/require"
+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -15,11 +17,11 @@ import (
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/ethclient/simulated"
"github.com/ethereum/go-ethereum/node"
+
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/solgen/go/express_lane_auctiongen"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/timeboost/bindings"
- "github.com/stretchr/testify/require"
)
type auctionSetup struct {
diff --git a/timeboost/ticker.go b/timeboost/ticker.go
index c3a1777f0a..fa8d14c9dd 100644
--- a/timeboost/ticker.go
+++ b/timeboost/ticker.go
@@ -26,9 +26,9 @@ func (t *auctionCloseTicker) start() {
for {
now := time.Now()
// Calculate the start of the next round
- startOfNextMinute := now.Truncate(t.roundDuration).Add(t.roundDuration)
+ startOfNextRound := now.Truncate(t.roundDuration).Add(t.roundDuration)
// Subtract AUCTION_CLOSING_SECONDS seconds to get the tick time
- nextTickTime := startOfNextMinute.Add(-t.auctionClosingDuration)
+ nextTickTime := startOfNextRound.Add(-t.auctionClosingDuration)
// Ensure we are not setting a past tick time
if nextTickTime.Before(now) {
// If the calculated tick time is in the past, move to the next interval
@@ -77,3 +77,11 @@ func timeIntoRound(
roundDurationSeconds := uint64(roundDuration.Seconds())
return secondsSinceOffset % roundDurationSeconds
}
+
+func TimeTilNextRound(
+ initialTimestamp time.Time,
+ roundDuration time.Duration) time.Duration {
+ currentRoundNum := CurrentRound(initialTimestamp, roundDuration)
+ nextRoundStart := initialTimestamp.Add(roundDuration * arbmath.SaturatingCast[time.Duration](currentRoundNum+1))
+ return time.Until(nextRoundStart)
+}
diff --git a/util/arbmath/bits.go b/util/arbmath/bits.go
index 1b91e2755a..501ef9787e 100644
--- a/util/arbmath/bits.go
+++ b/util/arbmath/bits.go
@@ -6,8 +6,9 @@ package arbmath
import (
"encoding/binary"
- "github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256"
+
+ "github.com/ethereum/go-ethereum/common"
)
type bytes32 = common.Hash
diff --git a/util/arbmath/math_test.go b/util/arbmath/math_test.go
index 3660f3657e..befa7813e1 100644
--- a/util/arbmath/math_test.go
+++ b/util/arbmath/math_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/util/containers/syncmap.go b/util/containers/syncmap.go
index e24d56fda6..9190d81974 100644
--- a/util/containers/syncmap.go
+++ b/util/containers/syncmap.go
@@ -1,6 +1,9 @@
package containers
-import "sync"
+import (
+ "fmt"
+ "sync"
+)
type SyncMap[K any, V any] struct {
internal sync.Map
@@ -12,7 +15,11 @@ func (m *SyncMap[K, V]) Load(key K) (V, bool) {
var empty V
return empty, false
}
- return val.(V), true
+ vVal, ok := val.(V)
+ if !ok {
+ panic(fmt.Sprintf("type assertion failed on %s", val))
+ }
+ return vVal, true
}
func (m *SyncMap[K, V]) Store(key K, val V) {
@@ -27,7 +34,11 @@ func (m *SyncMap[K, V]) Delete(key K) {
func (m *SyncMap[K, V]) Keys() []K {
s := make([]K, 0)
m.internal.Range(func(k, v interface{}) bool {
- s = append(s, k.(K))
+ kKey, ok := k.(K)
+ if !ok {
+ panic(fmt.Sprintf("type assertion failed on %s", k))
+ }
+ s = append(s, kKey)
return true
})
return s
diff --git a/util/contracts/address_verifier.go b/util/contracts/address_verifier.go
index eb2f862210..66686e9dc8 100644
--- a/util/contracts/address_verifier.go
+++ b/util/contracts/address_verifier.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
)
diff --git a/util/dbutil/dbutil.go b/util/dbutil/dbutil.go
index 6573c5742c..28a57025e9 100644
--- a/util/dbutil/dbutil.go
+++ b/util/dbutil/dbutil.go
@@ -10,9 +10,10 @@ import (
"regexp"
"github.com/cockroachdb/pebble"
+ "github.com/syndtr/goleveldb/leveldb"
+
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb/memorydb"
- "github.com/syndtr/goleveldb/leveldb"
)
func IsErrNotFound(err error) bool {
diff --git a/util/headerreader/blob_client.go b/util/headerreader/blob_client.go
index fbdb4335a0..0c92ff2e85 100644
--- a/util/headerreader/blob_client.go
+++ b/util/headerreader/blob_client.go
@@ -15,16 +15,17 @@ import (
"path"
"time"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/blobs"
"github.com/offchainlabs/nitro/util/jsonapi"
"github.com/offchainlabs/nitro/util/pretty"
-
- "github.com/spf13/pflag"
)
type BlobClient struct {
diff --git a/util/headerreader/blob_client_test.go b/util/headerreader/blob_client_test.go
index 9735899daa..52c22e434a 100644
--- a/util/headerreader/blob_client_test.go
+++ b/util/headerreader/blob_client_test.go
@@ -11,8 +11,9 @@ import (
"reflect"
"testing"
- "github.com/offchainlabs/nitro/util/testhelpers"
"github.com/r3labs/diff/v3"
+
+ "github.com/offchainlabs/nitro/util/testhelpers"
)
func TestSaveBlobsToDisk(t *testing.T) {
diff --git a/util/headerreader/header_reader.go b/util/headerreader/header_reader.go
index 98f778dee8..f8e3bc6cd6 100644
--- a/util/headerreader/header_reader.go
+++ b/util/headerreader/header_reader.go
@@ -12,6 +12,8 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
@@ -19,9 +21,9 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
- flag "github.com/spf13/pflag"
)
// A regexp matching "execution reverted" errors returned from the parent chain RPC.
diff --git a/util/jsonapi/preimages_test.go b/util/jsonapi/preimages_test.go
index 3074a1e698..5b699df5fe 100644
--- a/util/jsonapi/preimages_test.go
+++ b/util/jsonapi/preimages_test.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/util/merkletree/merkleAccumulator_test.go b/util/merkletree/merkleAccumulator_test.go
index d26f0244d3..95e1862b7a 100644
--- a/util/merkletree/merkleAccumulator_test.go
+++ b/util/merkletree/merkleAccumulator_test.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/merkleAccumulator"
)
diff --git a/util/merkletree/merkleEventProof.go b/util/merkletree/merkleEventProof.go
index 130249cc3f..cab85dbefe 100644
--- a/util/merkletree/merkleEventProof.go
+++ b/util/merkletree/merkleEventProof.go
@@ -5,6 +5,7 @@ package merkletree
import (
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbos/merkleAccumulator"
)
diff --git a/util/merkletree/merkleEventProof_test.go b/util/merkletree/merkleEventProof_test.go
index 6af8479190..c0c8e777cb 100644
--- a/util/merkletree/merkleEventProof_test.go
+++ b/util/merkletree/merkleEventProof_test.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/merkleAccumulator"
"github.com/offchainlabs/nitro/arbos/storage"
diff --git a/util/merkletree/merkleTree.go b/util/merkletree/merkleTree.go
index fffa9bcabc..9cf7b485d9 100644
--- a/util/merkletree/merkleTree.go
+++ b/util/merkletree/merkleTree.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/arbos/util"
)
diff --git a/util/redisutil/test_redis.go b/util/redisutil/test_redis.go
index b6d2dc8fa8..271b3b48af 100644
--- a/util/redisutil/test_redis.go
+++ b/util/redisutil/test_redis.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/alicebob/miniredis/v2"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/util/rpcclient/rpcclient_test.go b/util/rpcclient/rpcclient_test.go
index 1a7da54774..f711747b70 100644
--- a/util/rpcclient/rpcclient_test.go
+++ b/util/rpcclient/rpcclient_test.go
@@ -9,10 +9,12 @@ import (
"testing"
"time"
- "github.com/ethereum/go-ethereum/node"
- "github.com/ethereum/go-ethereum/rpc"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
+
+ "github.com/ethereum/go-ethereum/node"
+ "github.com/ethereum/go-ethereum/rpc"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/util/sharedmetrics/sharedmetrics.go b/util/sharedmetrics/sharedmetrics.go
index 9b4b3609bc..1df34d4d54 100644
--- a/util/sharedmetrics/sharedmetrics.go
+++ b/util/sharedmetrics/sharedmetrics.go
@@ -2,6 +2,7 @@ package sharedmetrics
import (
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/util/signature/sign_verify.go b/util/signature/sign_verify.go
index 5ed852bfbc..f222860d8b 100644
--- a/util/signature/sign_verify.go
+++ b/util/signature/sign_verify.go
@@ -4,9 +4,11 @@ import (
"context"
"errors"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/util/contracts"
- flag "github.com/spf13/pflag"
)
type SignVerify struct {
diff --git a/util/stopwaiter/stopwaiter.go b/util/stopwaiter/stopwaiter.go
index 1e70e328eb..993768dd85 100644
--- a/util/stopwaiter/stopwaiter.go
+++ b/util/stopwaiter/stopwaiter.go
@@ -13,6 +13,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/containers"
)
diff --git a/util/stopwaiter/stopwaiter_test.go b/util/stopwaiter/stopwaiter_test.go
index 5319927887..c561e1f43b 100644
--- a/util/stopwaiter/stopwaiter_test.go
+++ b/util/stopwaiter/stopwaiter_test.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/util/testhelpers/env/env.go b/util/testhelpers/env/env.go
index 27d74465de..2a8090c212 100644
--- a/util/testhelpers/env/env.go
+++ b/util/testhelpers/env/env.go
@@ -14,7 +14,7 @@ import (
// An environment variable controls that behavior.
func GetTestStateScheme() string {
envTestStateScheme := os.Getenv("TEST_STATE_SCHEME")
- stateScheme := rawdb.PathScheme
+ stateScheme := rawdb.HashScheme
if envTestStateScheme == rawdb.PathScheme || envTestStateScheme == rawdb.HashScheme {
stateScheme = envTestStateScheme
}
diff --git a/util/testhelpers/port.go b/util/testhelpers/port.go
index d31fa41cdc..c17e9d9ec2 100644
--- a/util/testhelpers/port.go
+++ b/util/testhelpers/port.go
@@ -2,6 +2,7 @@ package testhelpers
import (
"net"
+ "testing"
)
// FreeTCPPortListener returns a listener listening on an unused local port.
@@ -15,3 +16,13 @@ func FreeTCPPortListener() (net.Listener, error) {
}
return l, nil
}
+
+// Func AddrTCPPort returns the port of a net.Addr.
+func AddrTCPPort(n net.Addr, t *testing.T) int {
+ t.Helper()
+ tcpAddr, ok := n.(*net.TCPAddr)
+ if !ok {
+ t.Fatal("Could not get TCP address net.Addr")
+ }
+ return tcpAddr.Port
+}
diff --git a/util/testhelpers/port_test.go b/util/testhelpers/port_test.go
index ef9bb18537..bb8f87b2f7 100644
--- a/util/testhelpers/port_test.go
+++ b/util/testhelpers/port_test.go
@@ -14,10 +14,18 @@ func TestFreeTCPPortListener(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if aListener.Addr().(*net.TCPAddr).Port == bListener.Addr().(*net.TCPAddr).Port {
+ aTCPAddr, ok := aListener.Addr().(*net.TCPAddr)
+ if !ok {
+ t.Fatalf("aListener.Addr() is not a *net.TCPAddr: %v", aListener.Addr())
+ }
+ bTCPAddr, ok := bListener.Addr().(*net.TCPAddr)
+ if !ok {
+ t.Fatalf("bListener.Addr() is not a *net.TCPAddr: %v", aListener.Addr())
+ }
+ if aTCPAddr.Port == bTCPAddr.Port {
t.Errorf("FreeTCPPortListener() got same port: %v, %v", aListener, bListener)
}
- if aListener.Addr().(*net.TCPAddr).Port == 0 || bListener.Addr().(*net.TCPAddr).Port == 0 {
+ if aTCPAddr.Port == 0 || bTCPAddr.Port == 0 {
t.Errorf("FreeTCPPortListener() got port 0")
}
}
diff --git a/util/testhelpers/stackconfig.go b/util/testhelpers/stackconfig.go
index c7c46befd1..3e4e696646 100644
--- a/util/testhelpers/stackconfig.go
+++ b/util/testhelpers/stackconfig.go
@@ -15,6 +15,7 @@ func CreateStackConfigForTest(dataDir string) *node.Config {
stackConf.HTTPPort = 0
stackConf.HTTPHost = ""
stackConf.HTTPModules = append(stackConf.HTTPModules, "eth", "debug")
+ stackConf.AuthPort = 0
stackConf.P2P.NoDiscovery = true
stackConf.P2P.NoDial = true
stackConf.P2P.ListenAddr = ""
diff --git a/util/testhelpers/testhelpers.go b/util/testhelpers/testhelpers.go
index 7c3996e45f..8ef3c489e4 100644
--- a/util/testhelpers/testhelpers.go
+++ b/util/testhelpers/testhelpers.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/colors"
)
diff --git a/validator/client/redis/producer.go b/validator/client/redis/producer.go
index c5726ffe8b..4bfb721f59 100644
--- a/validator/client/redis/producer.go
+++ b/validator/client/redis/producer.go
@@ -5,10 +5,14 @@ import (
"fmt"
"sync/atomic"
+ "github.com/redis/go-redis/v9"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/pubsub"
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/redisutil"
@@ -16,8 +20,6 @@ import (
"github.com/offchainlabs/nitro/validator"
"github.com/offchainlabs/nitro/validator/server_api"
"github.com/offchainlabs/nitro/validator/server_common"
- "github.com/redis/go-redis/v9"
- "github.com/spf13/pflag"
)
type ValidationClientConfig struct {
diff --git a/validator/client/validation_client.go b/validator/client/validation_client.go
index 934362f00a..0a6555121e 100644
--- a/validator/client/validation_client.go
+++ b/validator/client/validation_client.go
@@ -11,21 +11,19 @@ import (
"sync/atomic"
"time"
- "github.com/offchainlabs/nitro/validator"
-
- "github.com/offchainlabs/nitro/util/containers"
- "github.com/offchainlabs/nitro/util/rpcclient"
- "github.com/offchainlabs/nitro/util/stopwaiter"
-
- "github.com/offchainlabs/nitro/validator/server_api"
- "github.com/offchainlabs/nitro/validator/server_common"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
+ "github.com/offchainlabs/nitro/util/containers"
+ "github.com/offchainlabs/nitro/util/rpcclient"
+ "github.com/offchainlabs/nitro/util/stopwaiter"
+ "github.com/offchainlabs/nitro/validator"
+ "github.com/offchainlabs/nitro/validator/server_api"
+ "github.com/offchainlabs/nitro/validator/server_common"
)
type ValidationClient struct {
diff --git a/validator/execution_state.go b/validator/execution_state.go
index 092fbe2908..b9cea8ec3b 100644
--- a/validator/execution_state.go
+++ b/validator/execution_state.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+
"github.com/offchainlabs/nitro/solgen/go/challengegen"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
)
diff --git a/validator/interface.go b/validator/interface.go
index 9fb831ca0d..bfccaefcfa 100644
--- a/validator/interface.go
+++ b/validator/interface.go
@@ -5,6 +5,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/util/containers"
)
diff --git a/validator/server_api/json.go b/validator/server_api/json.go
index 8dfbc8446a..f56493cd92 100644
--- a/validator/server_api/json.go
+++ b/validator/server_api/json.go
@@ -11,9 +11,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbcompress"
"github.com/offchainlabs/nitro/arbutil"
-
"github.com/offchainlabs/nitro/util/jsonapi"
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_arb/execution_run.go b/validator/server_arb/execution_run.go
index d29a88d34d..270ace3180 100644
--- a/validator/server_arb/execution_run.go
+++ b/validator/server_arb/execution_run.go
@@ -11,8 +11,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
-
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/offchainlabs/nitro/validator"
diff --git a/validator/server_arb/execution_run_test.go b/validator/server_arb/execution_run_test.go
index 479db58515..1f8e9625c1 100644
--- a/validator/server_arb/execution_run_test.go
+++ b/validator/server_arb/execution_run_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_arb/machine.go b/validator/server_arb/machine.go
index f882fe65a6..c429fa6101 100644
--- a/validator/server_arb/machine.go
+++ b/validator/server_arb/machine.go
@@ -10,6 +10,7 @@ package server_arb
ResolvedPreimage preimageResolverC(size_t context, uint8_t preimageType, const uint8_t* hash);
*/
import "C"
+
import (
"context"
"errors"
@@ -21,6 +22,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/containers"
diff --git a/validator/server_arb/machine_loader.go b/validator/server_arb/machine_loader.go
index 13cf0f2403..8c9d37e174 100644
--- a/validator/server_arb/machine_loader.go
+++ b/validator/server_arb/machine_loader.go
@@ -4,6 +4,7 @@ import (
"context"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator/server_common"
)
diff --git a/validator/server_arb/machine_test.go b/validator/server_arb/machine_test.go
index e3ffb28b42..008d757889 100644
--- a/validator/server_arb/machine_test.go
+++ b/validator/server_arb/machine_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/validator/server_arb/mock_machine.go b/validator/server_arb/mock_machine.go
index 3cf0f9f771..00512d1d77 100644
--- a/validator/server_arb/mock_machine.go
+++ b/validator/server_arb/mock_machine.go
@@ -7,6 +7,7 @@ import (
"context"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_arb/nitro_machine.go b/validator/server_arb/nitro_machine.go
index 926b1e8930..a2f7de3153 100644
--- a/validator/server_arb/nitro_machine.go
+++ b/validator/server_arb/nitro_machine.go
@@ -9,6 +9,7 @@ package server_arb
#include
*/
import "C"
+
import (
"context"
"errors"
@@ -19,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/validator/server_common"
)
diff --git a/validator/server_arb/prover_interface.go b/validator/server_arb/prover_interface.go
index 3010d2138d..8479a8aa8f 100644
--- a/validator/server_arb/prover_interface.go
+++ b/validator/server_arb/prover_interface.go
@@ -22,10 +22,12 @@ void AddToStringList(char** list, int index, char* val) {
}
*/
import "C"
+
import (
"unsafe"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_arb/validator_spawner.go b/validator/server_arb/validator_spawner.go
index 07971e2ba5..bb7fbcf97d 100644
--- a/validator/server_arb/validator_spawner.go
+++ b/validator/server_arb/validator_spawner.go
@@ -10,18 +10,18 @@ import (
"github.com/spf13/pflag"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/log"
+ "github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/offchainlabs/nitro/validator"
"github.com/offchainlabs/nitro/validator/server_common"
"github.com/offchainlabs/nitro/validator/valnode/redis"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core/rawdb"
- "github.com/ethereum/go-ethereum/log"
- "github.com/ethereum/go-ethereum/metrics"
)
var arbitratorValidationSteps = metrics.NewRegisteredHistogram("arbitrator/validation/steps", nil, metrics.NewBoundedHistogramSample())
diff --git a/validator/server_common/machine_loader.go b/validator/server_common/machine_loader.go
index f4633ebedf..e86589b657 100644
--- a/validator/server_common/machine_loader.go
+++ b/validator/server_common/machine_loader.go
@@ -5,6 +5,7 @@ import (
"sync"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/util/containers"
)
diff --git a/validator/server_common/valrun.go b/validator/server_common/valrun.go
index 8486664008..9a2a6cb414 100644
--- a/validator/server_common/valrun.go
+++ b/validator/server_common/valrun.go
@@ -2,6 +2,7 @@ package server_common
import (
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_jit/jit_machine.go b/validator/server_jit/jit_machine.go
index 0748101277..dc7657441e 100644
--- a/validator/server_jit/jit_machine.go
+++ b/validator/server_jit/jit_machine.go
@@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/validator"
)
diff --git a/validator/server_jit/machine_loader.go b/validator/server_jit/machine_loader.go
index 3d8b01367f..a4ccede324 100644
--- a/validator/server_jit/machine_loader.go
+++ b/validator/server_jit/machine_loader.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+
"github.com/offchainlabs/nitro/validator/server_common"
)
diff --git a/validator/server_jit/spawner.go b/validator/server_jit/spawner.go
index f30b6e181a..91b1e818f0 100644
--- a/validator/server_jit/spawner.go
+++ b/validator/server_jit/spawner.go
@@ -3,11 +3,12 @@ package server_jit
import (
"context"
"fmt"
- flag "github.com/spf13/pflag"
"runtime"
"sync/atomic"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
diff --git a/validator/validation_entry.go b/validator/validation_entry.go
index 4ec6919d3b..555a4c76c7 100644
--- a/validator/validation_entry.go
+++ b/validator/validation_entry.go
@@ -3,6 +3,7 @@ package validator
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/validator/valnode/redis/consumer.go b/validator/valnode/redis/consumer.go
index 4392a3c91e..93b3eddd3f 100644
--- a/validator/valnode/redis/consumer.go
+++ b/validator/valnode/redis/consumer.go
@@ -6,14 +6,16 @@ import (
"runtime"
"time"
+ "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/pubsub"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/stopwaiter"
"github.com/offchainlabs/nitro/validator"
"github.com/offchainlabs/nitro/validator/server_api"
- "github.com/spf13/pflag"
)
// ValidationServer implements consumer for the requests originated from
diff --git a/validator/valnode/redis/consumer_test.go b/validator/valnode/redis/consumer_test.go
index 0ebd697f16..595aecc9ca 100644
--- a/validator/valnode/redis/consumer_test.go
+++ b/validator/valnode/redis/consumer_test.go
@@ -6,6 +6,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/testhelpers"
)
diff --git a/validator/valnode/valnode.go b/validator/valnode/valnode.go
index 972e11189d..e2f4f79bef 100644
--- a/validator/valnode/valnode.go
+++ b/validator/valnode/valnode.go
@@ -3,17 +3,18 @@ package valnode
import (
"context"
- "github.com/offchainlabs/nitro/validator"
+ "github.com/spf13/pflag"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
+
+ "github.com/offchainlabs/nitro/validator"
"github.com/offchainlabs/nitro/validator/server_api"
"github.com/offchainlabs/nitro/validator/server_arb"
"github.com/offchainlabs/nitro/validator/server_common"
"github.com/offchainlabs/nitro/validator/server_jit"
"github.com/offchainlabs/nitro/validator/valnode/redis"
- "github.com/spf13/pflag"
)
type WasmConfig struct {
diff --git a/wavmio/stub.go b/wavmio/stub.go
index 0c82506ff3..01031860e9 100644
--- a/wavmio/stub.go
+++ b/wavmio/stub.go
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbutil"
)
diff --git a/wsbroadcastserver/clientconnection.go b/wsbroadcastserver/clientconnection.go
index 00ae0f0dcf..2585452db7 100644
--- a/wsbroadcastserver/clientconnection.go
+++ b/wsbroadcastserver/clientconnection.go
@@ -13,14 +13,15 @@ import (
"sync/atomic"
"time"
+ "github.com/gobwas/ws"
+ "github.com/gobwas/ws/wsflate"
+ "github.com/mailru/easygo/netpoll"
+
"github.com/ethereum/go-ethereum/log"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/broadcaster/backlog"
m "github.com/offchainlabs/nitro/broadcaster/message"
-
- "github.com/gobwas/ws"
- "github.com/gobwas/ws/wsflate"
- "github.com/mailru/easygo/netpoll"
"github.com/offchainlabs/nitro/util/stopwaiter"
)
diff --git a/wsbroadcastserver/connectionlimiter.go b/wsbroadcastserver/connectionlimiter.go
index e483eb545e..d086fc074e 100644
--- a/wsbroadcastserver/connectionlimiter.go
+++ b/wsbroadcastserver/connectionlimiter.go
@@ -8,9 +8,10 @@ import (
"sync"
"time"
+ flag "github.com/spf13/pflag"
+
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
- flag "github.com/spf13/pflag"
)
var (
diff --git a/wsbroadcastserver/utils.go b/wsbroadcastserver/utils.go
index 9df1d7d9ca..40ceb3e5bf 100644
--- a/wsbroadcastserver/utils.go
+++ b/wsbroadcastserver/utils.go
@@ -12,10 +12,11 @@ import (
"strings"
"time"
- "github.com/ethereum/go-ethereum/log"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsflate"
"github.com/gobwas/ws/wsutil"
+
+ "github.com/ethereum/go-ethereum/log"
)
func init() {
@@ -136,7 +137,7 @@ func ReadData(ctx context.Context, conn net.Conn, earlyFrameData io.Reader, time
var data []byte
if msg.IsCompressed() {
if !compression {
- return nil, 0, errors.New("Received compressed frame even though compression is disabled")
+ return nil, 0, errors.New("Received compressed frame even though compression extension wasn't negotiated")
}
flateReader.Reset(&reader)
data, err = io.ReadAll(flateReader)
diff --git a/wsbroadcastserver/wsbroadcastserver.go b/wsbroadcastserver/wsbroadcastserver.go
index ee21cbaae3..da9420a527 100644
--- a/wsbroadcastserver/wsbroadcastserver.go
+++ b/wsbroadcastserver/wsbroadcastserver.go
@@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
+
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/broadcaster/backlog"
m "github.com/offchainlabs/nitro/broadcaster/message"