Skip to content

Commit

Permalink
Adapt the tests for the interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Oct 31, 2023
1 parent da554b4 commit 0babf04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-core/test/mocks/DestinationMock.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract DestinationMock is ExecutionHubMock, AgentSecuredMock, InterfaceDestina
/// @notice Prevents this contract from being included in the coverage report
function testDestinationMock() external {}

function passAgentRoot() external returns (bool rootPassed, bool rootPending) {}
function passAgentRoot() external returns (bool rootPending) {}

function acceptAttestation(
uint32 notaryIndex,
Expand Down
27 changes: 9 additions & 18 deletions packages/contracts-core/test/suite/Destination.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ contract DestinationTest is ExecutionHubTest {
// Check version
assertEq(dst.version(), LATEST_VERSION, "!version");
// Check pending Agent Merkle Root
(bool rootPassed, bool rootPending) = dst.passAgentRoot();
assertFalse(rootPassed);
(bool rootPending) = dst.passAgentRoot();
assertFalse(rootPending);
}

Expand Down Expand Up @@ -332,8 +331,7 @@ contract DestinationTest is ExecutionHubTest {
test_submitAttestation_updatesAgentRoot(ra, rootSubmittedAt);
timePassed = timePassed % AGENT_ROOT_OPTIMISTIC_PERIOD;
skip(timePassed);
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
assertFalse(rootPassed);
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
assertTrue(rootPending);
assertEq(lightManager.agentRoot(), agentRootLM);
}
Expand All @@ -342,8 +340,7 @@ contract DestinationTest is ExecutionHubTest {
// Submit attestation that updates `nextAgentRoot`
test_submitAttestation_updatesAgentRoot(ra, rootSubmittedAt);
skip(AGENT_ROOT_OPTIMISTIC_PERIOD);
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
assertTrue(rootPassed);
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
assertFalse(rootPending);
assertEq(lightManager.agentRoot(), ra._agentRoot);
}
Expand Down Expand Up @@ -377,9 +374,8 @@ contract DestinationTest is ExecutionHubTest {
bytes32 oldRoot = lightManager.agentRoot();
prepareAgentRootDisputeTest();
skip(AGENT_ROOT_OPTIMISTIC_PERIOD - 1);
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should not pass the root
assertFalse(rootPassed);
assertEq(lightManager.agentRoot(), oldRoot);
// Should clear pending
assertFalse(rootPending);
Expand All @@ -390,9 +386,8 @@ contract DestinationTest is ExecutionHubTest {
bytes32 oldRoot = lightManager.agentRoot();
prepareAgentRootDisputeTest();
skip(AGENT_ROOT_OPTIMISTIC_PERIOD);
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should not pass the root
assertFalse(rootPassed);
assertEq(lightManager.agentRoot(), oldRoot);
// Should clear pending
assertFalse(rootPending);
Expand All @@ -407,9 +402,8 @@ contract DestinationTest is ExecutionHubTest {
skip(DISPUTE_TIMEOUT_NOTARY - 1);
// Time since attestation was submitted: AGENT_ROOT_OPTIMISTIC_PERIOD - 1
// Time sinceNotary won the dispute: DISPUTE_TIMEOUT_NOTARY - 1
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should not pass the root
assertFalse(rootPassed);
assertEq(lightManager.agentRoot(), oldRoot);
// Should not clear pending
assertTrue(rootPending);
Expand All @@ -424,9 +418,8 @@ contract DestinationTest is ExecutionHubTest {
skip(DISPUTE_TIMEOUT_NOTARY - 1);
// Time since attestation was submitted: AGENT_ROOT_OPTIMISTIC_PERIOD
// Time sinceNotary won the dispute: DISPUTE_TIMEOUT_NOTARY - 1
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should not pass the root
assertFalse(rootPassed);
assertEq(lightManager.agentRoot(), oldRoot);
// Should not clear pending
assertTrue(rootPending);
Expand All @@ -441,9 +434,8 @@ contract DestinationTest is ExecutionHubTest {
skip(DISPUTE_TIMEOUT_NOTARY);
// Time since attestation was submitted: AGENT_ROOT_OPTIMISTIC_PERIOD - 1
// Time sinceNotary won the dispute: DISPUTE_TIMEOUT_NOTARY
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should not pass the root
assertFalse(rootPassed);
assertEq(lightManager.agentRoot(), oldRoot);
// Should not clear pending
assertTrue(rootPending);
Expand All @@ -457,9 +449,8 @@ contract DestinationTest is ExecutionHubTest {
skip(DISPUTE_TIMEOUT_NOTARY);
// Time since attestation was submitted: AGENT_ROOT_OPTIMISTIC_PERIOD
// Time sinceNotary won the dispute: DISPUTE_TIMEOUT_NOTARY
(bool rootPassed, bool rootPending) = InterfaceDestination(localDestination()).passAgentRoot();
bool rootPending = InterfaceDestination(localDestination()).passAgentRoot();
// Should pass the root
assertTrue(rootPassed);
assertEq(lightManager.agentRoot(), newRoot);
// Should clear pending
assertFalse(rootPending);
Expand Down
3 changes: 1 addition & 2 deletions packages/contracts-core/test/suite/DestinationSynapse.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ contract DestinationSynapseTest is ExecutionHubTest {
// Check version
assertEq(dst.version(), LATEST_VERSION, "!version");
// Check pending Agent Merkle Root
(bool rootPassed, bool rootPending) = dst.passAgentRoot();
assertFalse(rootPassed);
bool rootPending = dst.passAgentRoot();
assertFalse(rootPending);
}

Expand Down

0 comments on commit 0babf04

Please sign in to comment.