Skip to content

Commit 3d93054

Browse files
committed
evm: Per chain transceivers
1 parent d1ac2a8 commit 3d93054

File tree

2 files changed

+384
-6
lines changed

2 files changed

+384
-6
lines changed

evm/src/NttManager/ManagerBase.sol

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,20 @@ abstract contract ManagerBase is
139139
bytes32 nttManagerMessageHash =
140140
TransceiverStructs.nttManagerMessageDigest(sourceChainId, payload);
141141

142+
// The `msg.sender` is the transceiver. Get the index for it.
143+
uint8 index = _getTransceiverInfosStorage()[msg.sender].index;
144+
145+
// If this transceiver is not enabled for this chain, ignore this attestation.
146+
// TODO: Is there a race condition with disabling a transceiver while a tx is outstanding?
147+
if (!_isRecvTransceiverEnabledForChain(sourceChainId, index)) {
148+
return nttManagerMessageHash;
149+
}
150+
142151
// set the attested flag for this transceiver.
143152
// NOTE: Attestation is idempotent (bitwise or 1), but we revert
144153
// anyway to ensure that the client does not continue to initiate calls
145154
// to receive the same message through the same transceiver.
146-
if (
147-
transceiverAttestedToMessage(
148-
nttManagerMessageHash, _getTransceiverInfosStorage()[msg.sender].index
149-
)
150-
) {
155+
if (transceiverAttestedToMessage(nttManagerMessageHash, index)) {
151156
revert TransceiverAlreadyAttestedToMessage(nttManagerMessageHash);
152157
}
153158
_setTransceiverAttestedToMessage(nttManagerMessageHash, msg.sender);
@@ -225,7 +230,7 @@ abstract contract ManagerBase is
225230
)
226231
{
227232
// cache enabled transceivers to avoid multiple storage reads
228-
address[] memory enabledTransceivers = _getEnabledTransceiversStorage();
233+
address[] memory enabledTransceivers = getEnabledSendTransceiversForChain(recipientChain);
229234

230235
TransceiverStructs.TransceiverInstruction[] memory instructions;
231236

0 commit comments

Comments
 (0)