Skip to content

Commit

Permalink
Add test with the expected revert:
Browse files Browse the repository at this point in the history
- `execute` sent from the same domain
  • Loading branch information
ChiTimesChi committed Oct 18, 2023
1 parent 34a067a commit 4527220
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/contracts-core/test/suite/hubs/ExecutionHub.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
GasLimitTooLow,
GasSuppliedTooLow,
IncorrectDestinationDomain,
IncorrectOriginDomain,
IncorrectMagicValue,
IncorrectSnapshotRoot,
MessageOptimisticPeriod,
Expand Down Expand Up @@ -326,6 +327,21 @@ abstract contract ExecutionHubTest is AgentSecuredTest {
verify_messageStatusNone(msgLeaf);
}

function test_execute_base_revert_originSameDomain() public {
RawBaseMessage memory rbm;
rbm.sender = rbm.recipient = addressToBytes32(recipient);
RawMessage memory rm;
rm.header.flag = uint8(MessageFlag.Base);
rm.header.origin = localDomain();
rm.header.destination = localDomain();
rm.header.nonce = 1;
rm.header.optimisticPeriod = 1 seconds;
rm.body = rbm.formatBaseMessage();
msgPayload = rm.formatMessage();
vm.expectRevert(IncorrectOriginDomain.selector);
testedEH().execute(msgPayload, new bytes32[](0), new bytes32[](0), 0, 0);
}

function test_execute_base_revert_reentrancy(Random memory random) public {
recipient = address(new ReentrantApp());
// Create some simple data
Expand Down

0 comments on commit 4527220

Please sign in to comment.