diff --git a/evm/src/NttManager/NttManagerState.sol b/evm/src/NttManager/NttManagerState.sol index 366cfedff..42d5eac03 100644 --- a/evm/src/NttManager/NttManagerState.sol +++ b/evm/src/NttManager/NttManagerState.sol @@ -170,7 +170,7 @@ abstract contract NttManagerState is /// @inheritdoc INttManagerState function transceiverAttestedToMessage(bytes32 digest, uint8 index) public view returns (bool) { return - _getMessageAttestationsStorage()[digest].attestedTransceivers & uint64(1 << index) == 1; + _getMessageAttestationsStorage()[digest].attestedTransceivers & uint64(1 << index) > 0; } /// @inheritdoc INttManagerState diff --git a/evm/test/NttManager.t.sol b/evm/test/NttManager.t.sol index 71326d2aa..ce36073f5 100644 --- a/evm/test/NttManager.t.sol +++ b/evm/test/NttManager.t.sol @@ -453,23 +453,17 @@ contract TestNttManager is Test, INttManagerEvents, IRateLimiterEvents { assertEq(token.balanceOf(address(user_B)), transferAmount.untrim(token.decimals())); } - // replay protection + // replay protection for transceiver vm.recordLogs(); - e2.receiveMessage(encodedEm); - - { - Vm.Log[] memory entries = vm.getRecordedLogs(); - assertEq(entries.length, 2); - assertEq(entries[1].topics.length, 3); - assertEq(entries[1].topics[0], keccak256("MessageAlreadyExecuted(bytes32,bytes32)")); - assertEq(entries[1].topics[1], toWormholeFormat(address(nttManager))); - assertEq( - entries[1].topics[2], + vm.expectRevert( + abi.encodeWithSignature( + "TransceiverAlreadyAttestedToMessage(bytes32)", TransceiverStructs.nttManagerMessageDigest( TransceiverHelpersLib.SENDING_CHAIN_ID, m ) - ); - } + ) + ); + e2.receiveMessage(encodedEm); } // TODO: diff --git a/evm/test/RateLimit.t.sol b/evm/test/RateLimit.t.sol index ab3651ae5..a24d557d8 100644 --- a/evm/test/RateLimit.t.sol +++ b/evm/test/RateLimit.t.sol @@ -559,18 +559,20 @@ contract TestRateLimit is Test, IRateLimiterEvents { // assert user now has funds assertEq(token.balanceOf(address(user_B)), 50 * 10 ** (token.decimals() - 8)); - // replay protection + // replay protection on executeMsg vm.recordLogs(); - e2.receiveMessage(encodedEm); + nttManager.executeMsg( + TransceiverHelpersLib.SENDING_CHAIN_ID, toWormholeFormat(address(nttManager)), m + ); { Vm.Log[] memory entries = vm.getRecordedLogs(); - assertEq(entries.length, 2); - assertEq(entries[1].topics.length, 3); - assertEq(entries[1].topics[0], keccak256("MessageAlreadyExecuted(bytes32,bytes32)")); - assertEq(entries[1].topics[1], toWormholeFormat(address(nttManager))); + assertEq(entries.length, 1); + assertEq(entries[0].topics.length, 3); + assertEq(entries[0].topics[0], keccak256("MessageAlreadyExecuted(bytes32,bytes32)")); + assertEq(entries[0].topics[1], toWormholeFormat(address(nttManager))); assertEq( - entries[1].topics[2], + entries[0].topics[2], TransceiverStructs.nttManagerMessageDigest( TransceiverHelpersLib.SENDING_CHAIN_ID, m )