The functions receivePacket()
and _processMessageFromRoot()
allow receiving the same packetId_
multiple times.
I would have expected that if a value exists, it can't be overwritten. If the current behaviour is considered a feature then if would be good to add a comment.
The functions receivePacket()
and _processMessageFromRoot()
allow receiving the same packetId_
multiple times.
If the same packetId_
is send twice then packetIdToRoot[packetId_]
is overwritten.
Normally the second value for root_
would be the same as the previous, but if problems would occur elsewhere this might not be the case.
NativeSwitchboardBase.sol#L210-L216:
function receivePacket(...) ... {
packetIdToRoot[packetId_] = root_; // no check if a value is already present
...
}
PolygonL2Switchboard.sol#L112-L123:
function _processMessageFromRoot(...) ... {
(bytes32 packetId, bytes32 root) = abi.decode(
data_,
(bytes32, bytes32)
);
packetIdToRoot[packetId] = root; // no check if a value is already present
...
}