Skip to content

Commit

Permalink
Merge branch 'master' into run-mode-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Nov 15, 2024
2 parents b9cf390 + ee13024 commit 071e2dc
Show file tree
Hide file tree
Showing 272 changed files with 573 additions and 276 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
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
11 changes: 6 additions & 5 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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 (
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
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
1 change: 1 addition & 0 deletions arbnode/message_pruner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

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

"github.com/offchainlabs/nitro/arbutil"
)

Expand Down
1 change: 1 addition & 0 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions arbnode/redislock/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion arbnode/resourcemanager/resource_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion arbnode/sequencer_inbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 3 additions & 1 deletion arbnode/sync_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"math/big"
"reflect"
Expand All @@ -17,8 +18,6 @@ import (
"testing"
"time"

"errors"

flag "github.com/spf13/pflag"

"github.com/ethereum/go-ethereum/common"
Expand Down
1 change: 1 addition & 0 deletions arbos/activate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions arbos/addressSet/addressSet.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"

"github.com/ethereum/go-ethereum/common"

"github.com/offchainlabs/nitro/arbos/storage"
"github.com/offchainlabs/nitro/arbos/util"
)
Expand Down
Loading

0 comments on commit 071e2dc

Please sign in to comment.