Commit f873e0bc authored by Maurelian's avatar Maurelian

test(ctb): Test that xdm v0 hashing matches legacy

parent bebda738
...@@ -5,6 +5,7 @@ import { CommonTest } from "./CommonTest.t.sol"; ...@@ -5,6 +5,7 @@ import { CommonTest } from "./CommonTest.t.sol";
import { Types } from "../libraries/Types.sol"; import { Types } from "../libraries/Types.sol";
import { Hashing } from "../libraries/Hashing.sol"; import { Hashing } from "../libraries/Hashing.sol";
import { Encoding } from "../libraries/Encoding.sol"; import { Encoding } from "../libraries/Encoding.sol";
import { LegacyCrossDomainUtils } from "../libraries/LegacyCrossDomainUtils.sol";
contract Hashing_hashDepositSource_Test is CommonTest { contract Hashing_hashDepositSource_Test is CommonTest {
/** /**
...@@ -43,6 +44,28 @@ contract Hashing_hashCrossDomainMessage_Test is CommonTest { ...@@ -43,6 +44,28 @@ contract Hashing_hashCrossDomainMessage_Test is CommonTest {
ffi.hashCrossDomainMessage(nonce, _sender, _target, _value, _gasLimit, _data) ffi.hashCrossDomainMessage(nonce, _sender, _target, _value, _gasLimit, _data)
); );
} }
/**
* @notice Tests that hashCrossDomainMessageV0 matches the hash of the legacy encoding.
*/
function testFuzz_hashCrossDomainMessageV0_matchesLegacy_succeeds(
address _target,
address _sender,
bytes memory _message,
uint256 _messageNonce
) external {
assertEq(
keccak256(
LegacyCrossDomainUtils.encodeXDomainCalldata(
_target,
_sender,
_message,
_messageNonce
)
),
Hashing.hashCrossDomainMessageV0(_target, _sender, _message, _messageNonce)
);
}
} }
contract Hashing_hashWithdrawal_Test is CommonTest { contract Hashing_hashWithdrawal_Test is CommonTest {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment