diff --git a/rusk-recovery/src/state.rs b/rusk-recovery/src/state.rs index 6b63b4079c..fcd9bfe746 100644 --- a/rusk-recovery/src/state.rs +++ b/rusk-recovery/src/state.rs @@ -54,6 +54,12 @@ pub static FAUCET_KEY: Lazy = Lazy::new(|| { PublicKey::from_slice(&bytes).expect("faucet should have a valid key") }); +pub static DUSK_CONSENSUS_KEY: Lazy = Lazy::new(|| { + let dusk_cpk_bytes = include_bytes!("../../rusk/src/assets/dusk.cpk"); + AccountPublicKey::from_slice(dusk_cpk_bytes) + .expect("Dusk consensus public key to be valid") +}); + fn generate_transfer_state( session: &mut Session, snapshot: &Snapshot, @@ -121,6 +127,18 @@ fn generate_stake_state( snapshot: &Snapshot, ) -> Result<(), Box> { let theme = Theme::default(); + session + .call::<_, ()>( + STAKE_CONTRACT, + "insert_stake", + &( + *DUSK_CONSENSUS_KEY, + *DUSK_CONSENSUS_KEY, + StakeData::default(), + ), + u64::MAX, + ) + .expect("stake to be inserted into the state"); snapshot.stakes().enumerate().for_each(|(idx, staker)| { info!("{} provisioner #{}", theme.action("Generating"), idx); @@ -142,7 +160,7 @@ fn generate_stake_state( .call::<_, ()>( STAKE_CONTRACT, "insert_stake", - &(*staker.address(), stake), + &(staker.to_stake_keys(), stake), u64::MAX, ) .expect("stake to be inserted into the state"); diff --git a/rusk-recovery/src/state/snapshot/stake.rs b/rusk-recovery/src/state/snapshot/stake.rs index a31e6ae6a9..8d09973b0a 100644 --- a/rusk-recovery/src/state/snapshot/stake.rs +++ b/rusk-recovery/src/state/snapshot/stake.rs @@ -7,7 +7,9 @@ use dusk_bytes::Serializable; use serde_derive::{Deserialize, Serialize}; -use execution_core::{signatures::bls::PublicKey as BlsPublicKey, Dusk}; +use execution_core::{ + signatures::bls::PublicKey as BlsPublicKey, stake::StakeKeys, Dusk, +}; use super::wrapper::Wrapper; @@ -23,4 +25,11 @@ impl GenesisStake { pub fn address(&self) -> &BlsPublicKey { &self.address } + + pub fn to_stake_keys(&self) -> StakeKeys { + StakeKeys { + account: *self.address(), + funds: *self.address(), + } + } }