Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: 'Run Rust tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
Expand All @@ -28,13 +28,13 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: cargo test --locked --verbose --all
run: cargo test --release --locked --verbose --all

integration:
name: 'Run integration tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
name: 'Run lints'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
Expand All @@ -85,10 +85,10 @@ jobs:
if taplo --version &> /dev/null; then
echo "taplo-cli is already installed"
else
cargo install taplo-cli
cargo install taplo-cli --locked
fi
taplo fmt --check
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all --features runtime-benchmarks,try-runtime -- -D warnings
run: cargo clippy --release --all --tests --features runtime-benchmarks,try-runtime -- -D warnings
2 changes: 0 additions & 2 deletions Cargo.lock

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

49 changes: 26 additions & 23 deletions client/cli/src/frontier_db_cmd/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn schema_create_fails_if_value_is_not_empty() {

let data_before = vec![(EthereumStorageSchema::V2, H256::default())];

let _ = backend
backend
.meta()
.write_ethereum_schema(data_before.clone())
.expect("data inserted in temporary db");
Expand Down Expand Up @@ -196,9 +196,9 @@ fn schema_read_works() {

let data = vec![(EthereumStorageSchema::V2, H256::default())];

let _ = backend
backend
.meta()
.write_ethereum_schema(data.clone())
.write_ethereum_schema(data)
.expect("data inserted in temporary db");

// Run the command
Expand All @@ -208,7 +208,7 @@ fn schema_read_works() {
Operation::Read,
Column::Meta
)
.run(client, backend.clone())
.run(client, backend)
.is_ok());
}

