diff --git a/node/src/chain/acceptor.rs b/node/src/chain/acceptor.rs index 152dd5315..79b6fd684 100644 --- a/node/src/chain/acceptor.rs +++ b/node/src/chain/acceptor.rs @@ -628,6 +628,7 @@ impl Acceptor { let mut task = self.task.write().await; let mut tip = self.tip.write().await; + let prev_header = tip.inner().header().clone(); let mut provisioners_list = self.provisioners_list.write().await; let block_time = blk.header().timestamp - tip.inner().header().timestamp; @@ -636,7 +637,7 @@ impl Acceptor { // Verify Block Header let (pni, prev_block_voters, tip_block_voters) = verify_block_header( self.db.clone(), - &tip.inner().header().clone(), + &prev_header, &provisioners_list, blk.header(), ) @@ -658,8 +659,11 @@ impl Acceptor { let vm = self.vm.write().await; let (stakes, finality) = self.db.read().await.update(|db| { - let (txs, verification_output, stake_events) = - vm.accept(blk, &prev_block_voters[..])?; + let (txs, verification_output, stake_events) = vm.accept( + prev_header.state_hash, + blk, + &prev_block_voters[..], + )?; for spent_tx in txs.iter() { events.push(TransactionEvent::Executed(spent_tx).into()); } diff --git a/node/src/chain/consensus.rs b/node/src/chain/consensus.rs index 9a3d2a518..13727e393 100644 --- a/node/src/chain/consensus.rs +++ b/node/src/chain/consensus.rs @@ -315,6 +315,7 @@ impl Operations for Executor { async fn verify_state_transition( &self, + prev_root: [u8; 32], blk: &Block, voters: &[Voter], ) -> Result { @@ -322,7 +323,7 @@ impl Operations for Executor { let vm = self.vm.read().await; - vm.verify_state_transition(blk, voters) + vm.verify_state_transition(prev_root, blk, voters) .map_err(OperationError::InvalidVST) } diff --git a/node/src/vm.rs b/node/src/vm.rs index 00b68df8f..f43899a82 100644 --- a/node/src/vm.rs +++ b/node/src/vm.rs @@ -29,12 +29,14 @@ pub trait VMExecution: Send + Sync + 'static { fn verify_state_transition( &self, + prev_root: [u8; 32], blk: &Block, voters: &[Voter], ) -> anyhow::Result; fn accept( &self, + prev_root: [u8; 32], blk: &Block, voters: &[Voter], ) -> anyhow::Result<(