Skip to content

Commit

Permalink
rusk: unit-test: Pass base_root to rusk.revert
Browse files Browse the repository at this point in the history
  • Loading branch information
goshawk-3 committed Jan 19, 2024
1 parent 4e79c7c commit c8444d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion rusk/benches/block_ingestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ pub fn accept_benchmark(c: &mut Criterion) {
)
.expect("Accepting transactions should succeed");

rusk.revert().expect("Reverting should succeed");
let base_root = rusk.base_root();
rusk.revert(base_root)
.expect("Reverting should succeed");
})
},
);
Expand Down
2 changes: 1 addition & 1 deletion rusk/src/lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl Rusk {
pub fn revert(&self, state_hash: [u8; 32]) -> Result<[u8; 32]> {
let mut inner = self.inner.lock();

let mut commits = &inner.vm.commits();
let commits = &inner.vm.commits();
if !commits.contains(&state_hash) {
return Err(Error::CommitNotFound(state_hash));
}
Expand Down
3 changes: 2 additions & 1 deletion rusk/tests/services/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ pub async fn wallet() -> Result<()> {
assert_ne!(original_root, new_root, "Root should have changed");

// Revert the state
rusk.revert().expect("Reverting should succeed");
let base_root = rusk.base_root();
rusk.revert(base_root).expect("Reverting should succeed");
cache.write().unwrap().clear();

// Check the state's root is back to the original one
Expand Down

0 comments on commit c8444d3

Please sign in to comment.