Expand Down Expand Up @@ -253,9 +253,9 @@ fn schema_delete_works() {

let data = vec![(EthereumStorageSchema::V2, H256::default())];

let _ = backend
backend
.meta()
.write_ethereum_schema(data.clone())
.write_ethereum_schema(data)
.expect("data inserted in temporary db");
// Run the command
assert!(cmd(
Expand Down Expand Up @@ -313,7 +313,7 @@ fn tips_create_fails_if_value_is_not_empty() {

let data_before = vec![H256::default()];

let _ = backend
backend
.meta()
.write_current_syncing_tips(data_before.clone())
.expect("data inserted in temporary db");
Expand Down Expand Up @@ -345,9 +345,9 @@ fn tips_read_works() {

let data = vec![H256::default()];

let _ = backend
backend
.meta()
.write_current_syncing_tips(data.clone())
.write_current_syncing_tips(data)
.expect("data inserted in temporary db");
// Run the command
assert!(cmd(
Expand All @@ -356,7 +356,7 @@ fn tips_read_works() {
Operation::Read,
Column::Meta
)
.run(client, backend.clone())
.run(client, backend)
.is_ok());
}

Expand Down Expand Up @@ -401,9 +401,9 @@ fn tips_delete_works() {

let data = vec![H256::default()];

let _ = backend
backend
.meta()
.write_current_syncing_tips(data.clone())
.write_current_syncing_tips(data)
.expect("data inserted in temporary db");
// Run the command
assert!(cmd(
Expand Down Expand Up @@ -433,9 +433,9 @@ fn non_existent_meta_static_keys_are_no_op() {

let data = vec![(EthereumStorageSchema::V1, H256::default())];

let _ = backend
backend
.meta()
.write_ethereum_schema(data.clone())
.write_ethereum_schema(data)
.expect("data inserted in temporary db");

// Run the Create command
Expand Down Expand Up @@ -596,7 +596,7 @@ fn commitment_create() {
Operation::Create,
Column::Block
)
.run(Arc::clone(&client), backend.clone())
.run(Arc::clone(&client), backend)
.is_err());
}

Expand All @@ -611,10 +611,13 @@ fn commitment_update() {

// Get some transaction status.
let t1 = fp_rpc::TransactionStatus::default();
let mut t2 = fp_rpc::TransactionStatus::default();
t2.transaction_hash =
H256::from_str("0x2200000000000000000000000000000000000000000000000000000000000000")
.unwrap();
let t2 = fp_rpc::TransactionStatus {
transaction_hash: H256::from_str(
"0x2200000000000000000000000000000000000000000000000000000000000000",
)
.unwrap(),
..Default::default()
};
let t1_hash = t1.transaction_hash;
let t2_hash = t2.transaction_hash;
let statuses_a1 = vec![t1.clone()];
Expand Down Expand Up @@ -646,7 +649,7 @@ fn commitment_update() {
let ethereum_block_hash = H256::default();
assert!(cmd(
format!("{:?}", ethereum_block_hash),
Some(test_value_path.clone()),
Some(test_value_path),
Operation::Create,
Column::Block
)
Expand Down Expand Up @@ -692,7 +695,7 @@ fn commitment_update() {
let ethereum_block_hash = H256::default();
assert!(cmd(
format!("{:?}", ethereum_block_hash),
Some(test_value_path.clone()),
Some(test_value_path),
Operation::Update,
Column::Block
)
Expand Down Expand Up @@ -764,7 +767,7 @@ fn mapping_read_works() {
let ethereum_block_hash = H256::default();
assert!(cmd(
format!("{:?}", ethereum_block_hash),
Some(test_value_path.clone()),
Some(test_value_path),
Operation::Create,
Column::Block,
)
Expand All @@ -788,6 +791,6 @@ fn mapping_read_works() {
Operation::Read,
Column::Transaction
)
.run(Arc::clone(&client), backend.clone())
.run(Arc::clone(&client), backend)
.is_ok());
}
10 changes: 5 additions & 5 deletions client/db/src/kv/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ mod tests {
}

// Writes version 1 to file.
let _ = std::fs::create_dir_all(&path).expect("db path created");
std::fs::create_dir_all(path).expect("db path created");
let mut version_path = path.to_owned();
version_path.push("db_version");
let mut version_file =
Expand All @@ -469,7 +469,7 @@ mod tests {
.expect("write version 1");

// Upgrade database from version 1 to 2
let _ = super::upgrade_db::<OpaqueBlock, _>(client.clone(), &path, &setting.source);
let _ = super::upgrade_db::<OpaqueBlock, _>(client.clone(), path, &setting.source);

// Check data after migration
let backend = open_frontier_backend::<OpaqueBlock, _>(client, &setting)
Expand All @@ -496,7 +496,7 @@ mod tests {
}

// Upgrade db version file
assert_eq!(super::current_version(&path).expect("version"), 2u32);
assert_eq!(super::current_version(path).expect("version"), 2u32);
}
}

Expand All @@ -518,10 +518,10 @@ mod tests {
},
};
let path = setting.source.path().unwrap();
let _ = super::upgrade_db::<OpaqueBlock, _>(client.clone(), &path, &setting.source);
let _ = super::upgrade_db::<OpaqueBlock, _>(client, path, &setting.source);

let mut file =
std::fs::File::open(crate::kv::upgrade::version_file_path(&path)).expect("file exist");
std::fs::File::open(crate::kv::upgrade::version_file_path(path)).expect("file exist");

let mut s = String::new();
file.read_to_string(&mut s).expect("read file contents");
Expand Down
25 changes: 12 additions & 13 deletions client/mapping-sync/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ mod test {
let block_hash = block.header.hash();
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
logs.push((
block_number as i32,
block_number,
fc_db::sql::Log {
address: address_1.as_bytes().to_owned(),
topic_1: Some(topics_1_1.as_bytes().to_owned()),
Expand All @@ -653,7 +653,7 @@ mod test {
},
));
logs.push((
block_number as i32,
block_number,
fc_db::sql::Log {
address: address_2.as_bytes().to_owned(),
topic_1: Some(topics_2_1.as_bytes().to_owned()),
Expand Down Expand Up @@ -876,7 +876,7 @@ mod test {
let block_hash = block.header.hash();
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
logs.push((
block_number as i32,
block_number,
fc_db::sql::Log {
address: address_1.as_bytes().to_owned(),
topic_1: Some(topics_1_1.as_bytes().to_owned()),
Expand All @@ -889,7 +889,7 @@ mod test {
},
));
logs.push((
block_number as i32,
block_number,
fc_db::sql::Log {
address: address_2.as_bytes().to_owned(),
topic_1: Some(topics_2_1.as_bytes().to_owned()),
Expand Down Expand Up @@ -1112,13 +1112,12 @@ mod test {
let canon = res
.clone()
.into_iter()
.filter_map(|it| if it.1 == 1 { Some(it) } else { None })
.filter(|&it| it.1 == 1)
.collect::<Vec<(H256, i32, i32)>>();
assert_eq!(canon.len(), 18);

// and 2 of which are the originally tracked as orphaned
let not_canon = res
.clone()
.into_iter()
.filter_map(|it| if it.1 == 0 { Some(it.0) } else { None })
.collect::<Vec<H256>>();
Expand Down Expand Up @@ -1188,7 +1187,7 @@ mod test {
let block = builder.build().unwrap().block;
let block_hash = block.header.hash();
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
best_block_hashes.insert(0, block_hash.clone());
best_block_hashes.insert(0, block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1366,7 +1365,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1472,7 +1471,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1589,7 +1588,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1695,7 +1694,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1812,7 +1811,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::NetworkInitialSync, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down Expand Up @@ -1918,7 +1917,7 @@ mod test {
let block_hash = block.header.hash();

executor::block_on(client.import(BlockOrigin::NetworkInitialSync, block)).unwrap();
best_block_hashes.push(block_hash.clone());
best_block_hashes.push(block_hash);
parent_hash = block_hash;
}

Expand Down
Loading