From 64b99a12e34b8defb748f1e6cab1f0e92e0add5b Mon Sep 17 00:00:00 2001 From: otaliptus Date: Fri, 22 Mar 2024 16:53:41 +0300 Subject: [PATCH 1/7] Init --- examples/demo-rollup/mock_rollup_config.toml | 1 + examples/demo-rollup/tests/test_helpers.rs | 1 + full-node/sov-stf-runner/src/config.rs | 4 ++++ full-node/sov-stf-runner/src/runner.rs | 6 +++++- .../sov-stf-runner/tests/runner_initialization_tests.rs | 2 ++ full-node/sov-stf-runner/tests/runner_reorg_tests.rs | 2 ++ module-system/sov-modules-rollup-blueprint/src/lib.rs | 1 + 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/demo-rollup/mock_rollup_config.toml b/examples/demo-rollup/mock_rollup_config.toml index ebc2f2338..94defad95 100644 --- a/examples/demo-rollup/mock_rollup_config.toml +++ b/examples/demo-rollup/mock_rollup_config.toml @@ -1,4 +1,5 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" +ignore_tx_body = true [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/tests/test_helpers.rs b/examples/demo-rollup/tests/test_helpers.rs index ab4fc27dc..19963e09e 100644 --- a/examples/demo-rollup/tests/test_helpers.rs +++ b/examples/demo-rollup/tests/test_helpers.rs @@ -73,6 +73,7 @@ pub async fn start_rollup( } NodeMode::SequencerNode => None, }, + ignore_tx_body: false, }; let sequencer_config = SequencerConfig { diff --git a/full-node/sov-stf-runner/src/config.rs b/full-node/sov-stf-runner/src/config.rs index f0b43764b..fe2dd2896 100644 --- a/full-node/sov-stf-runner/src/config.rs +++ b/full-node/sov-stf-runner/src/config.rs @@ -61,6 +61,8 @@ pub struct RollupConfig { pub sequencer_public_key: Vec, /// Prover service configuration. pub prover_service: ProverServiceConfig, + /// Ignore Tx Body + pub ignore_tx_body: bool, } /// Reads toml file as a specific type. @@ -97,6 +99,7 @@ mod tests { fn test_correct_config() { let config = r#" sequencer_public_key = "0000000000000000000000000000000000000000000000000000000000000000" + ignore_tx_body = false [da] celestia_rpc_auth_token = "SECRET_RPC_TOKEN" celestia_rpc_address = "http://localhost:11111/" @@ -143,6 +146,7 @@ mod tests { prover_service: ProverServiceConfig { aggregated_proof_block_jump: 22, }, + ignore_tx_body: false, }; assert_eq!(config, expected); } diff --git a/full-node/sov-stf-runner/src/runner.rs b/full-node/sov-stf-runner/src/runner.rs index 46a3823ec..a34834595 100644 --- a/full-node/sov-stf-runner/src/runner.rs +++ b/full-node/sov-stf-runner/src/runner.rs @@ -60,6 +60,7 @@ where sequencer_client: Option, sequencer_pub_key: Vec, phantom: std::marker::PhantomData, + ignore_tx_body: bool, } /// Represents the possible modes of execution for a zkVM program @@ -122,6 +123,7 @@ where prover_service: Option, sequencer_client: Option, sequencer_pub_key: Vec, + ignore_tx_body: bool, ) -> Result { let rpc_config = runner_config.rpc_config; @@ -170,6 +172,7 @@ where sequencer_client, sequencer_pub_key, phantom: std::marker::PhantomData, + ignore_tx_body, }) } @@ -495,7 +498,8 @@ where l1_fee_rate: soft_batch.l1_fee_rate, }; - self.ledger_db.commit_soft_batch(soft_batch_receipt, true)?; + self.ledger_db + .commit_soft_batch(soft_batch_receipt, self.ignore_tx_body)?; self.ledger_db .extend_l2_range_of_l1_slot( SlotNumber(filtered_block.header().height()), diff --git a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs index 6036d7024..057e7bb3a 100644 --- a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs @@ -83,6 +83,7 @@ fn initialize_runner( aggregated_proof_block_jump: 1, }, sequencer_client: None, + ignore_tx_body: false, }; let da_service = MockDaService::new(address); @@ -122,6 +123,7 @@ fn initialize_runner( Some(prover_service), None, vec![0u8; 32], + false, ) .unwrap() } diff --git a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs index 9aac7bf1b..7635e01cc 100644 --- a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs @@ -139,6 +139,7 @@ async fn runner_execution( aggregated_proof_block_jump: 1, }, sequencer_client: None, + ignore_tx_body: false, }; let ledger_db = LedgerDB::with_path(path).unwrap(); @@ -176,6 +177,7 @@ async fn runner_execution( Some(prover_service), None, vec![0u8; 32], + false, ) .unwrap(); diff --git a/module-system/sov-modules-rollup-blueprint/src/lib.rs b/module-system/sov-modules-rollup-blueprint/src/lib.rs index 424622720..ffecfe398 100644 --- a/module-system/sov-modules-rollup-blueprint/src/lib.rs +++ b/module-system/sov-modules-rollup-blueprint/src/lib.rs @@ -294,6 +294,7 @@ pub trait RollupBlueprint: Sized + Send + Sync { prover_service, sequencer_client, rollup_config.sequencer_public_key, + rollup_config.ignore_tx_body, )?; Ok(Rollup { From 08b2eb2b457fef198de21ba5f81b340fdcaf4967 Mon Sep 17 00:00:00 2001 From: otaliptus Date: Fri, 22 Mar 2024 17:31:46 +0300 Subject: [PATCH 2/7] Add test --- examples/demo-rollup/tests/e2e/mod.rs | 114 ++++++++++++++++++ .../demo-rollup/tests/evm/archival_state.rs | 1 + examples/demo-rollup/tests/evm/gas_price.rs | 1 + examples/demo-rollup/tests/evm/mod.rs | 3 + examples/demo-rollup/tests/evm/tracing.rs | 1 + examples/demo-rollup/tests/mempool/mod.rs | 1 + .../tests/sequencer_commitments/mod.rs | 1 + .../soft_confirmation_rule_enforcer/mod.rs | 1 + examples/demo-rollup/tests/test_helpers.rs | 3 +- 9 files changed, 125 insertions(+), 1 deletion(-) diff --git a/examples/demo-rollup/tests/e2e/mod.rs b/examples/demo-rollup/tests/e2e/mod.rs index 4a4592613..024fa60e6 100644 --- a/examples/demo-rollup/tests/e2e/mod.rs +++ b/examples/demo-rollup/tests/e2e/mod.rs @@ -55,6 +55,7 @@ async fn initialize_test( NodeMode::SequencerNode, None, config.seq_min_soft_confirmations, + false, ) .await; }); @@ -75,6 +76,7 @@ async fn initialize_test( NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -91,6 +93,109 @@ 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, + false, + ) + .await; + }); + + let seq_port = seq_port_rx.await.unwrap(); + // let seq_test_client = make_test_client(seq_port).await; + let seq_test_client = init_test_rollup(seq_port).await; + let addr = Address::from_str("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266").unwrap(); + + for _ in 0..10 { + seq_test_client + .send_eth(addr, None, None, None, 0u128) + .await + .unwrap(); + seq_test_client.send_publish_batch_request().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, + false, + ) + .await; + }); + + let full_node_port = full_node_port_rx.await.unwrap(); + let full_node_test_client = make_test_client(full_node_port).await; + + sleep(Duration::from_secs(10)).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, + true, + ) + .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; + + sleep(Duration::from_secs(10)).await; + + let seq_block = seq_test_client + .eth_get_block_by_number(Some(BlockNumberOrTag::Number(10))) + .await; + let full_node_block = full_node_test_client + .eth_get_block_by_number(Some(BlockNumberOrTag::Number(10))) + .await; + let full_node_block_2 = full_node_test_client_2 + .eth_get_block_by_number(Some(BlockNumberOrTag::Number(10))) + .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(); @@ -142,6 +247,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -172,6 +278,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -233,6 +340,7 @@ async fn test_close_and_reopen_full_node() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -253,6 +361,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, + false, ) .await; }); @@ -332,6 +441,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, + false, ) .await; }); @@ -384,6 +494,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -403,6 +514,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -636,6 +748,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, Some("demo_data_test_reopen_sequencer"), DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -679,6 +792,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, Some("demo_data_test_reopen_sequencer_copy"), DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/archival_state.rs b/examples/demo-rollup/tests/evm/archival_state.rs index 6c19d8f19..ec5cd2d39 100644 --- a/examples/demo-rollup/tests/evm/archival_state.rs +++ b/examples/demo-rollup/tests/evm/archival_state.rs @@ -30,6 +30,7 @@ async fn test_archival_state() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/gas_price.rs b/examples/demo-rollup/tests/evm/gas_price.rs index ad46d1675..c007aa40c 100644 --- a/examples/demo-rollup/tests/evm/gas_price.rs +++ b/examples/demo-rollup/tests/evm/gas_price.rs @@ -33,6 +33,7 @@ async fn test_gas_price_increase() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index d09d63c0e..21e74db68 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -35,6 +35,7 @@ async fn web3_rpc_tests() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -80,6 +81,7 @@ async fn evm_tx_tests() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); @@ -114,6 +116,7 @@ async fn test_eth_get_logs() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/tracing.rs b/examples/demo-rollup/tests/evm/tracing.rs index ca5bf29fa..7f29c4e10 100644 --- a/examples/demo-rollup/tests/evm/tracing.rs +++ b/examples/demo-rollup/tests/evm/tracing.rs @@ -33,6 +33,7 @@ async fn tracing_tests() -> Result<(), Box> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/mempool/mod.rs b/examples/demo-rollup/tests/mempool/mod.rs index 1479f652c..e161ca0ba 100644 --- a/examples/demo-rollup/tests/mempool/mod.rs +++ b/examples/demo-rollup/tests/mempool/mod.rs @@ -27,6 +27,7 @@ async fn initialize_test() -> (JoinHandle<()>, Box) { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/sequencer_commitments/mod.rs b/examples/demo-rollup/tests/sequencer_commitments/mod.rs index b18e6e482..36687a176 100644 --- a/examples/demo-rollup/tests/sequencer_commitments/mod.rs +++ b/examples/demo-rollup/tests/sequencer_commitments/mod.rs @@ -35,6 +35,7 @@ async fn sequencer_sends_commitments_to_da_layer() { NodeMode::SequencerNode, None, 4, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs b/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs index b6bb145be..ac4760c07 100644 --- a/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs +++ b/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs @@ -28,6 +28,7 @@ async fn too_many_l2_block_per_l1_block() { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, + false, ) .await; }); diff --git a/examples/demo-rollup/tests/test_helpers.rs b/examples/demo-rollup/tests/test_helpers.rs index 19963e09e..8d6d9d423 100644 --- a/examples/demo-rollup/tests/test_helpers.rs +++ b/examples/demo-rollup/tests/test_helpers.rs @@ -35,6 +35,7 @@ pub async fn start_rollup( node_mode: NodeMode, db_path: Option<&str>, min_soft_confirmations_per_commitment: u64, + ignore_tx_body: bool, ) { let mut path = db_path.map(Path::new); let mut temp_dir: Option = None; @@ -73,7 +74,7 @@ pub async fn start_rollup( } NodeMode::SequencerNode => None, }, - ignore_tx_body: false, + ignore_tx_body, }; let sequencer_config = SequencerConfig { From 607d5bf7de55f0f187fba93a56c3ef72b12cf036 Mon Sep 17 00:00:00 2001 From: otaliptus Date: Fri, 22 Mar 2024 17:40:15 +0300 Subject: [PATCH 3/7] Lint fix --- examples/demo-rollup/tests/test_helpers.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/demo-rollup/tests/test_helpers.rs b/examples/demo-rollup/tests/test_helpers.rs index 8d6d9d423..d49341989 100644 --- a/examples/demo-rollup/tests/test_helpers.rs +++ b/examples/demo-rollup/tests/test_helpers.rs @@ -27,6 +27,7 @@ pub enum NodeMode { Prover(SocketAddr), } +#[allow(clippy::too_many_arguments)] pub async fn start_rollup( rpc_reporting_channel: oneshot::Sender, rt_genesis_paths: GenesisPaths, From 801b9929e5850706c61a6177c94b623e783d4231 Mon Sep 17 00:00:00 2001 From: otaliptus Date: Sat, 23 Mar 2024 10:45:14 +0300 Subject: [PATCH 4/7] PR Fixes --- examples/demo-rollup/bitcoin_rollup_config.toml | 1 + examples/demo-rollup/celestia_rollup_config.toml | 4 +++- examples/demo-rollup/mock_dockerized_rollup_config.toml | 1 + examples/demo-rollup/mocknet_rollup_config.toml | 1 + examples/demo-rollup/tests/e2e/mod.rs | 1 - full-node/sov-stf-runner/src/config.rs | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/demo-rollup/bitcoin_rollup_config.toml b/examples/demo-rollup/bitcoin_rollup_config.toml index 83a7f7ba0..fb5a8c7b0 100644 --- a/examples/demo-rollup/bitcoin_rollup_config.toml +++ b/examples/demo-rollup/bitcoin_rollup_config.toml @@ -1,5 +1,6 @@ sequencer_public_key = "0000000000000000000000000000000000000000000000000000000000000000" min_soft_confirmations_per_commitment = 1000 +ignore_tx_body = true [da] node_url = "http://localhost:38332" diff --git a/examples/demo-rollup/celestia_rollup_config.toml b/examples/demo-rollup/celestia_rollup_config.toml index e950ee8c5..0d9f99e04 100644 --- a/examples/demo-rollup/celestia_rollup_config.toml +++ b/examples/demo-rollup/celestia_rollup_config.toml @@ -1,3 +1,5 @@ +ignore_tx_body = true + [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" @@ -23,4 +25,4 @@ bind_host = "127.0.0.1" bind_port = 12345 [prover_service] -aggregated_proof_block_jump = 1 \ No newline at end of file +aggregated_proof_block_jump = 1 diff --git a/examples/demo-rollup/mock_dockerized_rollup_config.toml b/examples/demo-rollup/mock_dockerized_rollup_config.toml index c901a57aa..4b54169a8 100644 --- a/examples/demo-rollup/mock_dockerized_rollup_config.toml +++ b/examples/demo-rollup/mock_dockerized_rollup_config.toml @@ -1,4 +1,5 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" +ignore_tx_body = true [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/mocknet_rollup_config.toml b/examples/demo-rollup/mocknet_rollup_config.toml index 156733c42..97d6e5710 100644 --- a/examples/demo-rollup/mocknet_rollup_config.toml +++ b/examples/demo-rollup/mocknet_rollup_config.toml @@ -1,5 +1,6 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" min_soft_confirmations_per_commitment = 1000 +ignore_tx_body = true [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/tests/e2e/mod.rs b/examples/demo-rollup/tests/e2e/mod.rs index 024fa60e6..0bbbda27d 100644 --- a/examples/demo-rollup/tests/e2e/mod.rs +++ b/examples/demo-rollup/tests/e2e/mod.rs @@ -116,7 +116,6 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { }); let seq_port = seq_port_rx.await.unwrap(); - // let seq_test_client = make_test_client(seq_port).await; let seq_test_client = init_test_rollup(seq_port).await; let addr = Address::from_str("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266").unwrap(); diff --git a/full-node/sov-stf-runner/src/config.rs b/full-node/sov-stf-runner/src/config.rs index fe2dd2896..0e3232cbb 100644 --- a/full-node/sov-stf-runner/src/config.rs +++ b/full-node/sov-stf-runner/src/config.rs @@ -61,7 +61,7 @@ pub struct RollupConfig { pub sequencer_public_key: Vec, /// Prover service configuration. pub prover_service: ProverServiceConfig, - /// Ignore Tx Body + /// Saves sequencer soft batches if set to false pub ignore_tx_body: bool, } From e3807a59f5a761d292c2aaa8a3578f3d83db378e Mon Sep 17 00:00:00 2001 From: otaliptus Date: Mon, 25 Mar 2024 11:38:29 +0300 Subject: [PATCH 5/7] Change name --- .../demo-rollup/bitcoin_rollup_config.toml | 2 +- .../demo-rollup/celestia_rollup_config.toml | 2 +- .../mock_dockerized_rollup_config.toml | 2 +- examples/demo-rollup/mock_rollup_config.toml | 2 +- .../demo-rollup/mocknet_rollup_config.toml | 2 +- examples/demo-rollup/tests/e2e/mod.rs | 28 +++++++++---------- .../demo-rollup/tests/evm/archival_state.rs | 2 +- examples/demo-rollup/tests/evm/gas_price.rs | 2 +- examples/demo-rollup/tests/evm/mod.rs | 6 ++-- examples/demo-rollup/tests/evm/tracing.rs | 2 +- examples/demo-rollup/tests/mempool/mod.rs | 2 +- .../tests/sequencer_commitments/mod.rs | 2 +- .../soft_confirmation_rule_enforcer/mod.rs | 2 +- examples/demo-rollup/tests/test_helpers.rs | 4 +-- full-node/chainway-sequencer/src/sequencer.rs | 3 +- full-node/db/sov-db/src/ledger_db/mod.rs | 4 +-- full-node/sov-stf-runner/src/config.rs | 8 +++--- full-node/sov-stf-runner/src/runner.rs | 8 +++--- .../tests/runner_initialization_tests.rs | 4 +-- .../tests/runner_reorg_tests.rs | 4 +-- .../sov-modules-rollup-blueprint/src/lib.rs | 2 +- 21 files changed, 46 insertions(+), 47 deletions(-) diff --git a/examples/demo-rollup/bitcoin_rollup_config.toml b/examples/demo-rollup/bitcoin_rollup_config.toml index fb5a8c7b0..746db006c 100644 --- a/examples/demo-rollup/bitcoin_rollup_config.toml +++ b/examples/demo-rollup/bitcoin_rollup_config.toml @@ -1,6 +1,6 @@ sequencer_public_key = "0000000000000000000000000000000000000000000000000000000000000000" min_soft_confirmations_per_commitment = 1000 -ignore_tx_body = true +include_tx_body = false [da] node_url = "http://localhost:38332" diff --git a/examples/demo-rollup/celestia_rollup_config.toml b/examples/demo-rollup/celestia_rollup_config.toml index 0d9f99e04..22368d078 100644 --- a/examples/demo-rollup/celestia_rollup_config.toml +++ b/examples/demo-rollup/celestia_rollup_config.toml @@ -1,4 +1,4 @@ -ignore_tx_body = true +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 diff --git a/examples/demo-rollup/mock_dockerized_rollup_config.toml b/examples/demo-rollup/mock_dockerized_rollup_config.toml index 4b54169a8..668fa583e 100644 --- a/examples/demo-rollup/mock_dockerized_rollup_config.toml +++ b/examples/demo-rollup/mock_dockerized_rollup_config.toml @@ -1,5 +1,5 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" -ignore_tx_body = true +include_tx_body = false [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/mock_rollup_config.toml b/examples/demo-rollup/mock_rollup_config.toml index 94defad95..040cdb09a 100644 --- a/examples/demo-rollup/mock_rollup_config.toml +++ b/examples/demo-rollup/mock_rollup_config.toml @@ -1,5 +1,5 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" -ignore_tx_body = true +include_tx_body = false [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/mocknet_rollup_config.toml b/examples/demo-rollup/mocknet_rollup_config.toml index 97d6e5710..a5e83f8d1 100644 --- a/examples/demo-rollup/mocknet_rollup_config.toml +++ b/examples/demo-rollup/mocknet_rollup_config.toml @@ -1,6 +1,6 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" min_soft_confirmations_per_commitment = 1000 -ignore_tx_body = true +include_tx_body = false [da] sender_address = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/examples/demo-rollup/tests/e2e/mod.rs b/examples/demo-rollup/tests/e2e/mod.rs index 0bbbda27d..4cec0ac9c 100644 --- a/examples/demo-rollup/tests/e2e/mod.rs +++ b/examples/demo-rollup/tests/e2e/mod.rs @@ -55,7 +55,7 @@ async fn initialize_test( NodeMode::SequencerNode, None, config.seq_min_soft_confirmations, - false, + true, ) .await; }); @@ -76,7 +76,7 @@ async fn initialize_test( NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -110,7 +110,7 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, config.seq_min_soft_confirmations, - false, + true, ) .await; }); @@ -140,7 +140,7 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -163,7 +163,7 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { NodeMode::FullNode(full_node_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - true, + false, ) .await; }); @@ -246,7 +246,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -277,7 +277,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -339,7 +339,7 @@ async fn test_close_and_reopen_full_node() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -360,7 +360,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, - false, + true, ) .await; }); @@ -440,7 +440,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, - false, + true, ) .await; }); @@ -493,7 +493,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -513,7 +513,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { NodeMode::FullNode(seq_port), None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -747,7 +747,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, Some("demo_data_test_reopen_sequencer"), DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -791,7 +791,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, Some("demo_data_test_reopen_sequencer_copy"), DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/archival_state.rs b/examples/demo-rollup/tests/evm/archival_state.rs index ec5cd2d39..738c05925 100644 --- a/examples/demo-rollup/tests/evm/archival_state.rs +++ b/examples/demo-rollup/tests/evm/archival_state.rs @@ -30,7 +30,7 @@ async fn test_archival_state() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/gas_price.rs b/examples/demo-rollup/tests/evm/gas_price.rs index c007aa40c..fef8e2170 100644 --- a/examples/demo-rollup/tests/evm/gas_price.rs +++ b/examples/demo-rollup/tests/evm/gas_price.rs @@ -33,7 +33,7 @@ async fn test_gas_price_increase() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/mod.rs b/examples/demo-rollup/tests/evm/mod.rs index 21e74db68..33179d7cd 100644 --- a/examples/demo-rollup/tests/evm/mod.rs +++ b/examples/demo-rollup/tests/evm/mod.rs @@ -35,7 +35,7 @@ async fn web3_rpc_tests() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -81,7 +81,7 @@ async fn evm_tx_tests() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); @@ -116,7 +116,7 @@ async fn test_eth_get_logs() -> Result<(), anyhow::Error> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/evm/tracing.rs b/examples/demo-rollup/tests/evm/tracing.rs index 7f29c4e10..91b178428 100644 --- a/examples/demo-rollup/tests/evm/tracing.rs +++ b/examples/demo-rollup/tests/evm/tracing.rs @@ -33,7 +33,7 @@ async fn tracing_tests() -> Result<(), Box> { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/mempool/mod.rs b/examples/demo-rollup/tests/mempool/mod.rs index e161ca0ba..32129f2b3 100644 --- a/examples/demo-rollup/tests/mempool/mod.rs +++ b/examples/demo-rollup/tests/mempool/mod.rs @@ -27,7 +27,7 @@ async fn initialize_test() -> (JoinHandle<()>, Box) { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/sequencer_commitments/mod.rs b/examples/demo-rollup/tests/sequencer_commitments/mod.rs index 36687a176..3a76636c2 100644 --- a/examples/demo-rollup/tests/sequencer_commitments/mod.rs +++ b/examples/demo-rollup/tests/sequencer_commitments/mod.rs @@ -35,7 +35,7 @@ async fn sequencer_sends_commitments_to_da_layer() { NodeMode::SequencerNode, None, 4, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs b/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs index ac4760c07..157235fc3 100644 --- a/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs +++ b/examples/demo-rollup/tests/soft_confirmation_rule_enforcer/mod.rs @@ -28,7 +28,7 @@ async fn too_many_l2_block_per_l1_block() { NodeMode::SequencerNode, None, DEFAULT_MIN_SOFT_CONFIRMATIONS_PER_COMMITMENT, - false, + true, ) .await; }); diff --git a/examples/demo-rollup/tests/test_helpers.rs b/examples/demo-rollup/tests/test_helpers.rs index d49341989..c4bf5346d 100644 --- a/examples/demo-rollup/tests/test_helpers.rs +++ b/examples/demo-rollup/tests/test_helpers.rs @@ -36,7 +36,7 @@ pub async fn start_rollup( node_mode: NodeMode, db_path: Option<&str>, min_soft_confirmations_per_commitment: u64, - ignore_tx_body: bool, + include_tx_body: bool, ) { let mut path = db_path.map(Path::new); let mut temp_dir: Option = None; @@ -75,7 +75,7 @@ pub async fn start_rollup( } NodeMode::SequencerNode => None, }, - ignore_tx_body, + include_tx_body, }; let sequencer_config = SequencerConfig { diff --git a/full-node/chainway-sequencer/src/sequencer.rs b/full-node/chainway-sequencer/src/sequencer.rs index 067834e21..4cc28be54 100644 --- a/full-node/chainway-sequencer/src/sequencer.rs +++ b/full-node/chainway-sequencer/src/sequencer.rs @@ -443,8 +443,7 @@ where self.state_root = next_state_root; - self.ledger_db - .commit_soft_batch(soft_batch_receipt, false)?; + self.ledger_db.commit_soft_batch(soft_batch_receipt, true)?; self.mempool .remove_transactions(self.db_provider.last_block_tx_hashes()); diff --git a/full-node/db/sov-db/src/ledger_db/mod.rs b/full-node/db/sov-db/src/ledger_db/mod.rs index 722fe74d2..5430bb5eb 100644 --- a/full-node/db/sov-db/src/ledger_db/mod.rs +++ b/full-node/db/sov-db/src/ledger_db/mod.rs @@ -245,7 +245,7 @@ impl LedgerDB { pub fn commit_soft_batch( &self, batch_receipt: SoftBatchReceipt, - ignore_tx_body: bool, + include_tx_body: bool, ) -> Result<(), anyhow::Error> { // Create a scope to ensure that the lock is released before we commit to the db let mut current_item_numbers = { @@ -284,7 +284,7 @@ impl LedgerDB { // Rollup full nodes don't need to store the tx body as they already store evm body // Sequencer full nodes need to store the tx body as they are the only ones that have it - if ignore_tx_body { + if !include_tx_body { tx_to_store.body = None; } diff --git a/full-node/sov-stf-runner/src/config.rs b/full-node/sov-stf-runner/src/config.rs index 0e3232cbb..1f76f994c 100644 --- a/full-node/sov-stf-runner/src/config.rs +++ b/full-node/sov-stf-runner/src/config.rs @@ -61,8 +61,8 @@ pub struct RollupConfig { pub sequencer_public_key: Vec, /// Prover service configuration. pub prover_service: ProverServiceConfig, - /// Saves sequencer soft batches if set to false - pub ignore_tx_body: bool, + /// Saves sequencer soft batches if set to true + pub include_tx_body: bool, } /// Reads toml file as a specific type. @@ -99,7 +99,7 @@ mod tests { fn test_correct_config() { let config = r#" sequencer_public_key = "0000000000000000000000000000000000000000000000000000000000000000" - ignore_tx_body = false + include_tx_body = true [da] celestia_rpc_auth_token = "SECRET_RPC_TOKEN" celestia_rpc_address = "http://localhost:11111/" @@ -146,7 +146,7 @@ mod tests { prover_service: ProverServiceConfig { aggregated_proof_block_jump: 22, }, - ignore_tx_body: false, + include_tx_body: true, }; assert_eq!(config, expected); } diff --git a/full-node/sov-stf-runner/src/runner.rs b/full-node/sov-stf-runner/src/runner.rs index a34834595..8a6d65808 100644 --- a/full-node/sov-stf-runner/src/runner.rs +++ b/full-node/sov-stf-runner/src/runner.rs @@ -60,7 +60,7 @@ where sequencer_client: Option, sequencer_pub_key: Vec, phantom: std::marker::PhantomData, - ignore_tx_body: bool, + include_tx_body: bool, } /// Represents the possible modes of execution for a zkVM program @@ -123,7 +123,7 @@ where prover_service: Option, sequencer_client: Option, sequencer_pub_key: Vec, - ignore_tx_body: bool, + include_tx_body: bool, ) -> Result { let rpc_config = runner_config.rpc_config; @@ -172,7 +172,7 @@ where sequencer_client, sequencer_pub_key, phantom: std::marker::PhantomData, - ignore_tx_body, + include_tx_body, }) } @@ -499,7 +499,7 @@ where }; self.ledger_db - .commit_soft_batch(soft_batch_receipt, self.ignore_tx_body)?; + .commit_soft_batch(soft_batch_receipt, self.include_tx_body)?; self.ledger_db .extend_l2_range_of_l1_slot( SlotNumber(filtered_block.header().height()), diff --git a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs index 057e7bb3a..1f369b6c2 100644 --- a/full-node/sov-stf-runner/tests/runner_initialization_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_initialization_tests.rs @@ -83,7 +83,7 @@ fn initialize_runner( aggregated_proof_block_jump: 1, }, sequencer_client: None, - ignore_tx_body: false, + include_tx_body: true, }; let da_service = MockDaService::new(address); @@ -123,7 +123,7 @@ fn initialize_runner( Some(prover_service), None, vec![0u8; 32], - false, + true, ) .unwrap() } diff --git a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs index 7635e01cc..79cc11cbb 100644 --- a/full-node/sov-stf-runner/tests/runner_reorg_tests.rs +++ b/full-node/sov-stf-runner/tests/runner_reorg_tests.rs @@ -139,7 +139,7 @@ async fn runner_execution( aggregated_proof_block_jump: 1, }, sequencer_client: None, - ignore_tx_body: false, + include_tx_body: true, }; let ledger_db = LedgerDB::with_path(path).unwrap(); @@ -177,7 +177,7 @@ async fn runner_execution( Some(prover_service), None, vec![0u8; 32], - false, + true, ) .unwrap(); diff --git a/module-system/sov-modules-rollup-blueprint/src/lib.rs b/module-system/sov-modules-rollup-blueprint/src/lib.rs index ffecfe398..2e6b2a126 100644 --- a/module-system/sov-modules-rollup-blueprint/src/lib.rs +++ b/module-system/sov-modules-rollup-blueprint/src/lib.rs @@ -294,7 +294,7 @@ pub trait RollupBlueprint: Sized + Send + Sync { prover_service, sequencer_client, rollup_config.sequencer_public_key, - rollup_config.ignore_tx_body, + rollup_config.include_tx_body, )?; Ok(Rollup { From 858039c964f6f016e7414fce04adc65e6517642e Mon Sep 17 00:00:00 2001 From: otaliptus Date: Mon, 25 Mar 2024 13:52:34 +0300 Subject: [PATCH 6/7] Add execute blocks --- examples/demo-rollup/tests/e2e/mod.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/demo-rollup/tests/e2e/mod.rs b/examples/demo-rollup/tests/e2e/mod.rs index 4cec0ac9c..1d3635f12 100644 --- a/examples/demo-rollup/tests/e2e/mod.rs +++ b/examples/demo-rollup/tests/e2e/mod.rs @@ -117,15 +117,6 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { let seq_port = seq_port_rx.await.unwrap(); let seq_test_client = init_test_rollup(seq_port).await; - let addr = Address::from_str("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266").unwrap(); - - for _ in 0..10 { - seq_test_client - .send_eth(addr, None, None, None, 0u128) - .await - .unwrap(); - seq_test_client.send_publish_batch_request().await; - } let (full_node_port_tx, full_node_port_rx) = tokio::sync::oneshot::channel(); @@ -148,6 +139,8 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { let full_node_port = full_node_port_rx.await.unwrap(); let full_node_test_client = make_test_client(full_node_port).await; + let _ = execute_blocks(&seq_test_client, &full_node_test_client).await; + sleep(Duration::from_secs(10)).await; let (full_node_port_tx_2, full_node_port_rx_2) = tokio::sync::oneshot::channel(); @@ -174,13 +167,13 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { sleep(Duration::from_secs(10)).await; let seq_block = seq_test_client - .eth_get_block_by_number(Some(BlockNumberOrTag::Number(10))) + .eth_get_block_by_number(Some(BlockNumberOrTag::Latest)) .await; let full_node_block = full_node_test_client - .eth_get_block_by_number(Some(BlockNumberOrTag::Number(10))) + .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::Number(10))) + .eth_get_block_by_number(Some(BlockNumberOrTag::Latest)) .await; assert_eq!(seq_block.state_root, full_node_block.state_root); From 69934a3764cdb1f4fd4bd0e8ce61c0ac762f3262 Mon Sep 17 00:00:00 2001 From: otaliptus Date: Mon, 25 Mar 2024 14:27:46 +0300 Subject: [PATCH 7/7] Increase sync time --- examples/demo-rollup/tests/e2e/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo-rollup/tests/e2e/mod.rs b/examples/demo-rollup/tests/e2e/mod.rs index 1d3635f12..fa625a96e 100644 --- a/examples/demo-rollup/tests/e2e/mod.rs +++ b/examples/demo-rollup/tests/e2e/mod.rs @@ -164,7 +164,7 @@ async fn test_soft_batch_save() -> Result<(), anyhow::Error> { 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; - sleep(Duration::from_secs(10)).await; + sleep(Duration::from_secs(20)).await; let seq_block = seq_test_client .eth_get_block_by_number(Some(BlockNumberOrTag::Latest))