make weaver dependant on chainid
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
59a13fec9d
commit
45e730a8ce
@ -117,6 +117,8 @@ for i in $(seq $START $END); do
|
|||||||
CONTRACT="AfterPartyThird"
|
CONTRACT="AfterPartyThird"
|
||||||
elif [ "69" == "$i" ]; then
|
elif [ "69" == "$i" ]; then
|
||||||
CONTRACT="Gatekeeper"
|
CONTRACT="Gatekeeper"
|
||||||
|
elif [ "420" == "$i" ]; then
|
||||||
|
CONTRACT="WeaverMock"
|
||||||
else
|
else
|
||||||
echo "No contract found for index $i"
|
echo "No contract found for index $i"
|
||||||
exit
|
exit
|
||||||
|
|||||||
@ -22,7 +22,7 @@ contract WeaverMock is Weaver {
|
|||||||
uint256 index,
|
uint256 index,
|
||||||
uint256 amount,
|
uint256 amount,
|
||||||
bytes32 receiver
|
bytes32 receiver
|
||||||
) external pure returns (bytes32) {
|
) external view returns (bytes32) {
|
||||||
return _computeArgumentsHash(index, amount, receiver);
|
return _computeArgumentsHash(index, amount, receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,8 +163,14 @@ abstract contract Weaver is IWeaver {
|
|||||||
emit ThreadInserted(globalIndex, session);
|
emit ThreadInserted(globalIndex, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _computeArgumentsHash(uint256 i, uint256 a, bytes32 r) internal pure returns (bytes32) {
|
function _computeArgumentsHash(uint256 i, uint256 a, bytes32 r) internal view returns (bytes32) {
|
||||||
return Hashes.efficientKeccak256(Hashes.efficientKeccak256(bytes32(a), r), bytes32(i));
|
return Hashes.efficientKeccak256(
|
||||||
|
Hashes.efficientKeccak256(
|
||||||
|
Hashes.efficientKeccak256(bytes32(a), r),
|
||||||
|
bytes32(i)
|
||||||
|
),
|
||||||
|
bytes32(block.chainid)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _initialize(address _previousAddress) internal {
|
function _initialize(address _previousAddress) internal {
|
||||||
|
|||||||
@ -65,7 +65,7 @@ contract GatekeeperWeaver is Gatekeeper {
|
|||||||
return bytes32(_treeNodes[session][slotIndex].latest());
|
return bytes32(_treeNodes[session][slotIndex].latest());
|
||||||
}
|
}
|
||||||
|
|
||||||
function computePreimage(uint256 globalIndex, uint256 a, bytes32 r) public pure returns (bytes32) {
|
function computePreimage(uint256 globalIndex, uint256 a, bytes32 r) public view returns (bytes32) {
|
||||||
uint256 valueIndex = globalIndex / SLOTS;
|
uint256 valueIndex = globalIndex / SLOTS;
|
||||||
return _computeArgumentsHash(valueIndex, a, r);
|
return _computeArgumentsHash(valueIndex, a, r);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ contract GatekeeperWeaver is Gatekeeper {
|
|||||||
uint256 globalIndex,
|
uint256 globalIndex,
|
||||||
uint256 amount,
|
uint256 amount,
|
||||||
bytes32 who
|
bytes32 who
|
||||||
) public pure returns (bytes32) {
|
) public view returns (bytes32) {
|
||||||
if (proof.length != DEPTH) { return bytes32(0); }
|
if (proof.length != DEPTH) { return bytes32(0); }
|
||||||
if (values.length == 0) { return bytes32(0); }
|
if (values.length == 0) { return bytes32(0); }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user