pub fn generate_fixture(
    name: &str,
    genesis_request: RunGenesisRequest,
    post_genesis_setup: impl FnOnce(&mut LmdbWasmTestBuilder),
) -> Result<(), Box<dyn std::error::Error>> {
    let lmdb_fixtures_root = path_to_lmdb_fixtures();
    let fixture_root = lmdb_fixtures_root.join(name);

    let engine_config = EngineConfig::default();
    let mut builder = LmdbWasmTestBuilder::new_with_config(&fixture_root, engine_config);

    builder.run_genesis(&genesis_request);

    // You can customize the fixture post genesis with a callable.
    post_genesis_setup(&mut builder);

    let post_state_hash = builder.get_post_state_hash();

    let state = LmdbFixtureState {
        genesis_request: serde_json::to_value(genesis_request)?,
        post_state_hash,
    };
    let serialized_state = serde_json::to_string_pretty(&state)?;
    let mut f = File::create(&fixture_root.join(STATE_JSON_FILE))?;
    f.write_all(serialized_state.as_bytes())?;
    Ok(())
}
/// Creates a new fixture with a name.
///
/// This process is currently manual. The process to do this is to check out a release branch, call
/// this function to generate (i.e. `generate_fixture("release_1_3_0")`) and persist it in version
/// control.
Creates a new fixture with a name.
This process is currently manual. The process to do this is to check out a release branch, call
this function to generate `) and persist it in version
control.
Creates a new fixture with a name . This process is currently manual . The process to do this is to check out a release branch call this function to generate ` ) and persist it in version control .
pub fn generate_fixture(
    name: &str,
    genesis_request: RunGenesisRequest,
    post_genesis_setup: impl FnOnce(&mut LmdbWasmTestBuilder),
) -> Result<(), Box<dyn std::error::Error>> {
    let lmdb_fixtures_root = path_to_lmdb_fixtures();
    let fixture_root = lmdb_fixtures_root.join(name);
    let engine_config = EngineConfig::default();
    let mut builder = LmdbWasmTestBuilder::new_with_config(&fixture_root, engine_config);
    builder.run_genesis(&genesis_request);
    // You can customize the fixture post genesis with a callable.
    post_genesis_setup(&mut builder);
    let post_state_hash = builder.get_post_state_hash();
    let state = LmdbFixtureState {
        genesis_request: serde_json::to_value(genesis_request)?,
        post_state_hash,
    };
    let serialized_state = serde_json::to_string_pretty(&state)?;
    let mut f = File::create(&fixture_root.join(STATE_JSON_FILE))?;
    f.write_all(serialized_state.as_bytes())?;
    Ok(())
}
pub fn generate_fixture ( name : & str , genesis_request : RunGenesisRequest , post_genesis_setup : impl FnOnce ( & mut LmdbWasmTestBuilder ) , ) -> Result < ( ) , Box < dyn std :: error :: Error > > { let lmdb_fixtures_root = path_to_lmdb_fixtures ( ) ; let fixture_root = lmdb_fixtures_root . join ( name ) ; let engine_config = EngineConfig :: default ( ) ; let mut builder = LmdbWasmTestBuilder :: new_with_config ( & fixture_root , engine_config ) ; builder . run_genesis ( & genesis_request ) ; // You can customize the fixture post genesis with a callable. post_genesis_setup ( & mut builder ) ; let post_state_hash = builder . get_post_state_hash ( ) ; let state = LmdbFixtureState { genesis_request : serde_json :: to_value ( genesis_request ) ? , post_state_hash , } ; let serialized_state = serde_json :: to_string_pretty ( & state ) ? ; let mut f = File :: create ( & fixture_root . join ( STATE_JSON_FILE ) ) ? ; f . write_all ( serialized_state . as_bytes ( ) ) ? ; Ok ( ( ) ) }
Creates a new fixture with a name.
Creates a new fixture with a name .
name
&str
genesis_request
RunGenesisRequest
post_genesis_setup
impl FnOnce(&mut LmdbWasmTestBuilder)
name
&str
genesis_request
RunGenesisRequest
post_genesis_setup
impl FnOnce(&mut LmdbWasmTestBuilder)