Skip to content

Commit

Permalink
Merge branch 'master' into secondary-relay-feed
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli authored Oct 20, 2023
2 parents 878ec4a + 662c401 commit 69ebee8
Show file tree
Hide file tree
Showing 40 changed files with 948 additions and 262 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ solgen/go
**/node_modules

target/**/*
!target/machines
!target/machines/*
!target/machines/**/*
brotli/buildfiles/**/*

# these are used by environment outside the docker:
Expand Down
36 changes: 11 additions & 25 deletions .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-8
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -49,23 +49,18 @@ jobs:
cache-dependency-path: '**/yarn.lock'

- name: Install rust stable
uses: actions-rs/toolchain@v1
id: install-rust
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: "stable"
override: true
components: 'llvm-tools-preview, rustfmt, clippy'
targets: 'wasm32-wasi, wasm32-unknown-unknown'

- name: Install grcov
uses: actions-rs/install@v0.1
uses: jaxxstorm/action-install[email protected]
with:
crate: grcov
version: latest
use-tool-cache: true

- name: Install rust wasm targets
run: rustup target add wasm32-wasi wasm32-unknown-unknown
repo: mozilla/grcov
tag: v0.8.18
extension: "\\.bz2"
cache: enable

- name: Cache Rust intermediate build products
uses: actions/cache@v3
Expand Down Expand Up @@ -148,22 +143,13 @@ jobs:
echo RUSTDOCFLAGS="-Cpanic=abort" >> $GITHUB_ENV
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --manifest-path arbitrator/Cargo.toml -- -D warnings
run: cargo clippy --all --manifest-path arbitrator/Cargo.toml -- -D warnings

- name: Run rust tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --manifest-path arbitrator/Cargo.toml
run: cargo test --all --manifest-path arbitrator/Cargo.toml

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --manifest-path arbitrator/Cargo.toml -- --check
run: cargo fmt --all --manifest-path arbitrator/Cargo.toml -- --check

- name: Make proofs from test cases
run: make -j test-gen-proofs
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -53,27 +53,10 @@ jobs:
sudo apt-get update && sudo apt-get install -y lld-14
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld
- name: Install rust wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "stable"
target: wasm32-unknown-unknown

- name: Install rust wasm32-wasi
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "stable"
target: wasm32-wasi

- name: Install rust stable
uses: actions-rs/toolchain@v1
id: install-rust
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: "stable"
override: true
targets: 'wasm32-unknown-unknown, wasm32-wasi'

- name: Cache Build Products
uses: actions/cache@v3
Expand Down Expand Up @@ -125,10 +108,9 @@ jobs:
run: make -j build-node-deps

- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-go-installation: true
skip-pkg-cache: true
- name: Custom Lint
run: |
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
contents: read
security-events: write
env:
CODEQL_EXTRACTOR_GO_BUILD_TRACING: 'on'
WABT_VERSION: 1.0.32

strategy:
Expand All @@ -44,7 +43,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -74,12 +73,7 @@ jobs:
go-version: 1.20.x

- name: Install rust stable
uses: actions-rs/toolchain@v1
id: install-rust
with:
profile: minimal
toolchain: "stable"
override: true
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust Build Products
uses: actions/cache@v3
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

Expand All @@ -40,7 +40,7 @@ jobs:
restore-keys: ${{ runner.os }}-buildx-

