Skip to content

Commit

Permalink
chore: deny unused crate dependencies (polkadot-evm#1020)
Browse files Browse the repository at this point in the history
* chore: deny unused crate dependencies

* fix

* apply review suggtions

* fix error
  • Loading branch information
koushiro authored Mar 16, 2023
1 parent 8a5492f commit 0b04dd3
Show file tree
Hide file tree
Showing 41 changed files with 62 additions and 21 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![deny(unused_crate_dependencies)]

mod frontier_db_cmd;

pub use self::frontier_db_cmd::FrontierDbCmd;
2 changes: 2 additions & 0 deletions client/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![deny(unused_crate_dependencies)]

use std::{collections::HashMap, marker::PhantomData, sync::Arc};

// Substrate
Expand Down
2 changes: 2 additions & 0 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![deny(unused_crate_dependencies)]

#[cfg(feature = "parity-db")]
mod parity_db_adapter;
mod upgrade;
Expand Down
1 change: 1 addition & 0 deletions client/mapping-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![allow(clippy::too_many_arguments)]
#![deny(unused_crate_dependencies)]

mod worker;

Expand Down
2 changes: 2 additions & 0 deletions client/rpc-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![deny(unused_crate_dependencies)]

pub mod types;

mod eth;
Expand Down
1 change: 1 addition & 0 deletions client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
clippy::len_zero,
clippy::new_without_default
)]
#![deny(unused_crate_dependencies)]

mod eth;
mod eth_pubsub;
Expand Down
2 changes: 2 additions & 0 deletions client/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![deny(unused_crate_dependencies)]

mod overrides;
pub use self::overrides::*;

Expand Down
2 changes: 1 addition & 1 deletion frame/base-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fp-evm = { workspace = true }

[dev-dependencies]
# Substrate
sp-io = { workspace = true }
sp-io = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand Down
1 change: 1 addition & 0 deletions frame/base-fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::comparison_chain)]
#![deny(unused_crate_dependencies)]

#[cfg(test)]
mod tests;
Expand Down
7 changes: 3 additions & 4 deletions frame/dynamic-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-inherents = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# Frontier
fp-dynamic-fee = { workspace = true }
fp-evm = { workspace = true }

[dev-dependencies]
# Substrate
pallet-timestamp = { workspace = true }
sp-io = { workspace = true }
pallet-timestamp = { workspace = true, features = ["default"] }
sp-io = { workspace = true, features = ["default"] }
sp-runtime = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand All @@ -37,7 +37,6 @@ std = [
# Substrate
"sp-core/std",
"sp-inherents/std",
"sp-runtime/std",
"sp-std/std",
# Substrate
"frame-system/std",
Expand Down
1 change: 1 addition & 0 deletions frame/dynamic-fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

#[cfg(test)]
mod tests;
Expand Down
7 changes: 4 additions & 3 deletions frame/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"]
ethereum = { workspace = true, features = ["with-codec"] }
ethereum-types = { workspace = true }
evm = { workspace = true, features = ["with-codec"] }
rlp = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-info = { workspace = true }

Expand All @@ -31,16 +30,18 @@ fp-consensus = { workspace = true }
fp-ethereum = { workspace = true }
fp-evm = { workspace = true }
fp-rpc = { workspace = true }
fp-self-contained = { workspace = true }
fp-storage = { workspace = true }
pallet-evm = { workspace = true }

[dev-dependencies]
hex = "0.4.3"
libsecp256k1 = { workspace = true, features = ["static-context", "hmac"] }
rlp = { workspace = true }
# Substrate
pallet-balances = { workspace = true, features = ["default"] }
sp-core = { workspace = true }
sp-core = { workspace = true, features = ["default"] }
# Frontier
fp-self-contained = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand Down
4 changes: 3 additions & 1 deletion frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::comparison_chain, clippy::large_enum_variant)]
#![deny(unused_crate_dependencies)]

#[cfg(all(feature = "std", test))]
mod mock;
Expand Down Expand Up @@ -64,7 +65,8 @@ pub use ethereum::{
};
pub use fp_rpc::TransactionStatus;

#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)]
#[derive(Clone, Eq, PartialEq, RuntimeDebug)]
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)]
pub enum RawOrigin {
EthereumTransaction(H160),
}
Expand Down
1 change: 1 addition & 0 deletions frame/evm-chain-id/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

pub use pallet::*;

Expand Down
2 changes: 1 addition & 1 deletion frame/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fp-evm = { workspace = true }
[dev-dependencies]
# Substrate
pallet-balances = { workspace = true, features = ["default"] }
pallet-evm-precompile-simple = { workspace = true }
pallet-evm-precompile-simple = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/bn128/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/curve25519/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;
use alloc::vec::Vec;
Expand Down
14 changes: 7 additions & 7 deletions frame/evm/precompile/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pallet-evm = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-info = { workspace = true }
# Substrate
frame-system = { workspace = true }
frame-system = { workspace = true, features = ["default"] }
pallet-balances = { workspace = true, features = ["default"] }
pallet-timestamp = { workspace = true }
pallet-utility = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
pallet-timestamp = { workspace = true, features = ["default"] }
pallet-utility = { workspace = true, features = ["default"] }
sp-core = { workspace = true, features = ["default"] }
sp-io = { workspace = true, features = ["default"] }
sp-runtime = { workspace = true, features = ["default"] }
sp-std = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/ed25519/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/modexp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::comparison_chain)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/sha3fips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions frame/evm/precompile/simple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

extern crate alloc;

Expand Down
3 changes: 2 additions & 1 deletion frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![cfg_attr(test, feature(assert_matches))]
#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))]
#![allow(clippy::too_many_arguments)]

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/test-vector-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ hex = "0.4.3"
serde = { workspace = true }
serde_json = { workspace = true }
# Substrate
sp-core = { workspace = true }
sp-core = { workspace = true, features = ["default"] }
# Frontier
fp-evm = { workspace = true, features = ["default"] }
2 changes: 2 additions & 0 deletions frame/evm/test-vector-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![deny(unused_crate_dependencies)]

use std::fs;

use evm::{Context, ExitError, ExitReason, ExitSucceed, Transfer};
Expand Down
2 changes: 1 addition & 1 deletion frame/hotfix-sufficients/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pallet-evm = { workspace = true }

[dev-dependencies]
# Substrate
sp-io = { workspace = true }
sp-io = { workspace = true, features = ["default"] }

[features]
default = ["std"]
Expand Down
1 change: 1 addition & 0 deletions frame/hotfix-sufficients/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))]

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
Expand Down
1 change: 1 addition & 0 deletions primitives/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::large_enum_variant)]
#![deny(unused_crate_dependencies)]

use scale_codec::{Decode, Encode};
use sp_core::H256;
Expand Down
3 changes: 2 additions & 1 deletion primitives/dynamic-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
async-trait = "0.1"
async-trait = { version = "0.1", optional = true }
# Substrate
sp-core = { workspace = true }
sp-inherents = { workspace = true }

[features]
default = ["std"]
std = [
"async-trait",
# Substrate
"sp-core/std",
"sp-inherents/std",
Expand Down
1 change: 1 addition & 0 deletions primitives/dynamic-fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//! Core types and inherents for dynamic fee.
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

use sp_core::U256;
use sp_inherents::InherentIdentifier;
Expand Down
1 change: 1 addition & 0 deletions primitives/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

pub use ethereum::{
AccessListItem, BlockV2 as Block, LegacyTransactionMessage, Log, ReceiptV3 as Receipt,
Expand Down
1 change: 1 addition & 0 deletions primitives/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

mod precompile;
mod validation;
Expand Down
1 change: 1 addition & 0 deletions primitives/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![deny(unused_crate_dependencies)]

use ethereum::Log;
use ethereum_types::Bloom;
Expand Down
1 change: 1 addition & 0 deletions primitives/self-contained/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

mod checked_extrinsic;
mod unchecked_extrinsic;
Expand Down
1 change: 1 addition & 0 deletions primitives/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unused_crate_dependencies)]

use scale_codec::{Decode, Encode};

Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
hard_tabs = true
imports_granularity = "Crate"
use_field_init_shorthand = true
merge_derives = false
Loading

0 comments on commit 0b04dd3

Please sign in to comment.