@@ -15,7 +15,7 @@ EIP712_DOMAIN_TYPEHASH: constant(bytes32) = keccak256(
1515 "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract) "
1616)
1717MODIFY_TYPEHASH: constant (bytes32 ) = keccak256 (
18- "Modify(uint256 action,bytes data) "
18+ "Modify(bytes32 parent, uint256 action,bytes data) "
1919)
2020
2121struct Call :
@@ -29,7 +29,7 @@ CALL_TYPEHASH: constant(bytes32) = keccak256(
2929 "Call(address target,uint256 value,bytes data) "
3030)
3131EXECUTE_TYPEHASH: constant (bytes32 ) = keccak256 (
32- "Execute(Call[] calls)Call(address target,uint256 value,bytes data) "
32+ "Execute(bytes32 parent, Call[] calls)Call(address target,uint256 value,bytes data) "
3333)
3434
3535# @dev The current implementation address for `RuffsackProxy`
@@ -44,6 +44,9 @@ signers: public(DynArray[address, 11])
4444threshold: public (uint256 )
4545# NOTE: invariant `0 < threshold <= len(signers)`
4646
47+ # @dev The last message hash (`Modify` or `Execute` struct) that was executed
48+ head: public (bytes32 )
49+
4750# @dev Set of pre-approved transaction hashes, indexed by signer
4851approved: public (HashMap[bytes32 , HashMap[address , bool ]])
4952
@@ -247,10 +250,11 @@ def modify(
247250 # NOTE: Skip argument to use on-chain approvals
248251):
249252 msghash: bytes32 = self ._hash_typed_data_v4 (
250- # NOTE: Per EIP712, Dynamic ABI types are encoded as the hash of their contents
251- keccak256 (abi_encode (MODIFY_TYPEHASH, action, keccak256 (data)))
253+ # NOTE: Per EIP712, Dynamic structures are encoded as the hash of their contents
254+ keccak256 (abi_encode (MODIFY_TYPEHASH, self .head, action, keccak256 (data)))
252255 )
253256 self ._verify_signatures (msghash, signatures)
257+ self .head = msghash
254258
255259 admin_guard: IAdminGuard = self .admin_guard
256260 if admin_guard.address != empty (address ):
@@ -332,9 +336,10 @@ def execute(
332336 # Step 3: Hash concatenated item hashes, together with typehash, then with domain to get msghash
333337 msghash: bytes32 = self ._hash_typed_data_v4 (
334338 # NOTE: Per EIP712, Arrays are encoded as the hash of their encoded members, concated together
335- keccak256 (abi_encode (EXECUTE_TYPEHASH, keccak256 (encoded_call_array)))
339+ keccak256 (abi_encode (EXECUTE_TYPEHASH, self .head, keccak256 (encoded_call_array)))
336340 )
337341 self ._verify_signatures (msghash, signatures)
342+ self .head = msghash
338343
339344 guard: IExecuteGuard = self .execute_guard
340345 for call: Call in calls:
0 commit comments