Skip to content

Commit

Permalink
use externalities directly
Browse files Browse the repository at this point in the history
  • Loading branch information
vgantchev committed Jan 11, 2024
1 parent 947caf7 commit 8997788
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

7 changes: 1 addition & 6 deletions runtime-fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use frame_support::{
use hydradx_runtime::*;
use primitives::constants::time::SLOT_DURATION;
use runtime_mock::hydradx_mocked_runtime;
use scraper::{load_snapshot, save_externalities};
use sp_consensus_aura::{Slot, AURA_ENGINE_ID};
use sp_runtime::{
traits::{Dispatchable, Header},
Expand Down Expand Up @@ -133,7 +132,6 @@ fn recursively_find_call(call: RuntimeCall, matches_on: fn(RuntimeCall) -> bool)
}

fn main() {
let snapshot: PathBuf = PathBuf::from("./SNAPSHOT");
// We ensure that on each run, the mapping is a fresh one
#[cfg(not(any(fuzzing, coverage)))]
if std::fs::remove_file(FILENAME_MEMORY_MAP).is_err() {
Expand All @@ -143,9 +141,6 @@ fn main() {
// List of accounts to choose as origin
let accounts: Vec<AccountId> = (0..20).map(|i| [i; 32].into()).collect();

let mocked_runtime = hydradx_mocked_runtime();
save_externalities::<Block>(mocked_runtime, snapshot.clone()).unwrap();

ziggy::fuzz!(|data: &[u8]| {
let iteratable = Data {
data,
Expand Down Expand Up @@ -216,7 +211,7 @@ fn main() {
}

// `externalities` represents the state of our mock chain.
let mut externalities = load_snapshot::<Block>(snapshot.clone()).unwrap();
let mut externalities = hydradx_mocked_runtime();

let mut current_block: u32 = 1;
let mut current_timestamp: u64 = SLOT_DURATION;
Expand Down
1 change: 0 additions & 1 deletion runtime-mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ toml = "0.5"
# local dependencies
hydradx-runtime = { workspace = true }
primitives = { workspace = true }
scraper = { workspace = true }

# Substrate dependencies
frame-support = { workspace = true }
Expand Down

0 comments on commit 8997788

Please sign in to comment.