mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-12-16 00:44:11 -05:00
changed emptyElement to constant
This commit is contained in:
parent
27a00bfd5f
commit
1fdabcc97c
13 changed files with 27 additions and 46 deletions
|
|
@ -20,10 +20,9 @@ contract ERC20Mixer is Mixer {
|
|||
IVerifier _verifier,
|
||||
uint256 _denomination,
|
||||
uint8 _merkleTreeHeight,
|
||||
uint256 _emptyElement,
|
||||
address _operator,
|
||||
address _token
|
||||
) Mixer(_verifier, _denomination, _merkleTreeHeight, _emptyElement, _operator) public {
|
||||
) Mixer(_verifier, _denomination, _merkleTreeHeight, _operator) public {
|
||||
token = _token;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@ contract ETHMixer is Mixer {
|
|||
IVerifier _verifier,
|
||||
uint256 _denomination,
|
||||
uint8 _merkleTreeHeight,
|
||||
uint256 _emptyElement,
|
||||
address _operator
|
||||
) Mixer(_verifier, _denomination, _merkleTreeHeight, _emptyElement, _operator) public {
|
||||
) Mixer(_verifier, _denomination, _merkleTreeHeight, _operator) public {
|
||||
}
|
||||
|
||||
function _processWithdraw(address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) internal {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ library Hasher {
|
|||
contract MerkleTreeWithHistory {
|
||||
uint256 public levels;
|
||||
|
||||
uint256 constant FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
uint256 constant ROOT_HISTORY_SIZE = 100;
|
||||
uint256 public constant FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
uint256 public constant ZERO_VALUE = 5702960885942360421128284892092891246826997279710054143430547229469817701242; // = MiMC("tornado")
|
||||
uint256 public constant ROOT_HISTORY_SIZE = 100;
|
||||
uint256[ROOT_HISTORY_SIZE] public _roots;
|
||||
uint256 public current_root_index = 0;
|
||||
|
||||
|
|
@ -28,12 +29,12 @@ contract MerkleTreeWithHistory {
|
|||
|
||||
uint32 public next_index = 0;
|
||||
|
||||
constructor(uint256 tree_levels, uint256 zero_value) public {
|
||||
constructor(uint256 tree_levels) public {
|
||||
require(tree_levels > 0, "tree_levels should be greater than zero");
|
||||
levels = tree_levels;
|
||||
|
||||
uint256 current_zero = zero_value;
|
||||
_zeros.push(zero_value);
|
||||
uint256 current_zero = ZERO_VALUE;
|
||||
_zeros.push(ZERO_VALUE);
|
||||
_filled_subtrees.push(current_zero);
|
||||
|
||||
for (uint8 i = 1; i < levels; i++) {
|
||||
|
|
|
|||
|
|
@ -43,16 +43,14 @@ contract Mixer is MerkleTreeWithHistory {
|
|||
@dev The constructor
|
||||
@param _verifier the address of SNARK verifier for this contract
|
||||
@param _merkleTreeHeight the height of deposits' Merkle Tree
|
||||
@param _emptyElement default element of the deposits' Merkle Tree
|
||||
@param _operator operator address (see operator above)
|
||||
*/
|
||||
constructor(
|
||||
IVerifier _verifier,
|
||||
uint256 _denomination,
|
||||
uint8 _merkleTreeHeight,
|
||||
uint256 _emptyElement,
|
||||
address _operator
|
||||
) MerkleTreeWithHistory(_merkleTreeHeight, _emptyElement) public {
|
||||
) MerkleTreeWithHistory(_merkleTreeHeight) public {
|
||||
require(_denomination > 0, "denomination should be greater than 0");
|
||||
verifier = _verifier;
|
||||
operator = _operator;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import '../MerkleTreeWithHistory.sol';
|
|||
|
||||
contract MerkleTreeWithHistoryMock is MerkleTreeWithHistory {
|
||||
|
||||
constructor (uint8 tree_levels, uint256 zero_value) MerkleTreeWithHistory(tree_levels, zero_value) public {}
|
||||
constructor (uint8 tree_levels) MerkleTreeWithHistory(tree_levels) public {}
|
||||
|
||||
function insert(uint256 leaf) public {
|
||||
_insert(leaf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue