Skip to content

Commit

Permalink
refactor(genesis)!: remove _id and _file suffix from genesis fiel…
Browse files Browse the repository at this point in the history
…ds (#4724)

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
  • Loading branch information
mversic authored Jun 13, 2024
1 parent 8d0f3a9 commit 056cae3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 0 additions & 2 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ impl Iroha {

#[cfg(debug_assertions)]
let freeze_status = FreezeStatus::new(config.common.peer.clone());
Arc::new(AtomicBool::new(false));

let notify_shutdown = Arc::new(Notify::new());

NetworkRelay {
Expand Down
4 changes: 2 additions & 2 deletions configs/swarm/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@
}
}
],
"executor_file": "./executor.wasm",
"chain_id": "00000000-0000-0000-0000-000000000000"
"executor": "./executor.wasm",
"chain": "00000000-0000-0000-0000-000000000000"
}
16 changes: 8 additions & 8 deletions genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ pub struct GenesisTransaction(pub SignedTransaction);
pub struct RawGenesisTransaction {
instructions: Vec<InstructionBox>,
/// Path to the [`Executor`] file
executor_file: PathBuf,
executor: PathBuf,
/// Unique id of blockchain
chain_id: ChainId,
chain: ChainId,
}

impl RawGenesisTransaction {
Expand Down Expand Up @@ -61,11 +61,11 @@ impl RawGenesisTransaction {
path.as_ref().display()
)
})?;
value.executor_file = path
value.executor = path
.as_ref()
.parent()
.expect("genesis must be a file in some directory")
.join(value.executor_file);
.join(value.executor);
Ok(value)
}

Expand All @@ -79,9 +79,9 @@ impl RawGenesisTransaction {
/// # Errors
/// If executor couldn't be read from provided path
pub fn build_and_sign(self, genesis_key_pair: &KeyPair) -> Result<GenesisTransaction> {
let executor = get_executor(&self.executor_file)?;
let executor = get_executor(&self.executor)?;
let genesis =
build_and_sign_genesis(self.instructions, executor, self.chain_id, genesis_key_pair);
build_and_sign_genesis(self.instructions, executor, self.chain, genesis_key_pair);
Ok(genesis)
}
}
Expand Down Expand Up @@ -181,8 +181,8 @@ impl GenesisTransactionBuilder {
pub fn build_raw(self, executor_file: PathBuf, chain_id: ChainId) -> RawGenesisTransaction {
RawGenesisTransaction {
instructions: self.instructions,
executor_file,
chain_id,
executor: executor_file,
chain: chain_id,
}
}
}
Expand Down

0 comments on commit 056cae3

Please sign in to comment.