Skip to content

Commit

Permalink
add debug! logs
Browse files Browse the repository at this point in the history
  • Loading branch information
OverOrion committed Jun 13, 2023
1 parent eea5d22 commit bf1aee8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sidechain/state/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@

//! Implement the sidechain state traits.
use core::fmt::Debug;

use crate::{Error, SidechainState, StateUpdate};
use codec::{Decode, Encode};
use frame_support::ensure;
use itp_sgx_externalities::{SgxExternalitiesTrait, StateHash};
use itp_storage::keys::storage_value_key;
use log::{error, info};
use log::{debug, error, info};
use sp_io::{storage, KillStorageResult};

impl<T: SgxExternalitiesTrait + Clone + StateHash> SidechainState for T
impl<T: SgxExternalitiesTrait + Clone + StateHash + Debug> SidechainState for T
where
<T as SgxExternalitiesTrait>::SgxExternalitiesType: Encode,
{
Expand All @@ -34,6 +36,10 @@ where

fn apply_state_update(&mut self, state_payload: &Self::StateUpdate) -> Result<(), Error> {
info!("Current state size: {}", self.state().encoded_size());
debug!("Current hash: {}", self.hash());
debug!("State_payload hash: {}", state_payload.state_hash_apriori());
debug!("self is: {:#?}", &self);
debug!("state_payload is: {:#?}", &state_payload);
ensure!(self.hash() == state_payload.state_hash_apriori(), Error::InvalidAprioriHash);

self.execute_with(|| {
Expand Down

0 comments on commit bf1aee8

Please sign in to comment.