From 040e9b220cf69aad59b9133f01d88baf2bb0c3ce Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Mon, 4 Mar 2024 09:28:38 -0500
Subject: [PATCH 1/9] evm: natspec changes and additions

---
 evm/src/NttManager/NttManager.sol             | 16 ++++++
 evm/src/Transceiver/Transceiver.sol           |  8 +++
 evm/src/interfaces/INttManager.sol            | 43 ++++++++++++++--
 evm/src/interfaces/IWormholeTransceiver.sol   | 43 ++++++++++++++--
 .../interfaces/IWormholeTransceiverState.sol  | 49 +++++++++++++++++++
 evm/src/libraries/RateLimiter.sol             |  4 +-
 6 files changed, 152 insertions(+), 11 deletions(-)

diff --git a/evm/src/NttManager/NttManager.sol b/evm/src/NttManager/NttManager.sol
index 2a5a5fe72..8f3f8958e 100644
--- a/evm/src/NttManager/NttManager.sol
+++ b/evm/src/NttManager/NttManager.sol
@@ -17,6 +17,22 @@ import "../interfaces/ITransceiver.sol";
 
 import {NttManagerState} from "./NttManagerState.sol";
 
+/// @title NttManager
+/// @notice The NttManager contract is responsible for managing the token
+///         and associated transceivers.
+///
+/// @dev Each NttManager contract is associated with a single token but
+///      can be responsible for multiple transceivers.
+///
+/// @dev When transferring tokens, the NttManager contract will either
+///      lock the tokens or burn them, depending on the mode.
+///
+/// @dev To initiate a transfer, the user calls the transfer function with:
+///  - the amount
+///  - the recipient chain
+///  - the recipient address
+///  - (optional) a flag to indicate whether the transfer should be queued
+///    if the rate limit is exceeded
 contract NttManager is INttManager, NttManagerState {
     using BytesParsing for bytes;
     using SafeERC20 for IERC20;
diff --git a/evm/src/Transceiver/Transceiver.sol b/evm/src/Transceiver/Transceiver.sol
index b0e8d633c..d5115190c 100644
--- a/evm/src/Transceiver/Transceiver.sol
+++ b/evm/src/Transceiver/Transceiver.sol
@@ -11,6 +11,14 @@ import "../libraries/Implementation.sol";
 import "../interfaces/INttManager.sol";
 import "../interfaces/ITransceiver.sol";
 
+/// @title Transceiver
+/// @notice This contract is a base contract for Transceivers.
+/// @dev The Transceiver provides basic functionality for transmitting / receiving NTT messages.
+///      The contract supports pausing via an admin or owner and is upgradable.
+///
+/// @dev The interface for receiving messages is not enforced by this contract.
+///      Instead, inheriting contracts should implement their own receiving logic,
+///      based on the verification model and serde logic associated with message handling.
 abstract contract Transceiver is
     ITransceiver,
     PausableOwnable,
diff --git a/evm/src/interfaces/INttManager.sol b/evm/src/interfaces/INttManager.sol
index f3136a059..18e567783 100644
--- a/evm/src/interfaces/INttManager.sol
+++ b/evm/src/interfaces/INttManager.sol
@@ -7,16 +7,22 @@ import "../libraries/TransceiverStructs.sol";
 import "./INttManagerState.sol";
 
 interface INttManager is INttManagerState {
+    /// @notice The mode is either LOCKING or BURNING. In LOCKING mode, the NttManager locks the
+    ///         tokens of the sender and mints an equivalent amount on the target chain. In BURNING
+    ///         mode, the NttManager burns the tokens of the sender and mints an equivalent amount
+    ///         on the target chain.LOCKING mode preserves the total supply of the tokens.
     enum Mode {
         LOCKING,
         BURNING
     }
 
-    // @dev Information about attestations for a given message.
+    /// @notice Information about attestations for a given message.
+    /// @dev The fields are as follows:
+    ///      - executed: whether the message has been executed.
+    ///      - attested: bitmap of transceivers that have attested to this message.
+    ///                  (NOTE: might contain disabled transceivers)
     struct AttestationInfo {
-        // whether this message has been executed
         bool executed;
-        // bitmap of transceivers that have attested to this message (NOTE: might contain disabled transceivers)
         uint64 attestedTransceivers;
     }
 
@@ -43,12 +49,41 @@ interface INttManager is INttManagerState {
     /// @param mode The mode.
     error InvalidMode(uint8 mode);
 
+    /// @notice Error when the refund to the sender fails.
+    /// @dev Selector 0x2ca23714.
+    /// @param refundAmount The refund amount.
     error RefundFailed(uint256 refundAmount);
-    error TransceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
+
+    /// @notice Error when the tranceiver already attested to the message.
+    ///         To ensure the client does not continue to initiate calls to the ateestationReceived function.
+    /// @dev Selector 0x2113894.
+    /// @param nttManagerMessageHash The hash of the message.
+    error TrasceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
+
+    /// @notice Error when the message is not approved.
+    /// @dev Selector 0x451c4fb0.
+    /// @param msgHash The hash of the message.
     error MessageNotApproved(bytes32 msgHash);
+
+    /// @notice Error when trying to execute a message on an unintended target chain.
+    /// @dev Selector 0x3dcb204a.
+    /// @param targetChain The target chain.
+    /// @param thisChain The current chain.
     error InvalidTargetChain(uint16 targetChain, uint16 thisChain);
+
+    /// @notice Error when the transfer amount is zero.
+    /// @dev Selector 0x9993626a.
     error ZeroAmount();
+
+    /// @notice Error when the recipient is invalid.
+    /// @dev Selector 0x9c8d2cd2.
     error InvalidRecipient();
+
+    /// @@notice Error when the amount burned is different than the balance difference,
+    ///          since NTT does not support burn fees.
+    /// @dev Selector 0x02156a8f.
+    /// @param burnAmount The amount burned.
+    /// @param balanceDiff The balance after burning.
     error BurnAmountDifferentThanBalanceDiff(uint256 burnAmount, uint256 balanceDiff);
 
     /// @notice Transfer a given amount to a recipient on a given chain. This function is called
diff --git a/evm/src/interfaces/IWormholeTransceiver.sol b/evm/src/interfaces/IWormholeTransceiver.sol
index c9f6a62b2..919675ead 100644
--- a/evm/src/interfaces/IWormholeTransceiver.sol
+++ b/evm/src/interfaces/IWormholeTransceiver.sol
@@ -6,29 +6,64 @@ import "../libraries/TransceiverStructs.sol";
 import "./IWormholeTransceiverState.sol";
 
 interface IWormholeTransceiver is IWormholeTransceiverState {
+    /// @notice The instruction for the WormholeTransceiver contract
+    ///         to skip delivery via the relayer.
     struct WormholeTransceiverInstruction {
         bool shouldSkipRelayerSend;
     }
 
+    /// @notice Emitted when a relayed message is received.
+    /// @dev Topic0
+    ///      0xf557dbbb087662f52c815f6c7ee350628a37a51eae9608ff840d996b65f87475
+    /// @param digest The digest of the message.
+    /// @param emitterChainId The chain ID of the emitter.
+    /// @param emitterAddress The address of the emitter.
     event ReceivedRelayedMessage(bytes32 digest, uint16 emitterChainId, bytes32 emitterAddress);
+
+    /// @notice Emitted when a message is received.
+    /// @dev Topic0
+    ///     0xf6fc529540981400dc64edf649eb5e2e0eb5812a27f8c81bac2c1d317e71a5f0.
+    /// @param digest The digest of the message.
+    /// @param emitterChainId The chain ID of the emitter.
+    /// @param emitterAddress The address of the emitter.
+    /// @param sequence The sequence of the message.
     event ReceivedMessage(
         bytes32 digest, uint16 emitterChainId, bytes32 emitterAddress, uint64 sequence
     );
+
+    /// @notice Emitted when a message is sent from the transceiver.
+    /// @dev Topic0
+    ///      0x53b3e029c5ead7bffc739118953883859d30b1aaa086e0dca4d0a1c99cd9c3f5.
+    /// @param recipientChain The chain ID of the recipient.
+    /// @param message The message.
     event SendTransceiverMessage(
         uint16 recipientChain, TransceiverStructs.TransceiverMessage message
     );
 
+    /// @notice Error when the relaying configuration is invalid. (e.g. chainId is not registered)
+    /// @dev Selector: 0x9449a36c.
+    /// @param chainId The chain ID that is invalid.
     error InvalidRelayingConfig(uint16 chainId);
+
+    /// @notice Error when the peer transceiver is invalid.
+    /// @dev Selector: 0x79b1ce56.
+    /// @param chainId The chain ID of the peer.
+    /// @param peerAddress The address of the invalid peer.
     error InvalidWormholePeer(uint16 chainId, bytes32 peerAddress);
+
+    /// @notice Error when the VAA has already been consumed.
+    /// @dev Selector: 0x406e719e.
+    /// @param vaaHash The hash of the VAA.
     error TransferAlreadyCompleted(bytes32 vaaHash);
 
-    /// @notice Receive an attested message from the verification layer. This function should verify
-    /// the `encodedVm` and then deliver the attestation to the transceiver NttManager contract.
+    /// @notice Receive an attested message from the verification layer.
+    /// This function should verify the `encodedVm` and then deliver the attestation
+    /// to the transceiver NttManager contract.
     /// @param encodedMessage The attested message.
     function receiveMessage(bytes memory encodedMessage) external;
 
-    /// @notice Parses the encoded instruction and returns the instruction struct. This instruction
-    /// is specific to the WormholeTransceiver contract.
+    /// @notice Parses the encoded instruction and returns the instruction struct.
+    /// This instruction is specific to the WormholeTransceiver contract.
     /// @param encoded The encoded instruction.
     /// @return instruction The parsed `WormholeTransceiverInstruction`.
     function parseWormholeTransceiverInstruction(bytes memory encoded)
diff --git a/evm/src/interfaces/IWormholeTransceiverState.sol b/evm/src/interfaces/IWormholeTransceiverState.sol
index c35586f33..50640309a 100644
--- a/evm/src/interfaces/IWormholeTransceiverState.sol
+++ b/evm/src/interfaces/IWormholeTransceiverState.sol
@@ -4,17 +4,66 @@ pragma solidity >=0.8.8 <0.9.0;
 import "../libraries/TransceiverStructs.sol";
 
 interface IWormholeTransceiverState {
+    /// @notice Emitted when a message is sent from the transceiver.
+    /// @dev Topic0
+    ///      0x375a56c053c4d19a2e3445e97b7a28bf4e908617ce6d766e1e03a9d3f5276271.
+    /// @param relayingType The type of relaying.
+    /// @param deliveryPayment The amount of ether sent along with the tx to cover the delivery fee.
     event RelayingInfo(uint8 relayingType, uint256 deliveryPayment);
+
+    /// @notice Emitted when a peer transceiver is set.
+    /// @dev Topic0
+    ///      0xa559263ee060c7a2560843b3a064ff0376c9753ae3e2449b595a3b615d326466.
+    /// @param chainId The chain ID of the peer.
+    /// @param peerContract The address of the peer contract.
     event SetWormholePeer(uint16 chainId, bytes32 peerContract);
+
+    /// @notice Emitted when relaying is enabled for the given chain.
+    /// @dev Topic0
+    ///      0x528b18a533e892b5401d1fb63597275df9d2bb45b13e7695c3147cd07b9746c3.
+    /// @param chainId The chain ID to set.
+    /// @param isRelayingEnabled A boolean indicating whether relaying is enabled.
     event SetIsWormholeRelayingEnabled(uint16 chainId, bool isRelayingEnabled);
+
+    /// @notice Emitted when special relaying is enabled for the given chain.
+    /// @dev Topic0
+    ///      0x0fe301480713b2c2072ee91b3bcfcbf2c0014f0447c89046f020f0f80727003c.
+    /// @param chainId The chain ID to set.
     event SetIsSpecialRelayingEnabled(uint16 chainId, bool isRelayingEnabled);
+
+    /// @notice Emitted when the chain is EVM compatible.
+    /// @dev Topic0
+    ///      0x50bbeb4e180e8f9e429f6ef6b53496616c747fe502441c4f423d5fc9ec958d9c.
+    /// @param chainId The chain ID to set.
+    /// @param isEvm A boolean indicating whether relaying is enabled.
     event SetIsWormholeEvmChain(uint16 chainId, bool isEvm);
 
+    /// @notice Additonal messages are not allowed.
+    /// @dev Selector: 0xc504ea29.
     error UnexpectedAdditionalMessages();
+
+    /// @notice Error if the VAA is invalid.
+    /// @dev Selector: 0x8ee2e336.
+    /// @param reason The reason the VAA is invalid.
     error InvalidVaa(string reason);
+
+    /// @notice Error if the peer has already been set.
+    /// @dev Selector: 0xb55eeae9.
+    /// @param chainId The chain ID of the peer.
+    /// @param peerAddress The address of the peer.
     error PeerAlreadySet(uint16 chainId, bytes32 peerAddress);
+
+    /// @notice Error the peer contract cannot be the zero address.
+    /// @dev Selector: 0x26e0c7de.
     error InvalidWormholePeerZeroAddress();
+
+    /// @notice The chain ID cannot be zero.
+    /// @dev Selector: 0x3dd98b24.
     error InvalidWormholeChainIdZero();
+
+    /// @notice The caller is not the relayer.
+    /// @dev Selector: 0x1c269589.
+    /// @param caller The caller.
     error CallerNotRelayer(address caller);
 
     /// @notice Get the corresponding Transceiver contract on other chains that have been registered
diff --git a/evm/src/libraries/RateLimiter.sol b/evm/src/libraries/RateLimiter.sol
index 7259587ef..3eba96e54 100644
--- a/evm/src/libraries/RateLimiter.sol
+++ b/evm/src/libraries/RateLimiter.sol
@@ -9,10 +9,8 @@ import "../libraries/TrimmedAmount.sol";
 
 abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
     using TrimmedAmountLib for TrimmedAmount;
-    /**
-     * @dev The duration it takes for the limits to fully replenish
-     */
 
+    /// @dev The duration (in seconds) it takes for the limits to fully replenish.
     uint64 public immutable rateLimitDuration;
 
     /// =============== STORAGE ===============================================

From fcca13a0c95457b59613ea088bad933e86c69f3e Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 10:27:38 -0500
Subject: [PATCH 2/9] evm: add natspec for ITransceiver.sol

---
 evm/src/interfaces/ITransceiver.sol | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/evm/src/interfaces/ITransceiver.sol b/evm/src/interfaces/ITransceiver.sol
index fea796b11..0480137db 100644
--- a/evm/src/interfaces/ITransceiver.sol
+++ b/evm/src/interfaces/ITransceiver.sol
@@ -5,10 +5,35 @@ import "../libraries/TransceiverStructs.sol";
 
 interface ITransceiver {
     /// @notice The caller is not the deployer.
+    /// @dev Selector: 0xc68a0e42.
+    /// @param deployer The address of the deployer.
+    /// @param caller The address of the caller.
     error UnexpectedDeployer(address deployer, address caller);
+
+    /// @notice The caller is not the NttManager.
+    /// @dev Selector: 0xc5aa6153.
+    /// @param caller The address of the caller.
     error CallerNotNttManager(address caller);
+
+    /// @notice Error when trying renounce transceiver ownership.
+    ///         Ensures the owner of the transceiver is in sync with
+    ///         the owner of the NttManager.
+    /// @dev Selector: 0x66791dd6.
+    /// @param currentOwner he current owner of the transceiver.
+    /// @param newOwner The new owner of the transceiver.
     error CannotRenounceTransceiverOwnership(address currentOwner);
+
+    /// @notice Error when trying to transfer transceiver ownership.
+    /// @dev Selector: 0x306239eb.
+    /// @param currentOwner The current owner of the transceiver.
+    /// @param newOwner The new owner of the transceiver.
     error CannotTransferTransceiverOwnership(address currentOwner, address newOwner);
+
+    /// @notice Error when the recipient NttManager address is not the
+    ///         corresponding manager of the transceiver.
+    /// @dev Selector: 0x73bdd322.
+    /// @param recipientNttManagerAddress The address of the recipient NttManager.
+    /// @param expectedRecipientNttManagerAddress The expected address of the recipient NttManager.
     error UnexpectedRecipientNttManagerAddress(
         bytes32 recipientNttManagerAddress, bytes32 expectedRecipientNttManagerAddress
     );
@@ -16,9 +41,9 @@ interface ITransceiver {
     /// @notice Fetch the delivery price for a given recipient chain transfer.
     /// @param recipientChain The Wormhole chain ID of the target chain.
     /// @param instruction An additional Instruction provided by the Transceiver to be
-    /// executed on the recipient chain.
+    ///        executed on the recipient chain.
     /// @return deliveryPrice The cost of delivering a message to the recipient chain,
-    /// in this chain's native token.
+    ///         in this chain's native token.
     function quoteDeliveryPrice(
         uint16 recipientChain,
         TransceiverStructs.TransceiverInstruction memory instruction

From ae5f5d87e71a45f567f8cc535009a6bc31db1adf Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 10:28:18 -0500
Subject: [PATCH 3/9] evm: modify natspec indentation for INttManager.sol

---
 evm/src/interfaces/INttManager.sol | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/evm/src/interfaces/INttManager.sol b/evm/src/interfaces/INttManager.sol
index 18e567783..ae61e672a 100644
--- a/evm/src/interfaces/INttManager.sol
+++ b/evm/src/interfaces/INttManager.sol
@@ -40,8 +40,8 @@ interface INttManager is INttManagerState {
     error DeliveryPaymentTooLow(uint256 requiredPayment, uint256 providedPayment);
 
     //// @notice The transfer has some dust.
-    //// @dev    This is a security measure to prevent users from losing funds.
-    ////         This is the result of trimming the amount and then untrimming it.
+    //// @dev This is a security measure to prevent users from losing funds.
+    ////      This is the result of trimming the amount and then untrimming it.
     //// @param  amount The amount to transfer.
     error TransferAmountHasDust(uint256 amount, uint256 dust);
 
@@ -87,9 +87,9 @@ interface INttManager is INttManagerState {
     error BurnAmountDifferentThanBalanceDiff(uint256 burnAmount, uint256 balanceDiff);
 
     /// @notice Transfer a given amount to a recipient on a given chain. This function is called
-    /// by the user to send the token cross-chain. This function will either lock or burn the
-    /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
-    /// to send a message with the incrementing sequence number and the token transfer payload.
+    ///         by the user to send the token cross-chain. This function will either lock or burn the
+    ///         sender's tokens. Finally, this function will call into registered `Endpoint` contracts
+    ///         to send a message with the incrementing sequence number and the token transfer payload.
     /// @param amount The amount to transfer.
     /// @param recipientChain The chain ID for the destination.
     /// @param recipient The recipient address.
@@ -100,9 +100,9 @@ interface INttManager is INttManagerState {
     ) external payable returns (uint64 msgId);
 
     /// @notice Transfer a given amount to a recipient on a given chain. This function is called
-    /// by the user to send the token cross-chain. This function will either lock or burn the
-    /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
-    /// to send a message with the incrementing sequence number and the token transfer payload.
+    ///         by the user to send the token cross-chain. This function will either lock or burn the
+    ///         sender's tokens. Finally, this function will call into registered `Endpoint` contracts
+    ///         to send a message with the incrementing sequence number and the token transfer payload.
     /// @dev Transfers are queued if the outbound limit is hit and must be completed by the client.
     /// @param amount The amount to transfer.
     /// @param recipientChain The chain ID for the destination.
@@ -141,8 +141,8 @@ interface INttManager is INttManagerState {
 
     /// @notice Called by an Endpoint contract to deliver a verified attestation.
     /// @dev This function enforces attestation threshold and replay logic for messages. Once all
-    /// validations are complete, this function calls `executeMsg` to execute the command specified
-    /// by the message.
+    ///      validations are complete, this function calls `executeMsg` to execute the command specified
+    ///      by the message.
     /// @param sourceChainId The chain id of the sender.
     /// @param sourceNttManagerAddress The address of the sender's nttManager contract.
     /// @param payload The VAA payload.
@@ -152,11 +152,11 @@ interface INttManager is INttManagerState {
         TransceiverStructs.NttManagerMessage memory payload
     ) external;
 
-    /// @notice Called after a message has been sufficiently verified to execute the command in the message.
-    /// This function will decode the payload as an NttManagerMessage to extract the sequence, msgType,
-    /// and other parameters.
+    /// @notice Called after a message has been sufficiently verified to execute
+    ///         the command in the message. This function will decode the payload
+    ///         as an NttManagerMessage to extract the sequence, msgType, and other parameters.
     /// @dev This function is exposed as a fallback for when an `Transceiver` is deregistered
-    /// when a message is in flight.
+    ///      when a message is in flight.
     /// @param sourceChainId The chain id of the sender.
     /// @param sourceNttManagerAddress The address of the sender's nttManager contract.
     /// @param message The message to execute.

From 0257501ee386a55b5224708d0e670b7c28581193 Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 10:49:05 -0500
Subject: [PATCH 4/9] evm: add natspec to transceiver registry

---
 evm/src/NttManager/TransceiverRegistry.sol | 31 +++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/evm/src/NttManager/TransceiverRegistry.sol b/evm/src/NttManager/TransceiverRegistry.sol
index b6ed0cc6b..4645189fe 100644
--- a/evm/src/NttManager/TransceiverRegistry.sol
+++ b/evm/src/NttManager/TransceiverRegistry.sol
@@ -1,7 +1,14 @@
 // SPDX-License-Identifier: Apache 2
 pragma solidity >=0.8.8 <0.9.0;
 
-/// @dev This contract is responsible for handling the registration of Transceivers.
+/// @title TransceiverRegistry
+/// @author Wormhole Project Contributors.
+/// @notice This contract is responsible for handling the registration of Transceivers.
+/// edev This contract a few critical invariants hold when transceivers are added or removed,
+///      including:
+///         1. if a transceiver is not registered, it should be enabled.
+///         2. The value set in the bitmap of trannsceivers
+///            should directly correspond to the whether the transceiver is enabled
 abstract contract TransceiverRegistry {
     constructor() {
         _checkTransceiversInvariants();
@@ -33,11 +40,33 @@ abstract contract TransceiverRegistry {
 
     uint8 constant MAX_TRANSCEIVERS = 64;
 
+    /// @notice Error when the caller is not the transceiver.
+    /// @dev Selector 0xa0ae911d.
+    /// @param caller The address of the caller.
     error CallerNotTransceiver(address caller);
+
+    /// @notice Error when the transceiver is the zero address.
+    /// @dev Selector 0x2f44bd77.
     error InvalidTransceiverZeroAddress();
+
+    /// @notice Error when the transceiver is disabled.
+    /// @dev Selector 0x1f61ba44.
     error DisabledTransceiver(address transceiver);
+
+    /// @notice Error when the number of registered transceivers
+    ///         exceeeds (MAX_TRANSCEIVERS = 64).
+    /// @dev Selector 0x891684c3.
     error TooManyTransceivers();
+
+    /// @notice Error when attempting to remove a transceiver
+    ///         that is not registered.
+    /// @dev Selector 0xd583f470.
+    /// @param transceiver The address of the transceiver.
     error NonRegisteredTransceiver(address transceiver);
+
+    /// @notice Error when attempting to enable a transceiver that is already enabled.
+    /// @dev Selector 0x8d68f84d.
+    /// @param transceiver The address of the transceiver.
     error TransceiverAlreadyEnabled(address transceiver);
 
     modifier onlyTransceiver() {

From d3567a2a12c6a48b9e31c443c41fcac333997b44 Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 10:57:39 -0500
Subject: [PATCH 5/9] evm: add natspec to WormholeTransceiver.sol

---
 .../WormholeTransceiver/WormholeTransceiver.sol      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
index fafe76a3e..5c40fe7b3 100644
--- a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
+++ b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
@@ -14,6 +14,18 @@ import "../../interfaces/INttManager.sol";
 
 import "./WormholeTransceiverState.sol";
 
+/// @title WormholeTransceiver
+/// @author Wormhole Project Contributors.
+/// @notice Transceiver implementation for the Wormhole.
+///
+/// @dev This contract is responsible for sending and receiving NTT messages
+///      that are authenticated through Wormhole Core.
+///
+/// @dev Messages can be delivered either via standard relaying or special relaying, or
+///      manually via the core layer.
+///
+/// @dev Once a message is received, it is delivered to its corresponding
+///      NttManager contract.
 contract WormholeTransceiver is
     IWormholeTransceiver,
     IWormholeReceiver,

From e1505e70454ce63f9d12d81dc23c4cca781a1bd8 Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 11:03:46 -0500
Subject: [PATCH 6/9] evm: add author tags

---
 evm/src/NttManager/NttManager.sol   | 1 +
 evm/src/Transceiver/Transceiver.sol | 1 +
 2 files changed, 2 insertions(+)

diff --git a/evm/src/NttManager/NttManager.sol b/evm/src/NttManager/NttManager.sol
index 8f3f8958e..ee02a0b6e 100644
--- a/evm/src/NttManager/NttManager.sol
+++ b/evm/src/NttManager/NttManager.sol
@@ -18,6 +18,7 @@ import "../interfaces/ITransceiver.sol";
 import {NttManagerState} from "./NttManagerState.sol";
 
 /// @title NttManager
+/// @author Wormhole Project Contributors.
 /// @notice The NttManager contract is responsible for managing the token
 ///         and associated transceivers.
 ///
diff --git a/evm/src/Transceiver/Transceiver.sol b/evm/src/Transceiver/Transceiver.sol
index d5115190c..9f1e757ea 100644
--- a/evm/src/Transceiver/Transceiver.sol
+++ b/evm/src/Transceiver/Transceiver.sol
@@ -12,6 +12,7 @@ import "../interfaces/INttManager.sol";
 import "../interfaces/ITransceiver.sol";
 
 /// @title Transceiver
+/// @author Wormhole Project Contributors.
 /// @notice This contract is a base contract for Transceivers.
 /// @dev The Transceiver provides basic functionality for transmitting / receiving NTT messages.
 ///      The contract supports pausing via an admin or owner and is upgradable.

From f246034fb6a749d749462f66270cff03811d2acb Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 12:01:31 -0500
Subject: [PATCH 7/9] evm: fix errors

---
 evm/src/NttManager/TransceiverRegistry.sol | 4 ++--
 evm/src/interfaces/INttManager.sol         | 4 ++--
 evm/src/interfaces/ITransceiver.sol        | 1 -
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/evm/src/NttManager/TransceiverRegistry.sol b/evm/src/NttManager/TransceiverRegistry.sol
index 4645189fe..e4585c207 100644
--- a/evm/src/NttManager/TransceiverRegistry.sol
+++ b/evm/src/NttManager/TransceiverRegistry.sol
@@ -4,9 +4,9 @@ pragma solidity >=0.8.8 <0.9.0;
 /// @title TransceiverRegistry
 /// @author Wormhole Project Contributors.
 /// @notice This contract is responsible for handling the registration of Transceivers.
-/// edev This contract a few critical invariants hold when transceivers are added or removed,
+/// @dev This contract checks that a few critical invariants hold when transceivers are added or removed,
 ///      including:
-///         1. if a transceiver is not registered, it should be enabled.
+///         1. If a transceiver is not registered, it should be enabled.
 ///         2. The value set in the bitmap of trannsceivers
 ///            should directly correspond to the whether the transceiver is enabled
 abstract contract TransceiverRegistry {
diff --git a/evm/src/interfaces/INttManager.sol b/evm/src/interfaces/INttManager.sol
index ae61e672a..d170ddbeb 100644
--- a/evm/src/interfaces/INttManager.sol
+++ b/evm/src/interfaces/INttManager.sol
@@ -58,7 +58,7 @@ interface INttManager is INttManagerState {
     ///         To ensure the client does not continue to initiate calls to the ateestationReceived function.
     /// @dev Selector 0x2113894.
     /// @param nttManagerMessageHash The hash of the message.
-    error TrasceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
+    error TransceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
 
     /// @notice Error when the message is not approved.
     /// @dev Selector 0x451c4fb0.
@@ -79,7 +79,7 @@ interface INttManager is INttManagerState {
     /// @dev Selector 0x9c8d2cd2.
     error InvalidRecipient();
 
-    /// @@notice Error when the amount burned is different than the balance difference,
+    /// @notice Error when the amount burned is different than the balance difference,
     ///          since NTT does not support burn fees.
     /// @dev Selector 0x02156a8f.
     /// @param burnAmount The amount burned.
diff --git a/evm/src/interfaces/ITransceiver.sol b/evm/src/interfaces/ITransceiver.sol
index 0480137db..deff48aca 100644
--- a/evm/src/interfaces/ITransceiver.sol
+++ b/evm/src/interfaces/ITransceiver.sol
@@ -20,7 +20,6 @@ interface ITransceiver {
     ///         the owner of the NttManager.
     /// @dev Selector: 0x66791dd6.
     /// @param currentOwner he current owner of the transceiver.
-    /// @param newOwner The new owner of the transceiver.
     error CannotRenounceTransceiverOwnership(address currentOwner);
 
     /// @notice Error when trying to transfer transceiver ownership.

From b45aab35799a1ad4b7a5bbbe05b54d100567135c Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 15:12:02 -0500
Subject: [PATCH 8/9] evm: fix indentation + spelling

---
 .../Transceiver/WormholeTransceiver/WormholeTransceiver.sol   | 2 +-
 evm/src/interfaces/INttManager.sol                            | 4 ++--
 evm/src/interfaces/IWormholeTransceiver.sol                   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
index 5c40fe7b3..2c7e366e4 100644
--- a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
+++ b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol
@@ -16,7 +16,7 @@ import "./WormholeTransceiverState.sol";
 
 /// @title WormholeTransceiver
 /// @author Wormhole Project Contributors.
-/// @notice Transceiver implementation for the Wormhole.
+/// @notice Transceiver implementation for Wormhole.
 ///
 /// @dev This contract is responsible for sending and receiving NTT messages
 ///      that are authenticated through Wormhole Core.
diff --git a/evm/src/interfaces/INttManager.sol b/evm/src/interfaces/INttManager.sol
index d170ddbeb..3bf1b3eac 100644
--- a/evm/src/interfaces/INttManager.sol
+++ b/evm/src/interfaces/INttManager.sol
@@ -55,7 +55,7 @@ interface INttManager is INttManagerState {
     error RefundFailed(uint256 refundAmount);
 
     /// @notice Error when the tranceiver already attested to the message.
-    ///         To ensure the client does not continue to initiate calls to the ateestationReceived function.
+    ///         To ensure the client does not continue to initiate calls to the attestationReceived function.
     /// @dev Selector 0x2113894.
     /// @param nttManagerMessageHash The hash of the message.
     error TransceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
@@ -80,7 +80,7 @@ interface INttManager is INttManagerState {
     error InvalidRecipient();
 
     /// @notice Error when the amount burned is different than the balance difference,
-    ///          since NTT does not support burn fees.
+    ///         since NTT does not support burn fees.
     /// @dev Selector 0x02156a8f.
     /// @param burnAmount The amount burned.
     /// @param balanceDiff The balance after burning.
diff --git a/evm/src/interfaces/IWormholeTransceiver.sol b/evm/src/interfaces/IWormholeTransceiver.sol
index 919675ead..ba2de4dd2 100644
--- a/evm/src/interfaces/IWormholeTransceiver.sol
+++ b/evm/src/interfaces/IWormholeTransceiver.sol
@@ -57,13 +57,13 @@ interface IWormholeTransceiver is IWormholeTransceiverState {
     error TransferAlreadyCompleted(bytes32 vaaHash);
 
     /// @notice Receive an attested message from the verification layer.
-    /// This function should verify the `encodedVm` and then deliver the attestation
+    ///         This function should verify the `encodedVm` and then deliver the attestation
     /// to the transceiver NttManager contract.
     /// @param encodedMessage The attested message.
     function receiveMessage(bytes memory encodedMessage) external;
 
     /// @notice Parses the encoded instruction and returns the instruction struct.
-    /// This instruction is specific to the WormholeTransceiver contract.
+    ///         This instruction is specific to the WormholeTransceiver contract.
     /// @param encoded The encoded instruction.
     /// @return instruction The parsed `WormholeTransceiverInstruction`.
     function parseWormholeTransceiverInstruction(bytes memory encoded)

From 3a5f3d0e6544bad6ba9d732ab1b30be7fc9111c7 Mon Sep 17 00:00:00 2001
From: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
Date: Tue, 5 Mar 2024 15:12:02 -0500
Subject: [PATCH 9/9] evm: reword bytes -> bits

---
 evm/src/libraries/TrimmedAmount.sol | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/evm/src/libraries/TrimmedAmount.sol b/evm/src/libraries/TrimmedAmount.sol
index 2d802f9c1..d0d52af18 100644
--- a/evm/src/libraries/TrimmedAmount.sol
+++ b/evm/src/libraries/TrimmedAmount.sol
@@ -3,8 +3,8 @@
 pragma solidity >=0.8.8 <0.9.0;
 
 /// @dev TrimmedAmount is a bit-packed representation of a token amount and its decimals.
-/// @dev 64 bytes: [0 - 64] amount
-/// @dev 8 bytes: [64 - 72] decimals
+/// @dev 64 bits: [0 - 64] amount
+/// @dev 8 bits: [64 - 72] decimals
 type TrimmedAmount is uint72;
 
 using {gt as >, lt as <, sub as -, add as +, eq as ==, min, unwrap} for TrimmedAmount global;