Skip to content
Draft
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
189 changes: 134 additions & 55 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"runtime-modules/common",
"runtime-modules/content-working-group",
"runtime-modules/forum",
"runtime-modules/forum/fuzzer",
"runtime-modules/governance",
"runtime-modules/hiring",
"runtime-modules/membership",
Expand Down
4 changes: 0 additions & 4 deletions node/src/forum_config/from_serialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ pub fn create() -> ForumConfig {
// TODO: get rid of mocks and setup valid values
category_by_moderator: Vec::new(),
reaction_by_post: Vec::new(),
poll_desc_constraint: new_validation(10, 90),
poll_items_constraint: new_validation(1, 10),
user_name_constraint: new_validation(10, 90),
user_self_introduction_constraint: new_validation(10, 90),
post_footer_constraint: new_validation(10, 90),
data_migration_done: true,
}
}
14 changes: 13 additions & 1 deletion runtime-modules/forum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ system = { package = 'srml-system', default-features = false, git = 'https://git
balances = { package = 'srml-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'}
codec = { package = 'parity-scale-codec', version = '1.0.0', default-features = false, features = ['derive'] }

arbitrary = { version = "0.3.0", optional = true, features = ["derive"] }

[dependencies.substrate-forum-module-reflection]
path = "./reflection"

[dependencies.timestamp]
default_features = false
git = 'https://github.com/paritytech/substrate.git'
Expand All @@ -28,6 +33,12 @@ git = 'https://github.com/paritytech/substrate.git'
package = 'sr-io'
rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'

[dependencies.primitives]
package = 'substrate-primitives'
git = 'https://github.com/paritytech/substrate.git'
rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'
#optional = true

# [dependencies.old-forum]
# default_features = false
# git = 'https://github.com/juniuszhou/substrate-forum-module'
Expand All @@ -36,7 +47,6 @@ rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'

[dev-dependencies]
# runtime-io = { package = 'sr-io', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'}
primitives = { package = 'substrate-primitives', git = 'https://github.com/paritytech/substrate.git', rev = 'c37bb08535c49a12320af7facfd555ce05cce2e8'}

[features]
default = ['std']
Expand All @@ -53,3 +63,5 @@ std = [
'timestamp/std',
# 'old-forum/std',
]
fuzzing = []
#fuzzing = ["primitives"]
18 changes: 18 additions & 0 deletions runtime-modules/forum/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Fuzzing

### Install dependencies
```
# needed by honggfuzz
sudo apt install build-essential binutils-dev libunwind-dev libblocksruntime-dev liblzma-dev
```

### Run
Variant I - honggfuzz
```
HFUZZ_RUN_ARGS="-N 8 --exit_upon_crash --keep_output" cargo hfuzz run test_fuzzing
```

Variant II - libfuzzer
```
cargo fuzz run fuzz_target_1 -- -max_len=256 -runs=10
```
4 changes: 4 additions & 0 deletions runtime-modules/forum/fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target
corpus
artifacts
Loading