Skip to content

Commit

Permalink
Return additional state_root on try_construct_block
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Aug 23, 2023
1 parent ac08fb3 commit d9d1502
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ain-evm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct FinalizedBlockInfo {
pub total_burnt_fees: U256,
pub total_priority_fees: U256,
pub block_number: U256,
pub state_root: XHash,
}

pub struct DeployContractInfo {
Expand Down Expand Up @@ -377,6 +378,7 @@ impl EVMServices {
total_burnt_fees,
total_priority_fees,
block_number: current_block_number,
state_root: format!("{:?}", state_root),
})
}

Expand Down
2 changes: 2 additions & 0 deletions lib/ain-rs-exports/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ pub fn evm_unsafe_try_construct_block_in_q(
total_burnt_fees,
total_priority_fees,
block_number,
state_root,
}) => {
let Ok(total_burnt_fees) = u64::try_from(WeiAmount(total_burnt_fees).to_satoshi())
else {
Expand All @@ -508,6 +509,7 @@ pub fn evm_unsafe_try_construct_block_in_q(
total_burnt_fees,
total_priority_fees,
block_number: block_number.as_u64(),
state_root,
}
}
Err(e) => cross_boundary_error_return(result, e.to_string()),
Expand Down
1 change: 1 addition & 0 deletions lib/ain-rs-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub mod ffi {
pub total_burnt_fees: u64,
pub total_priority_fees: u64,
pub block_number: u64,
pub state_root: String,
}

#[derive(Default)]
Expand Down

0 comments on commit d9d1502

Please sign in to comment.