Skip to content

Commit

Permalink
Merge branch 'nightly' into kpp/system_caller
Browse files Browse the repository at this point in the history
  • Loading branch information
kpp committed Mar 27, 2024
2 parents 0462b3a + 0a8333d commit 9b0f94d
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 6 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker_hive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Makes a Docker build to be used in Hive tests.

name: Docker for Hive

on:
workflow_dispatch:
schedule:
# every day
- cron: "13 21 * * *" # 21:13 UTC

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Except in `nightly` and `stable` branches! Any cancelled job will cause the
# CI run to fail, and we want to keep a clean history for major branches.
cancel-in-progress: ${{ (github.ref != 'refs/heads/nightly') && (github.ref != 'refs/heads/stable') }}

jobs:
docker:
timeout-minutes: 60
name: Build and publish Docker image
runs-on: ubicloud-standard-16
steps:
- uses: actions/checkout@v4
- name: Docker Setup Buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./hive/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/citrea:latest
94 changes: 94 additions & 0 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Runs `ethereum/hive` tests.

name: Hive

on:
workflow_dispatch:
workflow_run:
workflows: ["Docker for Hive"]
types:
- completed

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Except in `nightly` and `stable` branches! Any cancelled job will cause the
# CI run to fail, and we want to keep a clean history for major branches.
cancel-in-progress: ${{ (github.ref != 'refs/heads/nightly') && (github.ref != 'refs/heads/stable') }}

jobs:
prepare:
timeout-minutes: 45
runs-on: ubicloud-standard-4
steps:
- uses: actions/checkout@v4
- run: mkdir artifacts

- name: Checkout hive tests
uses: actions/checkout@v4
with:
repository: chainwayxyz/hive
ref: main
path: hivetests

- uses: actions/setup-go@v5
with:
go-version: "^1.13.1"
- run: go version
- name: Build hive tool
run: |
cd hivetests
go build .
mv ./hive ../artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ./artifacts

test:
timeout-minutes: 15
strategy:
fail-fast: false

needs: prepare
name: run
runs-on: ubicloud-standard-4
permissions:
issues: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: /tmp

- name: Move hive binary
run: |
mv /tmp/hive /usr/local/bin
chmod +x /usr/local/bin/hive
- name: Checkout hive tests
uses: actions/checkout@v4
with:
repository: chainwayxyz/hive
ref: main
path: hivetests

