From 0babf04c78d1e1dc4d3fadbb1ef9bb3440c78045 Mon Sep 17 00:00:00 2001 From: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:41:41 +0000 Subject: [PATCH] Adapt the tests for the interface changes --- .../test/mocks/DestinationMock.t.sol | 2 +- .../test/suite/Destination.t.sol | 27 +++++++------------ .../test/suite/DestinationSynapse.t.sol | 3 +-- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/packages/contracts-core/test/mocks/DestinationMock.t.sol b/packages/contracts-core/test/mocks/DestinationMock.t.sol index 5e8313ceeb..7495aef4f3 100644 --- a/packages/contracts-core/test/mocks/DestinationMock.t.sol +++ b/packages/contracts-core/test/mocks/DestinationMock.t.sol @@ -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, diff --git a/packages/contracts-core/test/suite/Destination.t.sol b/packages/contracts-core/test/suite/Destination.t.sol index 9937895f60..c89ce0aa6d 100644 --- a/packages/contracts-core/test/suite/Destination.t.sol +++ b/packages/contracts-core/test/suite/Destination.t.sol @@ -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); } @@ -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); } @@ -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); } @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/packages/contracts-core/test/suite/DestinationSynapse.t.sol b/packages/contracts-core/test/suite/DestinationSynapse.t.sol index 2550fb19d1..26cc23c0e8 100644 --- a/packages/contracts-core/test/suite/DestinationSynapse.t.sol +++ b/packages/contracts-core/test/suite/DestinationSynapse.t.sol @@ -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); }