Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/google.golang.org/gr…
Browse files Browse the repository at this point in the history
…pc-1.64.1
  • Loading branch information
eljobe authored Nov 15, 2024
2 parents aa5ebaa + bcb2c64 commit c6580c3
Show file tree
Hide file tree
Showing 291 changed files with 905 additions and 398 deletions.
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions arbcompress/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package arbcompress
#include "arbitrator.h"
*/
import "C"

import (
"errors"
"fmt"
Expand Down
8 changes: 4 additions & 4 deletions arbitrator/bench/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use prover::prepare::prepare_machine;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Path to a preimages text file
/// Path to a preimages json file
#[arg(short, long)]
preimages_path: PathBuf,
json_inputs: PathBuf,

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

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

println!("Running benchmark with always merkleize feature on");
for step_size in step_sizes {
let mut machine = prepare_machine(args.preimages_path.clone(), args.machine_path.clone())?;
let mut machine = prepare_machine(args.json_inputs.clone(), args.binary.clone())?;
let _ = machine.hash();
let mut hash_times = vec![];
let mut step_times = vec![];
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/prover/test-cases/dynamic.wat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/prover/test-cases/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/prover/test-cases/link.wat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions arbitrator/prover/test-cases/user.wat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))
Expand Down
1 change: 1 addition & 0 deletions arbnode/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ func (c *BatchPosterConfig) Validate() error {

type BatchPosterConfigFetcher func() *BatchPosterConfig

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

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

var DefaultBatchPosterConfig = BatchPosterConfig{
Expand Down
25 changes: 17 additions & 8 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ 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"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"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"
Expand All @@ -34,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"
Expand All @@ -45,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 (
Expand Down Expand Up @@ -1087,7 +1089,7 @@ func (p *DataPoster) updateBalance(ctx context.Context) error {
return nil
}

const maxConsecutiveIntermittentErrors = 10
const maxConsecutiveIntermittentErrors = 20

func (p *DataPoster) maybeLogError(err error, tx *storage.QueuedTransaction, msg string) {
nonce := tx.FullTx.Nonce()
Expand All @@ -1096,10 +1098,17 @@ func (p *DataPoster) maybeLogError(err error, tx *storage.QueuedTransaction, msg
return
}
logLevel := log.Error
if errors.Is(err, storage.ErrStorageRace) {
isStorageRace := errors.Is(err, storage.ErrStorageRace)
if isStorageRace || strings.Contains(err.Error(), txpool.ErrFutureReplacePending.Error()) {
p.errorCount[nonce]++
if p.errorCount[nonce] <= maxConsecutiveIntermittentErrors {
logLevel = log.Debug
if isStorageRace {
logLevel = log.Debug
} else {
logLevel = log.Info
}
} else if isStorageRace {
logLevel = log.Warn
}
} else {
delete(p.errorCount, nonce)
Expand Down
6 changes: 4 additions & 2 deletions arbnode/dataposter/dataposter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)
Expand Down
1 change: 1 addition & 0 deletions arbnode/dataposter/dbstorage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
3 changes: 2 additions & 1 deletion arbnode/dataposter/redis/redisstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions arbnode/dataposter/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
6 changes: 4 additions & 2 deletions arbnode/dataposter/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion arbnode/delayed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
1 change: 1 addition & 0 deletions arbnode/delayed_seq_reorg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
3 changes: 2 additions & 1 deletion arbnode/delayed_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion arbnode/inbox_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 8 additions & 9 deletions arbnode/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@ 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/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 {
Expand Down
1 change: 1 addition & 0 deletions arbnode/inbox_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/ethereum/go-ethereum/core/rawdb"

"github.com/offchainlabs/nitro/util/containers"
)

Expand Down
4 changes: 3 additions & 1 deletion arbnode/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arbnode/message_pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit c6580c3

Please sign in to comment.