Concordium / concordium-rust-sdk

Rust SDK for the Concordium blockchain.
https://docs.rs/concordium-rust-sdk/latest/concordium_rust_sdk/
Mozilla Public License 2.0
13 stars 16 forks source link

Conversion helper for `genesis_hash` to network type #212

Open DOBEN opened 2 months ago

DOBEN commented 2 months ago

Task description

Prerequisite: https://github.com/Concordium/concordium-rust-sdk/issues/209

Currently, the get_consensus_info() function returns the genesis hash. For ZK proof verification we need to convert the genesis hash into the type Network::Testnet/Network::Mainnet.

The manual conversion is awkward: https://github.com/Concordium/concordium-dapp-examples/blob/e34d1a55e92bb912695147f9561afe4af6af2620/compliant-reward-distribution/indexer-and-server/src/bin/server.rs#L142C5-L153C1

Suggestion to add a conversion helper function:

let network: Option<Network> = GENESIS_BLOCK_HASH.convert();
fn convert() -> Option<Network>
   {
      ...
   }