Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 29 additions & 36 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand Down Expand Up @@ -59,11 +55,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand All @@ -82,11 +74,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand All @@ -104,11 +92,7 @@ jobs:
submodules: recursive
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Build Docker
run: just build_docker

Expand All @@ -124,11 +108,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand All @@ -144,18 +124,36 @@ jobs:
- name: Test dynamic committee change
run: just test-dyn-comm

netsim:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
- name: Show net devices
run: ip -o addr show scope global
- name: Install protobuf compiler
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run network simulation
run: just forward-ipv4 true create-net netsim

contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand All @@ -175,11 +173,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- uses: taiki-e/install-action@just
- name: Install rustfmt for nightly
run: rustup component add --toolchain nightly rustfmt
- name: Install Foundry
Expand All @@ -203,4 +197,3 @@ jobs:
- name: Docker Logs Sequencer 2
if: failure()
run: docker logs test-node-sequencer_b-1

2 changes: 1 addition & 1 deletion .github/workflows/push-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
push: true
platforms: linux/amd64
file: ./docker/timeboost.Dockerfile
tags: ghcr.io/espressosystems/timeboost:${{ env.TAG }}
tags: ghcr.io/espressosystems/timeboost:${{ env.TAG }}
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ rust-version = "1.85.0"

[workspace.dependencies]
aes-gcm = { version = "0.10.3" }
alloy = { version = "1.0", features = ["default", "arbitrary", "k256", "serde", "rlp", "node-bindings", "getrandom", "signer-mnemonic", "transport-ws"] }
alloy-chains = "0.2"
# derive feature is not exposed via `alloy`, thus has to explicitly declare here
alloy-rlp = { version = "0.3.12", features = ["derive"] }
Expand Down Expand Up @@ -69,6 +68,7 @@ ethereum_ssz = "0.9.0"
futures = { version = "0.3", default-features = false, features = ["alloc"] }
generic-array = { version = "0.14.7", features = ["serde", "zeroize"] }
http = "1.3.1"
ipnet = { version = "2.11.0", features = ["serde"] }
itertools = "0.14.0"
jiff = { version = "0.2", default-features = false, features = ["serde", "std"] }
minicbor = { version = "2.1.1", features = ["full"] }
Expand Down Expand Up @@ -115,6 +115,20 @@ espresso-types = { git = "https://github.com/EspressoSystems/espresso-network.gi
hotshot-query-service = { git = "https://github.com/EspressoSystems/espresso-network.git" }
hotshot-types = { git = "https://github.com/EspressoSystems/espresso-network.git" }

[workspace.dependencies.alloy]
version = "1.0"
features = [
"arbitrary",
"default",
"getrandom",
"k256",
"node-bindings",
"rlp",
"serde",
"signer-mnemonic",
"transport-ws"
]

[profile.test]
codegen-units = 16
incremental = false
Expand Down
81 changes: 59 additions & 22 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
set export

export RUSTDOCFLAGS := '-D warnings'

LOG_LEVELS := "RUST_LOG=timeboost=debug,sailfish=debug,cliquenet=debug,tests=debug"
log_levels := "RUST_LOG=timeboost=debug,sailfish=debug,cliquenet=debug,tests=debug"
run_as_root := if env("CI", "") == "true" { "sudo" } else { "run0" }

####################
###BUILD COMMANDS###
Expand Down Expand Up @@ -35,7 +34,7 @@ build-port-alloc:

[private]
build-test-utils:
cargo build --release -p test-utils
cargo build --release -p test-utils --all-features

####################
###CHECK COMMANDS###
Expand Down Expand Up @@ -160,10 +159,10 @@ test-contracts: build-contracts
forge test

test_ci *ARGS: build-port-alloc
env {{LOG_LEVELS}} NO_COLOR=1 target/release/run \
env {{log_levels}} NO_COLOR=1 target/release/run \
--spawn target/release/port-alloc \
cargo nextest run -- --workspace {{ARGS}}
env {{LOG_LEVELS}} NO_COLOR=1 cargo test --doc {{ARGS}}
env {{log_levels}} NO_COLOR=1 cargo test --doc {{ARGS}}

test-individually: build-port-alloc
@for pkg in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name'); do \
Expand All @@ -177,30 +176,28 @@ test-contract-deploy *ARGS:
scripts/test-contract-deploy {{ARGS}}

test-all: build_release build-test-utils
env RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn target/release/run \
env RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn \
target/release/run \
--verbose \
--timeout 120 \
--spawn "1:anvil --port 8545" \
--run "2:sleep 3" \
--run "3:scripts/deploy-test-contract" \
--spawn "4:target/release/block-maker --port 55000 --committee test-configs/local/committee.toml" \
--spawn "4:target/release/yapper --keyset-file test-configs/local/committee.toml" \
--spawn "5:target/release/run-committee --configs test-configs/local/ --committee-id 0 --timeboost target/release/timeboost" \
target/release/block-checker -- \
--config test-configs/local/node_0.toml \
--committee test-configs/local/committee.toml \
--committee-id 0 \
--blocks 1000
--run "3:scripts/deploy-test-contract test-configs/local/committee.toml http://localhost:8545" \
--spawn "4:target/release/block-maker --bind 127.0.0.1:55000 -c test-configs/local/committee.toml" \
--spawn "4:target/release/yapper -c test-configs/local/committee.toml" \
--spawn "5:target/release/run-committee -c test-configs/local/" \
target/release/block-checker -- -c test-configs/local -b 1000

test-dyn-comm: build_release_until build-test-utils
env RUST_LOG=sailfish=warn,yapper=error,timeboost=info,info target/release/run \
env RUST_LOG=sailfish=warn,timeboost=info,info target/release/run \
--verbose \
--timeout 120 \
--spawn "1:anvil --port 8545" \
--run "2:sleep 2" \
--run "3:scripts/deploy-test-contract" \
--spawn "4:target/release/run-committee --configs test-configs/c0/ --committee-id 0 --until 2000" \
--run "3:scripts/deploy-test-contract test-configs/local/committee.toml http://localhost:8545" \
--spawn "4:target/release/run-committee -c test-configs/c0/ --until 2000" \
--run "5:target/release/mkconfig -n 4 \
--committee-id 1 \
--public-addr 127.0.0.1:9000 \
--internal-addr 127.0.0.1:9003 \
--http-api 127.0.0.1:9004 \
Expand All @@ -227,11 +224,51 @@ test-dyn-comm: build_release_until build-test-utils
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
-c test-configs/c1/committee.toml" \
--spawn "9:target/release/yapper \
--keyset-file test-configs/c1/committee.toml \
--config test-configs/c1/committee.toml \
--parent-url http://localhost:8545 \
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
target/release/run-committee -- \
--configs test-configs/c1/ \
--committee-id 1 \
-c test-configs/c1/ \
--until 800 \
--required-decrypt-rounds 3 && rm -rf test-configs/c1

[linux]
forward-ipv4 val: build-test-utils
{{run_as_root}} target/release/net-setup system --forward-ipv4 {{val}}

[linux]
create-net: build-test-utils
{{run_as_root}} target/release/net-setup create -c test-configs/linux/net.toml

[linux]
delete-net: build-test-utils
{{run_as_root}} target/release/net-setup delete -c test-configs/linux/net.toml

[linux]
netsim: build_release build-test-utils
#!/usr/bin/env bash
set -eo pipefail
function run_as_root {
if [ "$CI" == "true" ]; then
sudo --preserve-env=PATH,HOME,RUST_LOG "$@"
else
run0 --setenv=PATH --setenv=HOME --setenv=RUST_LOG "$@"
fi
}
export RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn
run_as_root target/release/run \
--verbose \
--timeout 120 \
--clear-env \
--env PATH \
--env HOME \
--env RUST_LOG \
--uid $(id -u) \
--gid $(id -g) \
--spawn "1:anvil --host 11.0.1.0 --port 8545" \
--run "2:sleep 3" \
--run "3:scripts/deploy-test-contract test-configs/linux/committee.toml http://11.0.1.0:8545" \
--spawn "4:target/release/block-maker --bind 11.0.1.0:55000 -c test-configs/linux/committee.toml" \
--spawn "4:target/release/yapper -c test-configs/linux/committee.toml" \
--spawn-as-root "5:target/release/run-committee -u $(id -u) -g $(id -g) -c test-configs/linux/" \
target/release/block-checker -- -c test-configs/linux -b 200
12 changes: 7 additions & 5 deletions scripts/deploy-test-contract
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

set -euo pipefail

COMMITTEE="$1"
URL="$2"

MANAGER_MNEMONIC="attend year erase basket blind adapt stove broccoli isolate unveil acquire category"
MANAGER_ACCOUNT_INDEX=0
MANAGER_ADDRESS="0x36561082951eed7ffD59cFD82D70570C57072d02"
FAUCET_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
URL="http://localhost:8545"
DEPLOYMENT_FILE=$(mktemp -t timeboost-deployment-XXXXX)

# Fund manager account && create deployment file
cast send --value 1ether --private-key "$FAUCET_PRIVATE_KEY" "$MANAGER_ADDRESS"
env RUST_LOG=info cargo run --release --bin deploy -- \
cast send --value 1ether -r "$URL" --private-key "$FAUCET_PRIVATE_KEY" "$MANAGER_ADDRESS"
env RUST_LOG=info target/release/deploy \
-m "$MANAGER_MNEMONIC" \
-i "$MANAGER_ACCOUNT_INDEX" \
-u "$URL" \
Expand All @@ -21,13 +23,13 @@ env RUST_LOG=info cargo run --release --bin deploy -- \
km_addr=$(sed -nr 's/^key_manager.*=.*"(.+)"/\1/p' "$DEPLOYMENT_FILE")

# Update the contract
env RUST_LOG=info cargo run --release --bin register -- \
env RUST_LOG=info target/release/register \
-a new-committee \
-m "$MANAGER_MNEMONIC" \
-i "$MANAGER_ACCOUNT_INDEX" \
-u "$URL" \
-k "$km_addr" \
-c "test-configs/c0/committee.toml"
-c "$COMMITTEE"

# Clean up the temporary deployment file
rm -f "$DEPLOYMENT_FILE"
2 changes: 1 addition & 1 deletion scripts/run-timeboost-demo
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ done
if $yapper; then
cmd=(target/release/yapper
--tps $tps
--keyset-file "$config_dir/committee.toml")
--config "$config_dir/committee.toml")
if [ $nitro_url ]; then
cmd+=(--nitro-url "$nitro_url")
fi
Expand Down
1 change: 1 addition & 0 deletions test-configs/c0/committee.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
id = 0
effective_timestamp = "2025-09-01T02:00:00Z"

[[members]]
Expand Down
1 change: 1 addition & 0 deletions test-configs/docker/committee.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
id = 0
effective_timestamp = "2025-09-01T02:00:00Z"

[[members]]
Expand Down
Loading
Loading