Comment a couple of optimization opportunities.

This commit is contained in:
Sebastián Claudio Nale 2023-02-17 14:42:08 -03:00 committed by scnale
parent a2bdeaffea
commit 315f0909c7
1 changed files with 3 additions and 1 deletions

View File

@ -271,6 +271,7 @@ contract CoreRelayer is CoreRelayerGovernance {
IRelayProvider selectedProvider = IRelayProvider(container.relayProviderAddress);
for (uint16 i = 0; i < container.requests.length; i++) {
// TODO: Optimization opportunity here by reducing multiple calls to only one with all requested addresses.
if (selectedProvider.getDeliveryAddress(container.requests[i].targetChain) == 0) {
revert RelayProviderDoesNotSupportTargetChain();
}
@ -926,7 +927,8 @@ contract CoreRelayer is CoreRelayerGovernance {
uint8(container.requests.length) //number of requests in the array
);
//Append all the messages to the array.
// TODO: this probably results in a quadratic algorithm. Further optimization can be done here.
// Append all the messages to the array.
for (uint256 i = 0; i < container.requests.length; i++) {
encoded = appendDeliveryInstruction(
encoded, container.requests[i], IRelayProvider(container.relayProviderAddress)