Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
f873e0bc
Commit
f873e0bc
authored
Feb 16, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(ctb): Test that xdm v0 hashing matches legacy
parent
bebda738
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
Hashing.t.sol
packages/contracts-bedrock/contracts/test/Hashing.t.sol
+23
-0
No files found.
packages/contracts-bedrock/contracts/test/Hashing.t.sol
View file @
f873e0bc
...
@@ -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 {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment