Skip to content

Commit

Permalink
fix the hsig
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyanho committed Sep 14, 2020
1 parent bf0b2a9 commit a7bdfe8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions contract/Groth16Mixer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# template for codegen
from eth_utils import to_checksum_address

from python_web3.client.bcosclient import (
BcosClient
)
Expand Down
6 changes: 4 additions & 2 deletions contract/mixer/BaseMixer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,13 @@ contract BaseMixer is MerkleTreePos, BAC001Holder {
// from vk).
bytes32 expected_hsig = sha256(abi.encodePacked(nfs, vk));

expected_hsig = expected_hsig >> 3;
//expected_hsig = expected_hsig >> 3;
uint p_mod = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
uint expected_hsig_mod = uint256(expected_hsig) % p_mod;

bytes32 hsig = assemble_hsig(primary_inputs);
require(
expected_hsig == hsig,
expected_hsig_mod == uint256(hsig),
"Invalid hsig: This hsig does not correspond to the hash of vk and the nfs"
);
}
Expand Down
Loading

0 comments on commit a7bdfe8

Please sign in to comment.