Skip to content

Commit

Permalink
Merge branch 'develop' into zhangsoledad/ckb2021-develop-confilct-res…
Browse files Browse the repository at this point in the history
…olved
  • Loading branch information
zhangsoledad committed Jun 11, 2021
2 parents 30360a2 + 9312873 commit 6893a07
Show file tree
Hide file tree
Showing 31 changed files with 574 additions and 222 deletions.
114 changes: 65 additions & 49 deletions Cargo.lock

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

16 changes: 4 additions & 12 deletions chain/src/tests/load_input_data_hash_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::tests::util::{
use ckb_chain_spec::consensus::ConsensusBuilder;
use ckb_dao_utils::genesis_dao_data;
use ckb_test_chain_utils::load_input_data_hash_cell;
use ckb_tx_pool::{PlugTarget, TxEntry};
use ckb_types::prelude::*;
use ckb_types::{
bytes::Bytes,
Expand Down Expand Up @@ -49,7 +48,7 @@ pub(crate) fn create_load_input_data_hash_transaction(
.build()
}

// Ensure tx-pool reject tx which calls syscall load_cell_data_hash from input
// Ensure tx-pool accept tx which calls syscall load_cell_data_hash from input
#[test]
fn test_load_input_data_hash_cell() {
let (_, _, load_input_data_hash_script) = load_input_data_hash_cell();
Expand Down Expand Up @@ -86,16 +85,9 @@ fn test_load_input_data_hash_cell() {
let tx1 = create_load_input_data_hash_transaction(&tx0, 0);

let tx_pool = shared.tx_pool_controller();
let ret = tx_pool.submit_local_tx(tx0.clone()).unwrap();
assert!(ret.is_err());
//ValidationFailure(2) missing item
assert!(format!("{}", ret.err().unwrap()).contains("ValidationFailure(2)"));
let ret = tx_pool.submit_local_tx(tx0).unwrap();
assert!(ret.is_ok());

let entry0 = vec![TxEntry::dummy_resolve(tx0, 0, Capacity::shannons(0), 100)];
tx_pool.plug_entry(entry0, PlugTarget::Proposed).unwrap();

// Ensure tx which calls syscall load_cell_data_hash will got reject even previous tx is already in tx-pool
let ret = tx_pool.submit_local_tx(tx1).unwrap();
assert!(ret.is_err());
assert!(format!("{}", ret.err().unwrap()).contains("ValidationFailure(2)"));
assert!(ret.is_ok());
}
2 changes: 1 addition & 1 deletion db-migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ckb-db = { path = "../db", version = "= 0.43.0-pre" }
ckb-logger = { path = "../util/logger", version = "= 0.43.0-pre" }
ckb-error = { path = "../error", version = "= 0.43.0-pre" }
ckb-db-schema = { path = "../db-schema", version = "= 0.43.0-pre" }
indicatif = "0.15"
indicatif = "0.16"
console = ">=0.9.1, <1.0.0"

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions db-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ impl Migrations {
let mpbc = Arc::clone(&mpb);
let pb = move |count: u64| -> ProgressBar {
let pb = mpbc.add(ProgressBar::new(count));
pb.set_draw_target(ProgressDrawTarget::to_term(Term::stdout(), None));
pb.set_prefix(&format!("[{}/{}]", idx + 1, migrations_count));
pb.set_draw_target(ProgressDrawTarget::term(Term::stdout(), None));
pb.set_prefix(format!("[{}/{}]", idx + 1, migrations_count));
pb
};
db = m.migrate(db, Arc::new(pb))?;
Expand Down Expand Up @@ -244,13 +244,13 @@ mod tests {
) -> Result<RocksDB, Error> {
let txn = db.transaction();
// append 1u8 to each value of column `0`
let migration = |key: &[u8], value: &[u8]| -> Result<(), Error> {
let mut migration = |key: &[u8], value: &[u8]| -> Result<(), Error> {
let mut new_value = value.to_vec();
new_value.push(1);
txn.put(COLUMN, key, &new_value)?;
Ok(())
};
db.traverse(COLUMN, migration)?;
db.full_traverse(COLUMN, &mut migration)?;
txn.commit()?;
Ok(db)
}
Expand Down
7 changes: 4 additions & 3 deletions db-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Column families alias type
pub type Col = &'static str;
/// Total column number
pub const COLUMNS: u32 = 15;
pub const COLUMNS: u32 = 16;
/// Column store chain index
pub const COLUMN_INDEX: Col = "0";
/// Column store block's header
Expand Down Expand Up @@ -34,9 +34,10 @@ pub const COLUMN_UNCLES: Col = "11";
pub const COLUMN_CELL_DATA: Col = "12";
/// Column store block number-hash pair
pub const COLUMN_NUMBER_HASH: Col = "13";

/// Column store cell data hash
pub const COLUMN_CELL_DATA_HASH: Col = "14";
/// Column store block extension data
pub const COLUMN_BLOCK_EXTENSION: Col = "14";
pub const COLUMN_BLOCK_EXTENSION: Col = "15";

/// META_TIP_HEADER_KEY tracks the latest known best block header
pub const META_TIP_HEADER_KEY: &[u8] = b"TIP_HEADER";
Expand Down
Loading

0 comments on commit 6893a07

Please sign in to comment.