Skip to content

Commit 4d5c6ca

Browse files
committed
feat: check message context on timeout
1 parent 8dcf4ef commit 4d5c6ca

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/IncentivizedMessageEscrow.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,9 @@ abstract contract IncentivizedMessageEscrow is IIncentivizedMessageEscrow, Bytes
972972
// entirely untrusted. We do no verification on it. As a result, we shouldn't
973973
// trust any data within it. It is first when this message hits the source chain we can begin to verify data.
974974

975+
// Check that at least the context is set correctly.
976+
if (message[CONTEXT_POS] != CTX_SOURCE_TO_DESTINATION) revert MessageHasInvalidContext();
977+
975978
// Get the message identifier from the message.
976979
bytes32 messageIdentifier = bytes32(message[MESSAGE_IDENTIFIER_START:MESSAGE_IDENTIFIER_END]);
977980
// Read the status of the package at MessageIdentifier.

src/interfaces/IMessageEscrowErrors.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ interface IMessageEscrowErrors {
2121
error MessageAlreadyProcessed(); // 7b042609
2222
error DeadlineNotPassed(uint64 expected, uint64 actual); // 862c57f4
2323
error InvalidTimeoutPackage(bytes32 expected, bytes32 actual); // e020885d
24+
error MessageHasInvalidContext(); // 3fcdbaba
2425
}

0 commit comments

Comments
 (0)