diff --git a/docs/hashes.toml b/docs/hashes.toml index e850b23b05..3a3d9c1601 100644 --- a/docs/hashes.toml +++ b/docs/hashes.toml @@ -84,6 +84,48 @@ included_cells = ["Bundled(specs/cells/secp256k1_data)", "Bundled(specs/cells/se tx_hash = "0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37" index = 1 +[ckb_preview] +spec_hash = "0xce18c4b1c6da3f10ab46bc5dc53aaebe55f03d9643512734d105d7fc86201518" +genesis = "0x9ed819e4bac690c22e97111baf7fbc873811fa053bfa8764db22e138be3f3728" +cellbase = "0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362" + +[[ckb_preview.system_cells]] +path = "Bundled(specs/cells/secp256k1_blake160_sighash_all)" +tx_hash = "0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362" +index = 1 +data_hash = "0x709f3fda12f561cfacf92273c57a98fede188a3f1a59b1f888d113f9cce08649" +type_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" + +[[ckb_preview.system_cells]] +path = "Bundled(specs/cells/dao)" +tx_hash = "0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362" +index = 2 +data_hash = "0x32064a14ce10d95d4b7343054cc19d73b25b16ae61a6c681011ca781a60c7923" +type_hash = "0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e" + +[[ckb_preview.system_cells]] +path = "Bundled(specs/cells/secp256k1_data)" +tx_hash = "0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362" +index = 3 +data_hash = "0x9799bee251b975b82c45a02154ce28cec89c5853ecc14d12b7b8cccfc19e0af4" + +[[ckb_preview.system_cells]] +path = "Bundled(specs/cells/secp256k1_blake160_multisig_all)" +tx_hash = "0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362" +index = 4 +data_hash = "0x43400de165f0821abf63dcac299bbdf7fd73898675ee4ddb099b0a0d8db63bfb" +type_hash = "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8" + +[[ckb_preview.dep_groups]] +included_cells = ["Bundled(specs/cells/secp256k1_data)", "Bundled(specs/cells/secp256k1_blake160_sighash_all)"] +tx_hash = "0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816" +index = 0 + +[[ckb_preview.dep_groups]] +included_cells = ["Bundled(specs/cells/secp256k1_data)", "Bundled(specs/cells/secp256k1_blake160_multisig_all)"] +tx_hash = "0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816" +index = 1 + [ckb_staging] spec_hash = "0x7a0ed50e9723e6c41a5c8450225e9f0a639070bb81b87e395fd5f91eef6ce373" genesis = "0xbc081e6b2e31149c1dc39007f161ed0a0b63d5d30b3b771acc6a3b622133fcc0" diff --git a/resource/ckb-miner.toml b/resource/ckb-miner.toml index 5d4e89fc87..dfbd6946a3 100644 --- a/resource/ckb-miner.toml +++ b/resource/ckb-miner.toml @@ -2,6 +2,7 @@ # see => resource/src/template.rs # mainnet => # Config generated by `ckb init --chain mainnet` # testnet => # Config generated by `ckb init --chain testnet` +# preview => # Config generated by `ckb init --chain preview` # staging => # Config generated by `ckb init --chain staging` # }} @@ -16,6 +17,7 @@ spec = { file = "specs/dev.toml" } # {{ # testnet => spec = { {spec_source} = "specs/testnet.toml" } # mainnet => spec = { {spec_source} = "specs/mainnet.toml" } # staging => spec = { {spec_source} = "specs/staging.toml" } +# preview => spec = { {spec_source} = "specs/preview.toml" } # integration => spec = { file = "specs/integration.toml" } # }} @@ -33,6 +35,7 @@ log_to_stdout = true # {{ # set to blank to disable sentry error collection dsn = "" # {{ # testnet => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" +# preview => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" # staging => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" # }} # if you are willing to help us to improve, diff --git a/resource/ckb.toml b/resource/ckb.toml index c2091ad87e..262b5fa496 100644 --- a/resource/ckb.toml +++ b/resource/ckb.toml @@ -3,6 +3,7 @@ # mainnet => # Config generated by `ckb init --chain mainnet` # testnet => # Config generated by `ckb init --chain testnet` # staging => # Config generated by `ckb init --chain staging` +# preview => # Config generated by `ckb init --chain preview` # }} data_dir = "data" @@ -10,9 +11,11 @@ data_dir = "data" [chain] # Choose the kind of chains to run, possible values: # - { file = "specs/dev.toml" } +# - { bundled = "specs/preview.toml" } # - { bundled = "specs/testnet.toml" } # - { bundled = "specs/mainnet.toml" } spec = { file = "specs/dev.toml" } # {{ +# preview => spec = { {spec_source} = "specs/preview.toml" } # testnet => spec = { {spec_source} = "specs/testnet.toml" } # mainnet => spec = { {spec_source} = "specs/mainnet.toml" } # staging => spec = { {spec_source} = "specs/staging.toml" } @@ -34,6 +37,7 @@ log_to_stdout = true # {{ [sentry] # set to blank to disable sentry error collection dsn = "" # {{ +# preview => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" # testnet => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" # staging => dsn = "https://dda4f353e15f4b62800d273a2afe70c2@sentry.nervos.org/4" # mainnet => dsn = "" @@ -70,6 +74,7 @@ listen_addresses = ["/ip4/0.0.0.0/tcp/8115"] # {{ bootnodes = [] # {{ # mainnet => bootnodes = [\n # Hongkong, Asia\n "/ip4/16.163.82.218/tcp/8114/p2p/QmaZMemLXSsxKUrYNucjEbPxVX3rBKsGhWW2muWtWxUWyh",\n # Tokyo, Asia\n "/ip4/35.79.196.111/tcp/8114/p2p/QmYCRVonLfP18LSoz2WCHaXDorUYxuUMfhtcXK1TuZ1iwF",\n # Mumbai, Asia\n "/ip4/13.234.144.148/tcp/8114/p2p/QmbT7QimcrcD5k2znoJiWpxoESxang6z1Gy9wof1rT1LKR",\n # Seoul, Asia\n "/ip4/34.64.120.143/tcp/8114/p2p/QmejEJEbDcGGMp4D6WtftMMVLkR1ZuBfMgyLFDMJymkDt6",\n # Virginia, North America\n "/ip4/3.218.170.86/tcp/8114/p2p/QmShw2vtVt49wJagc1zGQXGS6LkQTcHxnEV3xs6y8MAmQN",\n # Los Angeles, North America\n "/ip4/35.236.107.161/tcp/8114/p2p/QmSRj57aa9sR2AiTvMyrEea8n1sEM1cDTrfb2VHVJxnGuu",\n # Texas, North America\n "/ip4/23.101.191.12/tcp/8114/p2p/QmexvXVDiRt2FBGptgK4gBJusWyyTEEaHeuCAa35EPNkZS",\n # Toronto, North America\n "/ip4/20.151.143.237/tcp/8114/p2p/QmNsGNQjYA6iP472bNnNE2GR31kCYBifhY1XcaUxRjZ1py",\n # Frankfurt, Europe\n "/ip4/52.59.155.249/tcp/8114/p2p/QmRHqhSGMGm5FtnkW8D6T83X7YwaiMAZXCXJJaKzQEo3rb",\n # London, Europe\n "/ip4/3.10.216.39/tcp/8114/p2p/QmagxSv7GNwKXQE7mi1iDjFHghjUpbqjBgqSot7PmMJqHA",\n # Paris, Europe\n "/ip4/13.37.172.80/tcp/8114/p2p/QmXJg4iKbQzMpLhX75RyDn89Mv7N2H8vLePBR7kgZf6hYk",\n # Warsaw, Europe\n "/ip4/34.118.49.255/tcp/8114/p2p/QmeCzzVmSAU5LNYAeXhdJj8TCq335aJMqUxcvZXERBWdgS",\n # Victoria, Oceania\n "/ip4/40.115.75.216/tcp/8114/p2p/QmW3P1WYtuz9hitqctKnRZua2deHXhNePNjvtc9Qjnwp4q",\n # Santiago, South America\n "/ip4/34.176.239.95/tcp/8114/p2p/QmQoWrmuFauCn3zZ2mYYKAciG9opTbjzC2wVEfWveZNDt8",\n # Capetown, Africa\n "/ip4/13.245.217.98/tcp/8114/p2p/Qmf4t1SzFhRWuGcFcgs7r4pXvkACsz3FcaBMcmMKQMMpn7"\n] # testnet => bootnodes = [\n # Ohio, North America\n "/ip4/18.217.146.65/tcp/8111/p2p/QmT6DFfm18wtbJz3y4aPNn3ac86N4d4p4xtfQRRPf73frC",\n # Singapore, Asia\n "/ip4/18.136.60.221/tcp/8111/p2p/QmTt6HeNakL8Fpmevrhdna7J4NzEMf9pLchf1CXtmtSrwb",\n # London, Europe\n "/ip4/35.176.207.239/tcp/8111/p2p/QmSJTsMsMGBjzv1oBNwQU36VhQRxc2WQpFoRu1ZifYKrjZ",\n # Singapore, Asia\n "/ip4/13.228.149.113/tcp/8111/p2p/QmQoTR39rBkpZVgLApDGDoFnJ2YDBS9hYeiib1Z6aoAdEf",\n # Bahrain, Asia\n "/ip4/157.241.73.87/tcp/8111/p2p/QmSPkAyXqsWpRiS7HpHLTProVdhQWLKFHCXbRjaLpJj7ZL",\n # Japan, Asia\n "/ip4/4.241.132.26/tcp/8111/p2p/QmX5D6aJiAQ5Fxn4BfVqSn6zrgyuQM1oXVC9yvmzLuHXnx",\n # Korea, Asia\n "/ip4/52.147.120.180/tcp/8111/p2p/QmPcJY2gZLUm66szYA9QaG1P3rzwseWCMgbj6AyNCyW4G2",\n # Hong Kong, Asia\n "/ip4/18.167.196.121/tcp/8111/p2p/QmQMjFrNGaphzfHin3mbYybbJcFMDUihKAcknquYvm9J3W",\n # Oregon, North America\n "/ip4/34.216.103.183/tcp/8111/p2p/Qmd41MaByDprkC5gP1XBKgamZ9DTLNk37zbPgwtiWCzRV6",\n # Canada, North America\n "/ip4/3.98.152.180/tcp/8111/p2p/QmWVuW5KquiWDSqgMJRFW1xRtVqkYJrWz6S9NNk6fFn3wh",\n # Frankfurt, Europe\n "/ip4/18.192.147.65/tcp/8111/p2p/QmWcEhsMNRcfJit62EbKgzpgtAJZX1G3Ur4shXjcvLsYDb",\n # Sydney, Oceania\n "/ip4/13.236.13.195/tcp/8111/p2p/QmfUTZxsse7rFJTJfoUv8bbStoDLETxst5nJEpJozNuAnH"\n] +# preview => bootnodes = [\n "/ip4/43.198.48.141/tcp/8118/p2p/QmQDJWySDgJC8eKmdZBMJuYiin5cJUhbYeBjNWvrXRYYUK",\n "/ip4/13.39.144.196/tcp/8118/p2p/QmZQbkHeN2NP9mze3QZMRBAoFePZ7UHCkaJX3uJzxze48V",\n "/ip4/13.213.203.124/tcp/8118/p2p/QmNiVYpv19KgeP6duwqzJHM6754vc82t4Kq6TUGxKbRb4a",\n "/ip4/18.214.154.228/tcp/8118/p2p/QmaiSHpGDiBVbs6hfM3tuF77GaX14mVhGueRH48ibCyQpL" \n] # staging => bootnodes = [] # }} diff --git a/resource/specs/preview.toml b/resource/specs/preview.toml new file mode 100644 index 0000000000..ecff1d058e --- /dev/null +++ b/resource/specs/preview.toml @@ -0,0 +1,93 @@ +name = "ckb_preview" + +[genesis] +version = 0 +parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +timestamp = 1589276230000 +compact_target = 0x1e015555 +uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +nonce = "0x0" +# run `cargo run list-hashes -b` to get the genesis hash +hash = "0x9ed819e4bac690c22e97111baf7fbc873811fa053bfa8764db22e138be3f3728" + +[genesis.genesis_cell] +message = "ckb_preview" + +[genesis.genesis_cell.lock] +code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +args = "0x" +hash_type = "data" + +# An array list paths to system cell files, which is absolute or relative to +# the directory containing this config file. +[[genesis.system_cells]] +file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } +create_type_id = true +capacity = 100_000_0000_0000 +[[genesis.system_cells]] +file = { bundled = "specs/cells/dao" } +create_type_id = true +capacity = 16_000_0000_0000 +[[genesis.system_cells]] +file = { bundled = "specs/cells/secp256k1_data" } +create_type_id = false +capacity = 1_048_617_0000_0000 +[[genesis.system_cells]] +file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } +create_type_id = true +capacity = 100_000_0000_0000 + +[genesis.system_cells_lock] +code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +args = "0x" +hash_type = "data" + +# Dep group cells +[[genesis.dep_groups]] +name = "secp256k1_blake160_sighash_all" +files = [ + { bundled = "specs/cells/secp256k1_data" }, + { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, +] +[[genesis.dep_groups]] +name = "secp256k1_blake160_multisig_all" +files = [ + { bundled = "specs/cells/secp256k1_data" }, + { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, +] + +# For first 11 block +[genesis.bootstrap_lock] +code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +args = "0x" +hash_type = "type" + +# Burn +[[genesis.issued_cells]] +capacity = 8_400_000_000_00000000 +lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" +lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" +lock.hash_type = "data" + +# Locks for developers to run tests +[[genesis.issued_cells]] +capacity = 8_399_578_345_00000000 +lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" +lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" +lock.hash_type = "type" +[[genesis.issued_cells]] +capacity = 8_399_578_345_00000000 +lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" +lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" +lock.hash_type = "type" +[[genesis.issued_cells]] +capacity = 8_399_578_347_00000000 +lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" +lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" +lock.hash_type = "type" + +[params.hardfork] +ckb2023 = 0 + +[pow] +func = "Eaglesong" diff --git a/resource/src/template.rs b/resource/src/template.rs index 319b09bf95..83458206ff 100644 --- a/resource/src/template.rs +++ b/resource/src/template.rs @@ -1,7 +1,7 @@ /// Default chain spec. pub const DEFAULT_SPEC: &str = "mainnet"; /// The list of bundled chain specs. -pub const AVAILABLE_SPECS: &[&str] = &["mainnet", "testnet", "staging", "dev"]; +pub const AVAILABLE_SPECS: &[&str] = &["mainnet", "testnet", "preview", "staging", "dev"]; /// The default RPC listen port *8114*. pub const DEFAULT_RPC_PORT: &str = "8114"; /// The default P2P listen port *8115*. diff --git a/verification/src/block_verifier.rs b/verification/src/block_verifier.rs index 0fc19d911c..488afa57a8 100644 --- a/verification/src/block_verifier.rs +++ b/verification/src/block_verifier.rs @@ -4,7 +4,7 @@ use crate::{ use ckb_chain_spec::consensus::Consensus; use ckb_error::Error; use ckb_types::{ - core::BlockView, + core::{BlockView, ScriptHashType}, packed::{CellInput, CellbaseWitness}, prelude::*, }; @@ -105,7 +105,13 @@ impl CellbaseVerifier { if cellbase_transaction .witnesses() .get(0) - .and_then(|witness| CellbaseWitness::from_slice(&witness.raw_data()).ok()) + .and_then(|witness| { + CellbaseWitness::from_slice(&witness.raw_data()) + .ok() + .and_then(|cellbase_witness| { + ScriptHashType::try_from(cellbase_witness.lock().hash_type()).ok() + }) + }) .is_none() { return Err((CellbaseError::InvalidWitness).into()); diff --git a/verification/src/tests/block_verifier.rs b/verification/src/tests/block_verifier.rs index e2638882ef..bdcdffa223 100644 --- a/verification/src/tests/block_verifier.rs +++ b/verification/src/tests/block_verifier.rs @@ -17,6 +17,8 @@ use ckb_types::{ use super::BuilderBaseOnBlockNumber; +const MOCK_BLOCK_NUMBER: BlockNumber = 2; + fn create_cellbase_transaction_with_block_number(number: BlockNumber) -> TransactionView { TransactionBuilder::default() .input(CellInput::new_cellbase_input(number)) @@ -32,7 +34,7 @@ fn create_cellbase_transaction_with_block_number(number: BlockNumber) -> Transac fn create_cellbase_transaction_with_capacity(capacity: Capacity) -> TransactionView { TransactionBuilder::default() - .input(CellInput::new_cellbase_input(0)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .output( CellOutputBuilder::default() .capacity(capacity.pack()) @@ -45,7 +47,7 @@ fn create_cellbase_transaction_with_capacity(capacity: Capacity) -> TransactionV fn create_cellbase_transaction_with_non_empty_output_data() -> TransactionView { TransactionBuilder::default() - .input(CellInput::new_cellbase_input(0)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .output( CellOutputBuilder::default() .capacity(capacity_bytes!(100).pack()) @@ -58,7 +60,7 @@ fn create_cellbase_transaction_with_non_empty_output_data() -> TransactionView { fn create_cellbase_transaction_with_two_output() -> TransactionView { TransactionBuilder::default() - .input(CellInput::new_cellbase_input(0)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .output( CellOutputBuilder::default() .capacity(capacity_bytes!(100).pack()) @@ -76,7 +78,7 @@ fn create_cellbase_transaction_with_two_output() -> TransactionView { fn create_cellbase_transaction_with_two_output_data() -> TransactionView { TransactionBuilder::default() - .input(CellInput::new_cellbase_input(0)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .output( CellOutputBuilder::default() .capacity(capacity_bytes!(100).pack()) @@ -92,6 +94,25 @@ fn create_cellbase_transaction() -> TransactionView { create_cellbase_transaction_with_capacity(capacity_bytes!(100)) } +fn create_cellbase_transaction_with_unknown_hash_type() -> TransactionView { + TransactionBuilder::default() + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) + .output( + CellOutputBuilder::default() + .capacity(capacity_bytes!(100).pack()) + .build(), + ) + .output_data(Bytes::new().pack()) + .witness( + Script::default() + .as_builder() + .hash_type(3.into()) + .build() + .into_witness(), + ) + .build() +} + fn create_normal_transaction() -> TransactionView { TransactionBuilder::default() .input(CellInput::new(OutPoint::new(h256!("0x1").pack(), 0), 0)) @@ -154,7 +175,7 @@ pub fn test_block_with_incorrect_cellbase_number() { #[test] pub fn test_block_with_one_cellbase_at_last() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(create_normal_transaction()) .transaction(create_cellbase_transaction()) .build(); @@ -166,9 +187,22 @@ pub fn test_block_with_one_cellbase_at_last() { ); } +#[test] +pub fn test_block_with_unknown_hash_type_cellbase() { + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) + .transaction(create_cellbase_transaction_with_unknown_hash_type()) + .build(); + + let verifier = CellbaseVerifier::new(); + assert_error_eq!( + verifier.verify(&block).unwrap_err(), + CellbaseError::InvalidWitness, + ); +} + #[test] pub fn test_cellbase_with_non_empty_output_data() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(create_cellbase_transaction_with_non_empty_output_data()) .build(); let verifier = CellbaseVerifier::new(); @@ -182,10 +216,10 @@ pub fn test_cellbase_with_non_empty_output_data() { pub fn test_cellbase_without_output() { // without_output let cellbase_without_output = TransactionBuilder::default() - .input(CellInput::new_cellbase_input(2u64)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .witness(Script::default().into_witness()) .build(); - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(cellbase_without_output) .build(); let result = CellbaseVerifier::new().verify(&block); @@ -193,11 +227,11 @@ pub fn test_cellbase_without_output() { // only output_data let cellbase_without_output = TransactionBuilder::default() - .input(CellInput::new_cellbase_input(2u64)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .witness(Script::default().into_witness()) .output_data(Bytes::new().pack()) .build(); - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(cellbase_without_output) .build(); let result = CellbaseVerifier::new().verify(&block); @@ -205,7 +239,7 @@ pub fn test_cellbase_without_output() { // only output let cellbase_without_output = TransactionBuilder::default() - .input(CellInput::new_cellbase_input(2u64)) + .input(CellInput::new_cellbase_input(MOCK_BLOCK_NUMBER)) .witness(Script::default().into_witness()) .output( CellOutputBuilder::default() @@ -213,7 +247,7 @@ pub fn test_cellbase_without_output() { .build(), ) .build(); - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(cellbase_without_output) .build(); let result = CellbaseVerifier::new().verify(&block); @@ -222,7 +256,7 @@ pub fn test_cellbase_without_output() { #[test] pub fn test_cellbase_with_two_output() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(create_cellbase_transaction_with_two_output()) .build(); let verifier = CellbaseVerifier::new(); @@ -234,7 +268,7 @@ pub fn test_cellbase_with_two_output() { #[test] pub fn test_cellbase_with_two_output_data() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(create_cellbase_transaction_with_two_output_data()) .build(); let verifier = CellbaseVerifier::new(); @@ -247,7 +281,7 @@ pub fn test_cellbase_with_two_output_data() { #[test] pub fn test_block_with_duplicated_txs() { let tx = create_normal_transaction(); - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(tx.clone()) .transaction(tx) .build(); @@ -261,7 +295,7 @@ pub fn test_block_with_duplicated_txs() { #[test] pub fn test_block_with_duplicated_proposals() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .proposal(ProposalShortId::zero()) .proposal(ProposalShortId::zero()) .build(); @@ -275,7 +309,7 @@ pub fn test_block_with_duplicated_proposals() { #[test] pub fn test_transaction_root() { - let header = HeaderBuilder::new_with_number(2) + let header = HeaderBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transactions_root(Byte32::zero()) .build(); let block = BlockBuilder::default() @@ -292,7 +326,7 @@ pub fn test_transaction_root() { #[test] pub fn test_proposals_root() { - let header = HeaderBuilder::new_with_number(2) + let header = HeaderBuilder::new_with_number(MOCK_BLOCK_NUMBER) .proposals_hash(h256!("0x1").pack()) .build(); let block = BlockBuilder::default() @@ -309,7 +343,7 @@ pub fn test_proposals_root() { #[test] pub fn test_block_with_two_cellbases() { - let block = BlockBuilder::new_with_number(2) + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER) .transaction(create_cellbase_transaction()) .transaction(create_cellbase_transaction()) .build(); @@ -370,7 +404,7 @@ pub fn test_max_block_bytes_verifier_skip_genesis() { #[test] pub fn test_max_block_bytes_verifier() { - let block = BlockBuilder::new_with_number(2).build(); + let block = BlockBuilder::new_with_number(MOCK_BLOCK_NUMBER).build(); { let verifier =