fix: contract, tests, clippy (#11)

This commit is contained in:
MiniFrenchBread 2024-01-26 16:13:18 +08:00 committed by GitHub
parent 0c123500c9
commit 7667e02019
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 11 deletions

View File

@ -7,7 +7,7 @@ use std::cmp::Ordering;
use std::collections::HashMap;
use std::fmt::Debug;
use std::marker::PhantomData;
use tracing::{debug, warn};
use tracing::warn;
pub use crate::merkle_tree::{Algorithm, HashElement, MerkleTreeInitialData, MerkleTreeRead};
pub use proof::{Proof, RangeProof};
@ -217,7 +217,7 @@ impl<E: HashElement, A: Algorithm<E>> AppendMerkleTree<E, A> {
tx_merkle_nodes = tx_merkle_nodes
.into_iter()
.filter_map(|(height, data)| {
if height >= self.leaf_height + 1 {
if height > self.leaf_height {
Some((height - self.leaf_height - 1, data))
} else {
None

View File

@ -112,12 +112,10 @@ impl<T: HashElement> Proof<T> {
if !in_subtree {
if *is_left {
in_subtree = true;
} else if i < tx_merkle_nodes.len() {
root_pos += 1 << tx_merkle_nodes[i].0;
} else {
if i < tx_merkle_nodes.len() {
root_pos += 1 << tx_merkle_nodes[i].0;
} else {
break;
}
break;
}
} else {
subtree_pos <<= 1;

View File

@ -35,7 +35,6 @@ TX_PARAMS = {
"gasPrice": 10_000_000_000,
"gas": 10_000_000,
"from": GENESIS_ACCOUNT.address,
"gas": 2_000_000,
}
GENESIS_PRIV_KEY1 = "9a6d3ba2b0c7514b16a006ee605055d71b9edfad183aeb2d9790e9d4ccced471"

View File

@ -282,12 +282,12 @@ class BlockchainNode(TestNode):
token_contract, _ = deploy_contract(self.token_contract_path)
self.log.debug("ERC20 deployed")
flow_contract, flow_contract_hash = deploy_contract(
self.contract_path, [token_contract.address]
self.contract_path, ["0x0000000000000000000000000000000000000000", 100, 0]
)
self.log.debug("Flow deployed")
mine_contract, _ = deploy_contract(
self.mine_contract_path,
[flow_contract.address, 0],
[flow_contract.address, "0x0000000000000000000000000000000000000000", 7],
)
self.log.debug("Mine deployed")
self.log.info("All contracts deployed")

@ -1 +1 @@
Subproject commit aa642b673c5571586a9d57e70c09c774601db6fb
Subproject commit 951c02992e2a03eb47e41eb840392ec824639640