-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Testcase] Add sequencer accumulator test cases (#1941)
* update last_sequencer_info * add sequencer acumulator test caese * fixup testcases * remove last order update
- Loading branch information
Showing
5 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
mod test_accumulator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::RoochStore; | ||
use accumulator::node_index::NodeIndex; | ||
use accumulator::{AccumulatorNode, AccumulatorTreeStore}; | ||
use moveos_types::h256::H256; | ||
|
||
#[test] | ||
fn test_accumulator_store() { | ||
let (rooch_store, _) = RoochStore::mock_rooch_store().unwrap(); | ||
|
||
let acc_node = AccumulatorNode::new_leaf(NodeIndex::from_inorder_index(1), H256::random()); | ||
let node_hash = acc_node.hash(); | ||
rooch_store | ||
.transaction_accumulator_store | ||
.save_node(acc_node.clone()) | ||
.unwrap(); | ||
let acc_node2 = rooch_store | ||
.transaction_accumulator_store | ||
.get_node(node_hash) | ||
.unwrap() | ||
.unwrap(); | ||
assert_eq!(acc_node, acc_node2); | ||
} |