Skip to content

Commit

Permalink
Failing with InvalidSignature(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninokeldishvili committed Aug 5, 2024
1 parent fbf2407 commit 241b117
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/flow/FlowSignedContextTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,28 @@ import {InterpreterMockTest} from "../abstract/InterpreterMockTest.sol";
import {FlowERC1155Test} from "../abstract/FlowERC1155Test.sol";

contract FlowSignedContextTest is FlowERC1155Test {
function testValidateMultipleSignedContexts(string memory uri) public {
function testValidateMultipleSignedContexts(string memory uri, bytes memory context0, bytes memory context1)
public
{
(IFlowERC1155V5 erc1155Flow, EvaluableV2 memory evaluable) = deployIFlowERC1155V5(uri);

address alice = vm.addr(1);
address bob = vm.addr(2);

vm.startPrank(alice);
bytes32 hash = keccak256(context0);
(uint8 v0, bytes32 r0, bytes32 s0) = vm.sign(1, hash);
address signer = ecrecover(hash, v0, r0, s0);
// Convert the signature components to uint256[]
uint256[] memory signatureAlice = new uint256[](3);
signatureAlice[0] = uint256(r0);
signatureAlice[1] = uint256(s0);
signatureAlice[2] = uint256(v0);

SignedContextV1[] memory signedContexts = new SignedContextV1[](2);
signedContexts[0] = SignedContextV1(alice, signatureAlice, context0);

signedContexts[1] = SignedContextV1(alice, signatureAlice, context1);
erc1155Flow.flow(evaluable, signatureAlice, signedContexts);
}
}

0 comments on commit 241b117

Please sign in to comment.