make weaver dependant on chainid

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-09-16 14:13:51 +03:00
parent 59a13fec9d
commit 45e730a8ce
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
4 changed files with 13 additions and 5 deletions

View File

@ -117,6 +117,8 @@ for i in $(seq $START $END); do
CONTRACT="AfterPartyThird"
elif [ "69" == "$i" ]; then
CONTRACT="Gatekeeper"
elif [ "420" == "$i" ]; then
CONTRACT="WeaverMock"
else
echo "No contract found for index $i"
exit

View File

@ -22,7 +22,7 @@ contract WeaverMock is Weaver {
uint256 index,
uint256 amount,
bytes32 receiver
) external pure returns (bytes32) {
) external view returns (bytes32) {
return _computeArgumentsHash(index, amount, receiver);
}
}

View File

@ -163,8 +163,14 @@ abstract contract Weaver is IWeaver {
emit ThreadInserted(globalIndex, session);
}
function _computeArgumentsHash(uint256 i, uint256 a, bytes32 r) internal pure returns (bytes32) {
return Hashes.efficientKeccak256(Hashes.efficientKeccak256(bytes32(a), r), bytes32(i));
function _computeArgumentsHash(uint256 i, uint256 a, bytes32 r) internal view returns (bytes32) {
return Hashes.efficientKeccak256(
Hashes.efficientKeccak256(
Hashes.efficientKeccak256(bytes32(a), r),
bytes32(i)
),
bytes32(block.chainid)
);
}
function _initialize(address _previousAddress) internal {

View File

@ -65,7 +65,7 @@ contract GatekeeperWeaver is Gatekeeper {
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;
return _computeArgumentsHash(valueIndex, a, r);
}
@ -76,7 +76,7 @@ contract GatekeeperWeaver is Gatekeeper {
uint256 globalIndex,
uint256 amount,
bytes32 who
) public pure returns (bytes32) {
) public view returns (bytes32) {
if (proof.length != DEPTH) { return bytes32(0); }
if (values.length == 0) { return bytes32(0); }