- name: Run ethereum/rpc simulator
run: |
cd hivetests
hive --sim "ethereum/rpc" --sim.limit "/http" --client citrea
- name: Print simulator output
if: ${{ failure() }}
run: |
cat hivetests/workspace/logs/*simulator*.log
- name: Print citrea client logs
if: ${{ failure() }}
run: |
cat hivetests/workspace/logs/citrea/client-*.log
1 change: 1 addition & 0 deletions examples/demo-rollup/bitcoin_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sequencer_public_key = "0000000000000000000000000000000000000000000000000000000000000000"
min_soft_confirmations_per_commitment = 1000
include_tx_body = false

[da]
node_url = "http://localhost:38332"
Expand Down
4 changes: 3 additions & 1 deletion examples/demo-rollup/celestia_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_tx_body = false

[da]
# The JWT used to authenticate with the celestia light client. Instructions for generating this token can be found in the README
celestia_rpc_auth_token = "MY.SECRET.TOKEN"
Expand All @@ -23,4 +25,4 @@ bind_host = "127.0.0.1"
bind_port = 12345

[prover_service]
aggregated_proof_block_jump = 1
aggregated_proof_block_jump = 1
1 change: 1 addition & 0 deletions examples/demo-rollup/mock_dockerized_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = false

[da]
sender_address = "0000000000000000000000000000000000000000000000000000000000000000"
Expand Down
1 change: 1 addition & 0 deletions examples/demo-rollup/mock_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = false

[da]
sender_address = "0000000000000000000000000000000000000000000000000000000000000000"
Expand Down
1 change: 1 addition & 0 deletions examples/demo-rollup/mocknet_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
min_soft_confirmations_per_commitment = 1000
include_tx_body = false

[da]
sender_address = "0000000000000000000000000000000000000000000000000000000000000000"
Expand Down
104 changes: 104 additions & 0 deletions examples/demo-rollup/tests/e2e/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async fn initialize_test(
NodeMode::SequencerNode,
None,
config.seq_min_soft_confirmations,
true,
)
.await;
});
Expand All @@ -75,6 +76,7 @@ async fn initialize_test(
NodeMode::FullNode(seq_port),
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand All @@ -91,6 +93,99 @@ async fn initialize_test(
)
}

#[tokio::test]
async fn test_soft_batch_save() -> Result<(), anyhow::Error> {
let config = TestConfig::default();

let (seq_port_tx, seq_port_rx) = tokio::sync::oneshot::channel();

let seq_task = tokio::spawn(async move {
start_rollup(
seq_port_tx,
GenesisPaths::from_dir("../test-data/genesis/integration-tests"),
BasicKernelGenesisPaths {
chain_state: "../test-data/genesis/integration-tests/chain_state.json".into(),
},
RollupProverConfig::Execute,
NodeMode::SequencerNode,
None,
config.seq_min_soft_confirmations,
true,
)
.await;
});

let seq_port = seq_port_rx.await.unwrap();
let seq_test_client = init_test_rollup(seq_port).await;

let (full_node_port_tx, full_node_port_rx) = tokio::sync::oneshot::channel();

let full_node_task = tokio::spawn(async move {
start_rollup(
full_node_port_tx,
GenesisPaths::from_dir("../test-data/genesis/integration-tests"),
BasicKernelGenesisPaths {
chain_state: "../test-data/genesis/integration-tests/chain_state.json".into(),
},
RollupProverConfig::Execute,
NodeMode::FullNode(seq_port),
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});

let full_node_port = full_node_port_rx.await.unwrap();
let full_node_test_client = make_test_client(full_node_port).await;

let (full_node_port_tx_2, full_node_port_rx_2) = tokio::sync::oneshot::channel();

let full_node_task_2 = tokio::spawn(async move {
start_rollup(
full_node_port_tx_2,
GenesisPaths::from_dir("../test-data/genesis/integration-tests"),
BasicKernelGenesisPaths {
chain_state: "../test-data/genesis/integration-tests/chain_state.json".into(),
},
RollupProverConfig::Execute,
NodeMode::FullNode(full_node_port),
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
false,
)
.await;
});

let full_node_port_2 = full_node_port_rx_2.await.unwrap();
let full_node_test_client_2 = make_test_client(full_node_port_2).await;

let _ = execute_blocks(&seq_test_client, &full_node_test_client).await;

sleep(Duration::from_secs(10)).await;

let seq_block = seq_test_client
.eth_get_block_by_number(Some(BlockNumberOrTag::Latest))
.await;
let full_node_block = full_node_test_client
.eth_get_block_by_number(Some(BlockNumberOrTag::Latest))
.await;
let full_node_block_2 = full_node_test_client_2
.eth_get_block_by_number(Some(BlockNumberOrTag::Latest))
.await;

assert_eq!(seq_block.state_root, full_node_block.state_root);
assert_eq!(full_node_block.state_root, full_node_block_2.state_root);
assert_eq!(seq_block.hash, full_node_block.hash);
assert_eq!(full_node_block.hash, full_node_block_2.hash);

seq_task.abort();
full_node_task.abort();
full_node_task_2.abort();

Ok(())
}

#[tokio::test]
async fn test_full_node_send_tx() -> Result<(), anyhow::Error> {
// sov_demo_rollup::initialize_logging();
Expand Down Expand Up @@ -142,6 +237,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -172,6 +268,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> {
NodeMode::FullNode(seq_port),
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -233,6 +330,7 @@ async fn test_close_and_reopen_full_node() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand All @@ -253,6 +351,7 @@ async fn test_close_and_reopen_full_node() -> Result<(), anyhow::Error> {
NodeMode::FullNode(seq_port),
Some("demo_data_test_close_and_reopen_full_node"),
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -332,6 +431,7 @@ async fn test_close_and_reopen_full_node() -> Result<(), anyhow::Error> {
NodeMode::FullNode(seq_port),
Some("demo_data_test_close_and_reopen_full_node_copy"),
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -384,6 +484,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand All @@ -403,6 +504,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> {
NodeMode::FullNode(seq_port),
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -636,6 +738,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
Some("demo_data_test_reopen_sequencer"),
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down Expand Up @@ -679,6 +782,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
Some("demo_data_test_reopen_sequencer_copy"),
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down
1 change: 1 addition & 0 deletions examples/demo-rollup/tests/evm/archival_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async fn test_archival_state() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down
1 change: 1 addition & 0 deletions examples/demo-rollup/tests/evm/gas_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn test_gas_price_increase() -> Result<(), anyhow::Error> {
NodeMode::SequencerNode,
None,
DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT,
true,
)
.await;
});
Expand Down
Loading

0 comments on commit 9b0f94d

Please sign in to comment.