Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
More testing and fuzzing and docs for pools (#12624)
Browse files Browse the repository at this point in the history
* move pools fuzzing to hongfuzz

* merge more small fixes

* fix all tests

* Update frame/nomination-pools/fuzzer/src/call.rs

Co-authored-by: Gonçalo Pestana <[email protected]>

* remove transactional

* fmt

* fix CI

* fmt

* fix build again

* fix CI

Co-authored-by: Gonçalo Pestana <[email protected]>
  • Loading branch information
kianenigma and gpestana authored Nov 10, 2022
1 parent abb217d commit 78f8f70
Show file tree
Hide file tree
Showing 9 changed files with 562 additions and 436 deletions.
33 changes: 19 additions & 14 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ members = [
"frame/preimage",
"frame/proxy",
"frame/nomination-pools",
"frame/nomination-pools/fuzzer",
"frame/nomination-pools/benchmarking",
"frame/nomination-pools/test-staking",
"frame/nomination-pools/runtime-api",
Expand Down
2 changes: 1 addition & 1 deletion frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ pub mod pallet {
VestingBalance,
/// Account liquidity restrictions prevent withdrawal
LiquidityRestrictions,
/// Balance too low to send value
/// Balance too low to send value.
InsufficientBalance,
/// Value too low to create account due to existential deposit
ExistentialDeposit,
Expand Down
7 changes: 5 additions & 2 deletions frame/nomination-pools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ sp-core = { version = "6.0.0", default-features = false, path = "../../primitive
sp-io = { version = "6.0.0", default-features = false, path = "../../primitives/io" }
log = { version = "0.4.0", default-features = false }

# Optional: usef for testing and/or fuzzing
pallet-balances = { version = "4.0.0-dev", path = "../balances", optional = true }
sp-tracing = { version = "5.0.0", path = "../../primitives/tracing", optional = true }

[dev-dependencies]
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }
rand = { version = "0.8.5", features = ["small_rng"] }

[features]
default = ["std"]
fuzzing = ["pallet-balances", "sp-tracing"]
std = [
"codec/std",
"scale-info/std",
Expand All @@ -51,4 +55,3 @@ runtime-benchmarks = [
try-runtime = [
"frame-support/try-runtime"
]
fuzz-test = []
33 changes: 33 additions & 0 deletions frame/nomination-pools/fuzzer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "pallet-nomination-pools-fuzzer"
version = "2.0.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "Fuzzer for fixed point arithmetic primitives."
documentation = "https://docs.rs/sp-arithmetic-fuzzer"
publish = false

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

[dependencies]
honggfuzz = "0.5.54"

pallet-nomination-pools = { path = "..", features = ["fuzzing"] }

frame-system = { path = "../../system" }
frame-support = { path = "../../support" }

sp-runtime = { path = "../../../primitives/runtime" }
sp-io = { path = "../../../primitives/io" }
sp-tracing = { path = "../../../primitives/tracing" }

rand = { version = "0.8.5", features = ["small_rng"] }
log = "0.4.17"

[[bin]]
name = "call"
path = "src/call.rs"
Loading

0 comments on commit 78f8f70

Please sign in to comment.