-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration file for node initialisation (#138)
* Working parsing of config file, need to implement file creation + improve code organisation * make clippy happy * applied changes, improved congfig file + encapsulated logic in genesis.rs * make clippy happy * Creation of genesis.dat file * Move hex_str_to_byte_array() to utils * removed async for make_genesis(), created start.rs, added genesis test * Added back doc + added doc * Accounts are successfully added to accounts folder + genesis.dat created * Added testing for account files existing * refactor AccountData struct * Fixed first half of comments * Use miden_crypto::utils::hex_to_bytes() for hex deserialization * Added Option<> * Changed NodeTopLevelConfig to StartCommandConfig * Added new(), fixed functions, added try_from * Added manual Serialization / Deserialization for AuthSchemeInput and AccountData * AccountData structs are correctly serialised and deserialised * Added testing for serialization / deserialization, bugs * Removed unused crates * changed seed to init_seed * Updated with miden-base AccountData and AuthData additions * Updated file structure + re-wrote test * Fix formatting * refactor: code organization * Added requested changes * Accounts folder is created in same folder as genesis file * Removed folder removal + removed mode + improved comment * Updated documentation * Fixed readme + adjusted if statement for account dir creation --------- Co-authored-by: Bobbin Threadbare <bobbinth@protonmail.com>
- Loading branch information
Showing
11 changed files
with
418 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This is an example genesis input file for the Miden node. | ||
|
||
version = 1 | ||
timestamp = 1672531200 | ||
|
||
[[accounts]] | ||
type = "BasicWallet" | ||
init_seed = "0xa123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" | ||
auth_scheme = "RpoFalcon512" | ||
auth_seed = "0xb123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" | ||
|
||
[[accounts]] | ||
type = "BasicFungibleFaucet" | ||
init_seed = "0xc123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" | ||
auth_scheme = "RpoFalcon512" | ||
auth_seed = "0xd123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" | ||
token_symbol = "POL" | ||
decimals = 12 | ||
max_supply = 1000000 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use serde::Deserialize; | ||
|
||
// INPUT HELPER STRUCTS | ||
// ================================================================================================ | ||
|
||
/// Input types are helper structures designed for parsing and deserializing genesis input files. | ||
/// They serve as intermediary representations, facilitating the conversion from | ||
/// placeholder types (like `GenesisInput`) to internal types (like `GenesisState`). | ||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct GenesisInput { | ||
pub version: u64, | ||
pub timestamp: u64, | ||
pub accounts: Vec<AccountInput>, | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
#[serde(tag = "type")] | ||
pub enum AccountInput { | ||
BasicWallet(BasicWalletInputs), | ||
BasicFungibleFaucet(BasicFungibleFaucetInputs), | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct BasicWalletInputs { | ||
pub init_seed: String, | ||
pub auth_scheme: AuthSchemeInput, | ||
pub auth_seed: String, | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct BasicFungibleFaucetInputs { | ||
pub init_seed: String, | ||
pub auth_scheme: AuthSchemeInput, | ||
pub auth_seed: String, | ||
pub token_symbol: String, | ||
pub decimals: u8, | ||
pub max_supply: u64, | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, Deserialize)] | ||
pub enum AuthSchemeInput { | ||
RpoFalcon512, | ||
} |
Oops, something went wrong.