From 0f4d108540cb5ba4dffc62514fb1095497de937b Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 16:51:24 +0000 Subject: [PATCH 1/7] Increase delay between publishing each crate --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6020f810f02..d1e70a7eb13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,7 +184,7 @@ jobs: - name: Publish crate uses: katyo/publish-crates@v1 with: - publish-delay: 30000 + publish-delay: 60000 registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} - name: Notify if Job Fails From 5f62de9a405ba58510adbd9d64fa5cc16eb06e26 Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:28:33 +0000 Subject: [PATCH 2/7] Make new clippy happy --- fuel-benches/benches/set/blockchain.rs | 7 +++---- fuel-block-producer/tests/integration.rs | 2 +- fuel-client/build.rs | 2 +- fuel-core/src/database/vm_database.rs | 6 +++--- fuel-core/src/schema/block.rs | 2 +- fuel-txpool/src/service/test_helpers.rs | 2 +- fuel-txpool/src/txpool.rs | 2 +- fuel-txpool/src/txpool/tests.rs | 7 ++----- xtask/src/commands/dump.rs | 2 +- 9 files changed, 14 insertions(+), 18 deletions(-) diff --git a/fuel-benches/benches/set/blockchain.rs b/fuel-benches/benches/set/blockchain.rs index b9d300c95e1..836fbc1e17e 100644 --- a/fuel-benches/benches/set/blockchain.rs +++ b/fuel-benches/benches/set/blockchain.rs @@ -13,7 +13,7 @@ pub fn run(c: &mut Criterion) { let mut group = c.benchmark_group("blockchain"); - let cases = vec![1, 10, 100, 1_000, 10_000, 100_000, 1_000_000]; + let cases: Vec = vec![1, 10, 100, 1_000, 10_000, 100_000, 1_000_000]; let asset: AssetId = rng.gen(); let contract: ContractId = rng.gen(); @@ -32,8 +32,7 @@ pub fn run(c: &mut Criterion) { let mut asset_inc = AssetId::zeroed(); for i in 0..i { - asset_inc.as_mut()[..8] - .copy_from_slice(&(i as u64).to_be_bytes()); + asset_inc.as_mut()[..8].copy_from_slice(&i.to_be_bytes()); db.merkle_contract_asset_id_balance_insert( &contract, &asset_inc, i, @@ -69,7 +68,7 @@ pub fn run(c: &mut Criterion) { let mut key = Bytes32::zeroed(); for i in 0..i { - key.as_mut()[..8].copy_from_slice(&(i as u64).to_be_bytes()); + key.as_mut()[..8].copy_from_slice(&i.to_be_bytes()); db.merkle_contract_state_insert(&contract, &key, &key)?; } diff --git a/fuel-block-producer/tests/integration.rs b/fuel-block-producer/tests/integration.rs index 1b7be465a45..44f31f9fa20 100644 --- a/fuel-block-producer/tests/integration.rs +++ b/fuel-block-producer/tests/integration.rs @@ -167,7 +167,7 @@ async fn block_producer() -> Result<()> { sender: txpool.sender().clone(), }), executor: Arc::new(MockExecutor(mock_db.clone())), - relayer: Box::new(MockRelayer::default()), + relayer: Box::::default(), lock: Default::default(), dry_run_semaphore: Semaphore::new(1), }; diff --git a/fuel-client/build.rs b/fuel-client/build.rs index 26e88278617..95530f1adff 100644 --- a/fuel-client/build.rs +++ b/fuel-client/build.rs @@ -45,7 +45,7 @@ fn generate_dap_schema() { }) .expect("Failed to fetch schema path"); - File::create(&schema) + File::create(schema) .and_then(|mut f| { f.write_all(contents.as_bytes())?; f.sync_all() diff --git a/fuel-core/src/database/vm_database.rs b/fuel-core/src/database/vm_database.rs index 0cfe35589a5..2d95c4de94b 100644 --- a/fuel-core/src/database/vm_database.rs +++ b/fuel-core/src/database/vm_database.rs @@ -370,7 +370,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - &multi_key, + multi_key, Column::ContractsState, Bytes32::new(*value), ) @@ -445,7 +445,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - &multi_key, + multi_key, Column::ContractsState, Bytes32::new(*value), ) @@ -540,7 +540,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - &multi_key, + multi_key, Column::ContractsState, Bytes32::new(*value), ) diff --git a/fuel-core/src/schema/block.rs b/fuel-core/src/schema/block.rs index 4e546258986..79309d3e410 100644 --- a/fuel-core/src/schema/block.rs +++ b/fuel-core/src/schema/block.rs @@ -409,7 +409,7 @@ fn check_start_after_latest_block(db: &Database, start_time: u64) -> anyhow::Res } let latest_time = db.block_time(current_height.into())?.0; - if latest_time as u64 > start_time { + if latest_time > start_time { return Err(anyhow!( "The start time must be set after the latest block time: {}", latest_time diff --git a/fuel-txpool/src/service/test_helpers.rs b/fuel-txpool/src/service/test_helpers.rs index ea4ea72e7fa..b711ee91f68 100644 --- a/fuel-txpool/src/service/test_helpers.rs +++ b/fuel-txpool/src/service/test_helpers.rs @@ -35,7 +35,7 @@ impl TestContext { pub async fn new() -> Self { let rng = RefCell::new(StdRng::seed_from_u64(0)); let config = Config::default(); - let mock_db = Box::new(MockDb::default()); + let mock_db = Box::::default(); let (block_tx, block_rx) = broadcast::channel(10); let (p2p_request_tx, p2p_request_rx) = mpsc::channel(100); let (gossip_tx, gossip_rx) = broadcast::channel(100); diff --git a/fuel-txpool/src/txpool.rs b/fuel-txpool/src/txpool.rs index 46ad353b332..2326976ebd5 100644 --- a/fuel-txpool/src/txpool.rs +++ b/fuel-txpool/src/txpool.rs @@ -289,7 +289,7 @@ impl TxPool { } } } - let mut list: Vec = seen.into_iter().map(|(_, tx)| tx).collect(); + let mut list: Vec<_> = seen.into_values().collect(); // sort from high to low price list.sort_by_key(|tx| Reverse(tx.price())); diff --git a/fuel-txpool/src/txpool/tests.rs b/fuel-txpool/src/txpool/tests.rs index 0c4ff665b2f..50e9ec0415f 100644 --- a/fuel-txpool/src/txpool/tests.rs +++ b/fuel-txpool/src/txpool/tests.rs @@ -37,10 +37,7 @@ use fuel_core_interfaces::{ Coins, Messages, }, - model::{ - ArcPoolTx, - CoinStatus, - }, + model::CoinStatus, }; use std::{ cmp::Reverse, @@ -767,7 +764,7 @@ async fn find_dependent_tx1_tx2() { .dependency() .find_dependent(tx3_result.inserted, &mut seen, txpool.txs()); - let mut list: Vec = seen.into_iter().map(|(_, tx)| tx).collect(); + let mut list: Vec<_> = seen.into_values().collect(); // sort from high to low price list.sort_by_key(|tx| Reverse(tx.price())); assert_eq!(list.len(), 3, "We should have three items"); diff --git a/xtask/src/commands/dump.rs b/xtask/src/commands/dump.rs index 1759ab487ed..24b8da52068 100644 --- a/xtask/src/commands/dump.rs +++ b/xtask/src/commands/dump.rs @@ -28,7 +28,7 @@ pub fn dump_schema() -> Result<(), Box> { }) .expect("Failed to fetch assets path"); - File::create(&assets) + File::create(assets) .and_then(|mut f| { f.write_all(build_schema().finish().sdl().as_bytes())?; f.sync_all() From 74a5089d717ec8df3ca5aa2be0139553e55eb1fa Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:37:15 +0000 Subject: [PATCH 3/7] Revert "Make new clippy happy" This reverts commit 5f62de9a405ba58510adbd9d64fa5cc16eb06e26. --- fuel-benches/benches/set/blockchain.rs | 7 ++++--- fuel-block-producer/tests/integration.rs | 2 +- fuel-client/build.rs | 2 +- fuel-core/src/database/vm_database.rs | 6 +++--- fuel-core/src/schema/block.rs | 2 +- fuel-txpool/src/service/test_helpers.rs | 2 +- fuel-txpool/src/txpool.rs | 2 +- fuel-txpool/src/txpool/tests.rs | 7 +++++-- xtask/src/commands/dump.rs | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/fuel-benches/benches/set/blockchain.rs b/fuel-benches/benches/set/blockchain.rs index 836fbc1e17e..b9d300c95e1 100644 --- a/fuel-benches/benches/set/blockchain.rs +++ b/fuel-benches/benches/set/blockchain.rs @@ -13,7 +13,7 @@ pub fn run(c: &mut Criterion) { let mut group = c.benchmark_group("blockchain"); - let cases: Vec = vec![1, 10, 100, 1_000, 10_000, 100_000, 1_000_000]; + let cases = vec![1, 10, 100, 1_000, 10_000, 100_000, 1_000_000]; let asset: AssetId = rng.gen(); let contract: ContractId = rng.gen(); @@ -32,7 +32,8 @@ pub fn run(c: &mut Criterion) { let mut asset_inc = AssetId::zeroed(); for i in 0..i { - asset_inc.as_mut()[..8].copy_from_slice(&i.to_be_bytes()); + asset_inc.as_mut()[..8] + .copy_from_slice(&(i as u64).to_be_bytes()); db.merkle_contract_asset_id_balance_insert( &contract, &asset_inc, i, @@ -68,7 +69,7 @@ pub fn run(c: &mut Criterion) { let mut key = Bytes32::zeroed(); for i in 0..i { - key.as_mut()[..8].copy_from_slice(&i.to_be_bytes()); + key.as_mut()[..8].copy_from_slice(&(i as u64).to_be_bytes()); db.merkle_contract_state_insert(&contract, &key, &key)?; } diff --git a/fuel-block-producer/tests/integration.rs b/fuel-block-producer/tests/integration.rs index 44f31f9fa20..1b7be465a45 100644 --- a/fuel-block-producer/tests/integration.rs +++ b/fuel-block-producer/tests/integration.rs @@ -167,7 +167,7 @@ async fn block_producer() -> Result<()> { sender: txpool.sender().clone(), }), executor: Arc::new(MockExecutor(mock_db.clone())), - relayer: Box::::default(), + relayer: Box::new(MockRelayer::default()), lock: Default::default(), dry_run_semaphore: Semaphore::new(1), }; diff --git a/fuel-client/build.rs b/fuel-client/build.rs index 95530f1adff..26e88278617 100644 --- a/fuel-client/build.rs +++ b/fuel-client/build.rs @@ -45,7 +45,7 @@ fn generate_dap_schema() { }) .expect("Failed to fetch schema path"); - File::create(schema) + File::create(&schema) .and_then(|mut f| { f.write_all(contents.as_bytes())?; f.sync_all() diff --git a/fuel-core/src/database/vm_database.rs b/fuel-core/src/database/vm_database.rs index 2d95c4de94b..0cfe35589a5 100644 --- a/fuel-core/src/database/vm_database.rs +++ b/fuel-core/src/database/vm_database.rs @@ -370,7 +370,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - multi_key, + &multi_key, Column::ContractsState, Bytes32::new(*value), ) @@ -445,7 +445,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - multi_key, + &multi_key, Column::ContractsState, Bytes32::new(*value), ) @@ -540,7 +540,7 @@ mod tests { let multi_key = MultiKey::new(&(contract_id.as_ref(), key)); db.database .insert::<_, _, Bytes32>( - multi_key, + &multi_key, Column::ContractsState, Bytes32::new(*value), ) diff --git a/fuel-core/src/schema/block.rs b/fuel-core/src/schema/block.rs index 79309d3e410..4e546258986 100644 --- a/fuel-core/src/schema/block.rs +++ b/fuel-core/src/schema/block.rs @@ -409,7 +409,7 @@ fn check_start_after_latest_block(db: &Database, start_time: u64) -> anyhow::Res } let latest_time = db.block_time(current_height.into())?.0; - if latest_time > start_time { + if latest_time as u64 > start_time { return Err(anyhow!( "The start time must be set after the latest block time: {}", latest_time diff --git a/fuel-txpool/src/service/test_helpers.rs b/fuel-txpool/src/service/test_helpers.rs index b711ee91f68..ea4ea72e7fa 100644 --- a/fuel-txpool/src/service/test_helpers.rs +++ b/fuel-txpool/src/service/test_helpers.rs @@ -35,7 +35,7 @@ impl TestContext { pub async fn new() -> Self { let rng = RefCell::new(StdRng::seed_from_u64(0)); let config = Config::default(); - let mock_db = Box::::default(); + let mock_db = Box::new(MockDb::default()); let (block_tx, block_rx) = broadcast::channel(10); let (p2p_request_tx, p2p_request_rx) = mpsc::channel(100); let (gossip_tx, gossip_rx) = broadcast::channel(100); diff --git a/fuel-txpool/src/txpool.rs b/fuel-txpool/src/txpool.rs index 2326976ebd5..46ad353b332 100644 --- a/fuel-txpool/src/txpool.rs +++ b/fuel-txpool/src/txpool.rs @@ -289,7 +289,7 @@ impl TxPool { } } } - let mut list: Vec<_> = seen.into_values().collect(); + let mut list: Vec = seen.into_iter().map(|(_, tx)| tx).collect(); // sort from high to low price list.sort_by_key(|tx| Reverse(tx.price())); diff --git a/fuel-txpool/src/txpool/tests.rs b/fuel-txpool/src/txpool/tests.rs index 50e9ec0415f..0c4ff665b2f 100644 --- a/fuel-txpool/src/txpool/tests.rs +++ b/fuel-txpool/src/txpool/tests.rs @@ -37,7 +37,10 @@ use fuel_core_interfaces::{ Coins, Messages, }, - model::CoinStatus, + model::{ + ArcPoolTx, + CoinStatus, + }, }; use std::{ cmp::Reverse, @@ -764,7 +767,7 @@ async fn find_dependent_tx1_tx2() { .dependency() .find_dependent(tx3_result.inserted, &mut seen, txpool.txs()); - let mut list: Vec<_> = seen.into_values().collect(); + let mut list: Vec = seen.into_iter().map(|(_, tx)| tx).collect(); // sort from high to low price list.sort_by_key(|tx| Reverse(tx.price())); assert_eq!(list.len(), 3, "We should have three items"); diff --git a/xtask/src/commands/dump.rs b/xtask/src/commands/dump.rs index 24b8da52068..1759ab487ed 100644 --- a/xtask/src/commands/dump.rs +++ b/xtask/src/commands/dump.rs @@ -28,7 +28,7 @@ pub fn dump_schema() -> Result<(), Box> { }) .expect("Failed to fetch assets path"); - File::create(assets) + File::create(&assets) .and_then(|mut f| { f.write_all(build_schema().finish().sdl().as_bytes())?; f.sync_all() From 63c51985d7d33b0fba659ac2e2f77d6ff6b4d431 Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:37:33 +0000 Subject: [PATCH 4/7] Pinned toolchain version --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1e70a7eb13..29e9b3f8256 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ concurrency: env: CARGO_TERM_COLOR: always + RUST_VERSION: 1.65.0 RUSTFLAGS: -D warnings REGISTRY: ghcr.io @@ -26,7 +27,7 @@ jobs: - name: Install latest nightly uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-${{ env.RUST_VERSION }} override: true components: rustfmt @@ -39,7 +40,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: stable-${{ env.RUST_VERSION }} - name: Install Cargo.toml linter uses: baptiste0928/cargo-install@v1 with: @@ -107,7 +108,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: stable-${{ env.RUST_VERSION }} - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 with: @@ -152,7 +153,7 @@ jobs: - name: Install toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: stable-${{ env.RUST_VERSION }} override: true - name: Install Protoc @@ -314,7 +315,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: stable-1.65 target: ${{ matrix.job.target }} override: true From 2a76163be8022f11f9a5c04bc9b245a5d3a651d9 Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:50:01 +0000 Subject: [PATCH 5/7] Fixed pinning for nightly --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29e9b3f8256..065b6e76521 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ concurrency: env: CARGO_TERM_COLOR: always RUST_VERSION: 1.65.0 + NIGHTLY_RUST_VERSION: nightly-2022-12-14 RUSTFLAGS: -D warnings REGISTRY: ghcr.io @@ -27,7 +28,7 @@ jobs: - name: Install latest nightly uses: actions-rs/toolchain@v1 with: - toolchain: nightly-${{ env.RUST_VERSION }} + toolchain: ${{ env.NIGHTLY_RUST_VERSION }} override: true components: rustfmt @@ -40,7 +41,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: stable-${{ env.RUST_VERSION }} + toolchain: ${{ env.RUST_VERSION }} + override: true - name: Install Cargo.toml linter uses: baptiste0928/cargo-install@v1 with: @@ -108,7 +110,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: stable-${{ env.RUST_VERSION }} + toolchain: ${{ env.RUST_VERSION }} + override: true - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 with: @@ -153,7 +156,7 @@ jobs: - name: Install toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable-${{ env.RUST_VERSION }} + toolchain: ${{ env.RUST_VERSION }} override: true - name: Install Protoc @@ -315,7 +318,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable-1.65 + toolchain: ${{ env.RUST_VERSION }} target: ${{ matrix.job.target }} override: true From 76c18f83f3d4b3c265643053138c463db87572ca Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:51:56 +0000 Subject: [PATCH 6/7] Fixed pinning for nightly --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 065b6e76521..17db0441571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: components: rustfmt - name: Rustfmt check - run: cargo +nightly fmt --all -- --check + run: cargo +${{ env.NIGHTLY_RUST_VERSION }} fmt --all -- --check lint-toml-files: runs-on: ubuntu-latest From 4210d78242d56d27fb0f5bcbd9bfa4bb2d52c856 Mon Sep 17 00:00:00 2001 From: green Date: Thu, 15 Dec 2022 17:55:11 +0000 Subject: [PATCH 7/7] Add clippy for specific version --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17db0441571..f785d2e8e73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,6 +112,7 @@ jobs: with: toolchain: ${{ env.RUST_VERSION }} override: true + components: clippy - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 with: