Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MAD Precompile fuzzing #858

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 19 additions & 0 deletions Cargo.lock

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

67 changes: 34 additions & 33 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,40 @@ exclude = ["examples"]

[workspace]
members = [
"primitives",
"primitives/crypto",
"primitives/rpc/*",
"primitives/ext",
"client/evm-tracing",
"client/rpc/*",
"client/rpc-core/*",
"node",
"runtime/testnet",
"runtime/mainnet",
"pallets/*",
"pallets/services/rpc",
"pallets/services/rpc/runtime-api",
"pallets/tangle-lst/benchmarking",
"pallets/multi-asset-delegation/fuzzer",
"precompiles/pallet-democracy",
"precompiles/batch",
"precompiles/call-permit",
"precompiles/proxy",
"precompiles/preimage",
"precompiles/balances-erc20",
"precompiles/assets-erc20",
"precompiles/verify-ecdsa-secp256k1-signature",
"precompiles/verify-ecdsa-secp256r1-signature",
"precompiles/verify-ecdsa-stark-signature",
"precompiles/verify-schnorr-signatures",
"precompiles/verify-bls381-signature",
"precompiles/multi-asset-delegation",
"precompiles/services",
"precompiles/tangle-lst",
"precompiles/assets",
"tangle-subxt",
"evm-tracer",
"primitives",
shekohex marked this conversation as resolved.
Show resolved Hide resolved
"primitives/crypto",
"primitives/rpc/*",
"primitives/ext",
"client/evm-tracing",
"client/rpc/*",
"client/rpc-core/*",
"node",
"runtime/testnet",
"runtime/mainnet",
"pallets/*",
"pallets/services/rpc",
"pallets/services/rpc/runtime-api",
"pallets/tangle-lst/benchmarking",
"pallets/multi-asset-delegation/fuzzer",
"precompiles/pallet-democracy",
"precompiles/batch",
"precompiles/call-permit",
"precompiles/proxy",
"precompiles/preimage",
"precompiles/balances-erc20",
"precompiles/assets-erc20",
"precompiles/verify-ecdsa-secp256k1-signature",
"precompiles/verify-ecdsa-secp256r1-signature",
"precompiles/verify-ecdsa-stark-signature",
"precompiles/verify-schnorr-signatures",
"precompiles/verify-bls381-signature",
"precompiles/multi-asset-delegation",
"precompiles/multi-asset-delegation/fuzzer",
"precompiles/services",
"precompiles/tangle-lst",
"precompiles/assets",
"tangle-subxt",
"evm-tracer",
]
resolver = "2"

Expand Down
186 changes: 132 additions & 54 deletions precompiles/multi-asset-delegation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ edition = "2021"
description = "A Precompile to make pallet-multi-asset-delegation calls encoding accessible to pallet-evm"

[dependencies]


precompile-utils = { workspace = true }

# Substrate
Expand All @@ -26,6 +24,46 @@ pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] }

tangle-primitives = { workspace = true }

derive_more = { workspace = true, features = ["full"], optional = true }
hex-literal = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
sha3 = { workspace = true, optional = true }
ethereum = { workspace = true, features = ["with-codec"], optional = true }
ethers = { version = "2.0", optional = true }
hex = { workspace = true, optional = true }
num_enum = { workspace = true, optional = true }
libsecp256k1 = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
smallvec = { workspace = true, optional = true }
sp-keystore = { workspace = true, optional = true }
pallet-assets = { workspace = true, features = ["std"], optional = true }
pallet-timestamp = { workspace = true, features = ["std"], optional = true }
scale-info = { workspace = true, features = ["derive", "std"], optional = true }
sp-io = { workspace = true, features = ["std"], optional = true }
fp-account = { workspace = true, optional = true }
fp-consensus = { workspace = true, optional = true }
fp-dynamic-fee = { workspace = true, optional = true }
fp-ethereum = { workspace = true, optional = true }
fp-rpc = { workspace = true, optional = true }
fp-self-contained = { workspace = true, optional = true }
fp-storage = { workspace = true, optional = true }
pallet-base-fee = { workspace = true, optional = true }
pallet-dynamic-fee = { workspace = true, optional = true }
pallet-ethereum = { workspace = true, optional = true }
pallet-evm-chain-id = { workspace = true, optional = true }
pallet-evm-precompile-blake2 = { workspace = true, optional = true }
pallet-evm-precompile-bn128 = { workspace = true, optional = true }
pallet-evm-precompile-curve25519 = { workspace = true, optional = true }
pallet-evm-precompile-ed25519 = { workspace = true, optional = true }
pallet-evm-precompile-modexp = { workspace = true, optional = true }
pallet-evm-precompile-sha3fips = { workspace = true, optional = true }
pallet-evm-precompile-simple = { workspace = true, optional = true }
pallet-session = { workspace = true, optional = true }
pallet-staking = { workspace = true, optional = true }
sp-staking = { workspace = true, optional = true }
frame-election-provider-support = { workspace = true, optional = true }
ethabi = { workspace = true, optional = true }

[dev-dependencies]
derive_more = { workspace = true, features = ["full"] }
hex-literal = { workspace = true }
Expand Down Expand Up @@ -83,56 +121,96 @@ ethabi = { workspace = true }

[features]
default = ["std"]
fuzzing = [
"derive_more",
shekohex marked this conversation as resolved.
Show resolved Hide resolved
"hex-literal",
"serde",
"sha3",
"ethereum",
"ethers",
"hex",
"num_enum",
"libsecp256k1",
"serde_json",
"smallvec",
"sp-keystore",
"pallet-assets",
"pallet-timestamp",
"scale-info",
"sp-io",
"fp-account",
"fp-consensus",
"fp-dynamic-fee",
"fp-ethereum",
"fp-rpc",
"fp-self-contained",
"fp-storage",
"pallet-base-fee",
"pallet-dynamic-fee",
"pallet-ethereum",
"pallet-evm-chain-id",
"pallet-evm-precompile-blake2",
"pallet-evm-precompile-bn128",
"pallet-evm-precompile-curve25519",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
"pallet-evm-precompile-sha3fips",
"pallet-evm-precompile-simple",
"pallet-session",
"pallet-staking",
"sp-staking",
"frame-election-provider-support",
"ethabi",
]
std = [
"fp-evm/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"pallet-evm/std",
"pallet-multi-asset-delegation/std",
"parity-scale-codec/std",
"precompile-utils/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"tangle-primitives/std",
"pallet-assets/std",
"hex/std",
"scale-info/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-std/std",
"sp-io/std",
"tangle-primitives/std",
"pallet-balances/std",
"pallet-timestamp/std",
"fp-account/std",
"fp-consensus/std",
"fp-dynamic-fee/std",
"fp-ethereum/std",
"fp-evm/std",
"fp-rpc/std",
"fp-self-contained/std",
"fp-storage/std",
"pallet-base-fee/std",
"pallet-dynamic-fee/std",
"pallet-ethereum/std",
"pallet-evm/std",
"pallet-evm-chain-id/std",

"pallet-evm-precompile-modexp/std",
"pallet-evm-precompile-sha3fips/std",
"pallet-evm-precompile-simple/std",
"pallet-evm-precompile-blake2/std",
"pallet-evm-precompile-bn128/std",
"pallet-evm-precompile-curve25519/std",
"pallet-evm-precompile-ed25519/std",
"precompile-utils/std",
"serde/std",
"pallet-session/std",
"pallet-staking/std",
"sp-staking/std",
"frame-election-provider-support/std",
]
"fp-evm/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"pallet-evm/std",
"pallet-multi-asset-delegation/std",
"parity-scale-codec/std",
"precompile-utils/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"tangle-primitives/std",
"pallet-assets/std",
"hex/std",
"scale-info/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-std/std",
"sp-io/std",
"tangle-primitives/std",
"pallet-balances/std",
"pallet-timestamp/std",
"fp-account/std",
"fp-consensus/std",
"fp-dynamic-fee/std",
"fp-ethereum/std",
"fp-evm/std",
"fp-rpc/std",
"fp-self-contained/std",
"fp-storage/std",
"pallet-base-fee/std",
"pallet-dynamic-fee/std",
"pallet-ethereum/std",
"pallet-evm/std",
"pallet-evm-chain-id/std",
"pallet-evm-precompile-modexp/std",
"pallet-evm-precompile-sha3fips/std",
"pallet-evm-precompile-simple/std",
"pallet-evm-precompile-blake2/std",
"pallet-evm-precompile-bn128/std",
"pallet-evm-precompile-curve25519/std",
"pallet-evm-precompile-ed25519/std",
"precompile-utils/std",
"serde/std",
"pallet-session/std",
"pallet-staking/std",
"sp-staking/std",
"frame-election-provider-support/std",
]
38 changes: 38 additions & 0 deletions precompiles/multi-asset-delegation/fuzzer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "pallet-evm-precompile-multi-asset-delegation-fuzzer"
version = "2.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "Fuzzer for pallet-multi-asset-delegation precompile"
publish = false

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
honggfuzz = { workspace = true }


pallet-multi-asset-delegation = { workspace = true, features = ["fuzzing"], default-features = true }
pallet-evm-precompile-multi-asset-delegation = { features = ["fuzzing"], workspace = true, default-features = true }

frame-system = { workspace = true, default-features = true }
frame-support = { workspace = true, default-features = true }

fp-evm = { workspace = true }
precompile-utils = { workspace = true, features = ["std", "testing"] }
pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] }

sp-runtime = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
sp-tracing = { workspace = true, default-features = true }

rand = { features = ["small_rng"], workspace = true, default-features = true }
log = { workspace = true, default-features = true }

[[bin]]
name = "mad-precompile-fuzzer"
path = "call.rs"
Loading
Loading