- name: Build nitro-node docker
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
target: nitro-node
push: true
Expand All @@ -50,7 +50,7 @@ jobs:
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Build nitro-node-dev docker
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
target: nitro-node-dev
push: true
Expand All @@ -59,6 +59,17 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Start background nitro-testnode
shell: bash
run: |
cd nitro-testnode
./test-node.bash --init --dev &
- name: Wait for rpc to come up
shell: bash
run: |
${{ github.workspace }}/.github/workflows/waitForNitro.sh
- name: Print WAVM module root
id: module-root
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/waitForNitro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# poll the nitro endpoint until we get a 0 return code
while true
do
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":45678,"method":"eth_chainId","params":[]}' 'http://localhost:8547'
if [ "$?" -eq "0" ]; then
exit 0
else
sleep 20
fi
done
4 changes: 1 addition & 3 deletions arbitrator/prover/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,7 @@ fn main() -> Result<()> {
while let Some((module, func, profile)) = func_stack.pop() {
sum.total_cycles += profile.total_cycles;
sum.count += profile.count;
let entry = func_profile
.entry((module, func))
.or_insert_with(SimpleProfile::default);
let entry = func_profile.entry((module, func)).or_default();
entry.count += sum.count;
entry.total_cycles += sum.total_cycles;
entry.local_cycles += profile.local_cycles;
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 @@ -89,7 +89,7 @@ func main() {
verified, err = MerkleSample(data, -1)
if err != nil {
if verified {
panic("succeded to verify proof invalid")
panic("succeeded to verify proof invalid")
}
}

Expand Down
60 changes: 36 additions & 24 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,68 +217,80 @@ var TestBatchPosterConfig = BatchPosterConfig{
L1BlockBoundBypass: time.Hour,
}

func NewBatchPoster(ctx context.Context, dataPosterDB ethdb.Database, l1Reader *headerreader.HeaderReader, inbox *InboxTracker, streamer *TransactionStreamer, syncMonitor *SyncMonitor, config BatchPosterConfigFetcher, deployInfo *chaininfo.RollupAddresses, transactOpts *bind.TransactOpts, daWriter das.DataAvailabilityServiceWriter) (*BatchPoster, error) {
seqInbox, err := bridgegen.NewSequencerInbox(deployInfo.SequencerInbox, l1Reader.Client())
type BatchPosterOpts struct {
DataPosterDB ethdb.Database
L1Reader *headerreader.HeaderReader
Inbox *InboxTracker
Streamer *TransactionStreamer
SyncMonitor *SyncMonitor
Config BatchPosterConfigFetcher
DeployInfo *chaininfo.RollupAddresses
TransactOpts *bind.TransactOpts
DAWriter das.DataAvailabilityServiceWriter
}

func NewBatchPoster(ctx context.Context, opts *BatchPosterOpts) (*BatchPoster, error) {
seqInbox, err := bridgegen.NewSequencerInbox(opts.DeployInfo.SequencerInbox, opts.L1Reader.Client())
if err != nil {
return nil, err
}
bridge, err := bridgegen.NewBridge(deployInfo.Bridge, l1Reader.Client())
bridge, err := bridgegen.NewBridge(opts.DeployInfo.Bridge, opts.L1Reader.Client())
if err != nil {
return nil, err
}
if err = config().Validate(); err != nil {
if err = opts.Config().Validate(); err != nil {
return nil, err
}
seqInboxABI, err := bridgegen.SequencerInboxMetaData.GetAbi()
if err != nil {
return nil, err
}
redisClient, err := redisutil.RedisClientFromURL(config().RedisUrl)
redisClient, err := redisutil.RedisClientFromURL(opts.Config().RedisUrl)
if err != nil {
return nil, err
}
redisLockConfigFetcher := func() *redislock.SimpleCfg {
simpleRedisLockConfig := config().RedisLock
simpleRedisLockConfig := opts.Config().RedisLock
simpleRedisLockConfig.Key = batchPosterSimpleRedisLockKey
return &simpleRedisLockConfig
}
redisLock, err := redislock.NewSimple(redisClient, redisLockConfigFetcher, func() bool { return syncMonitor.Synced() })
redisLock, err := redislock.NewSimple(redisClient, redisLockConfigFetcher, func() bool { return opts.SyncMonitor.Synced() })
if err != nil {
return nil, err
}
b := &BatchPoster{
l1Reader: l1Reader,
inbox: inbox,
streamer: streamer,
syncMonitor: syncMonitor,
config: config,
l1Reader: opts.L1Reader,
inbox: opts.Inbox,
streamer: opts.Streamer,
syncMonitor: opts.SyncMonitor,
config: opts.Config,
bridge: bridge,
seqInbox: seqInbox,
seqInboxABI: seqInboxABI,
seqInboxAddr: deployInfo.SequencerInbox,
gasRefunderAddr: config().gasRefunder,
bridgeAddr: deployInfo.Bridge,
daWriter: daWriter,
seqInboxAddr: opts.DeployInfo.SequencerInbox,
gasRefunderAddr: opts.Config().gasRefunder,
bridgeAddr: opts.DeployInfo.Bridge,
daWriter: opts.DAWriter,
redisLock: redisLock,
accessList: func(SequencerInboxAccs, AfterDelayedMessagesRead int) types.AccessList {
return AccessList(&AccessListOpts{
SequencerInboxAddr: deployInfo.SequencerInbox,
DataPosterAddr: transactOpts.From,
BridgeAddr: deployInfo.Bridge,
GasRefunderAddr: config().gasRefunder,
SequencerInboxAddr: opts.DeployInfo.SequencerInbox,
DataPosterAddr: opts.TransactOpts.From,
BridgeAddr: opts.DeployInfo.Bridge,
GasRefunderAddr: opts.Config().gasRefunder,
SequencerInboxAccs: SequencerInboxAccs,
AfterDelayedMessagesRead: AfterDelayedMessagesRead,
})
},
}
dataPosterConfigFetcher := func() *dataposter.DataPosterConfig {
return &config().DataPoster
return &(opts.Config().DataPoster)
}
b.dataPoster, err = dataposter.NewDataPoster(ctx,
&dataposter.DataPosterOpts{
Database: dataPosterDB,
HeaderReader: l1Reader,
Auth: transactOpts,
Database: opts.DataPosterDB,
HeaderReader: opts.L1Reader,
Auth: opts.TransactOpts,
RedisClient: redisClient,
RedisLock: redisLock,
Config: dataPosterConfigFetcher,
Expand Down
Loading

0 comments on commit 69ebee8

Please sign in to comment.