axelarnetwork / support

Your source for support with the Axelar Network
3 stars 1 forks source link

Maximum Payload size that can be used ? #72

Closed Olanetsoft closed 9 months ago

Olanetsoft commented 9 months ago

What is the maximum payload size that I can use in sending a message using Axelar. Would love to know. Thanks

Olanetsoft commented 9 months ago

To send a message over the Axelar network, you interact with the Axelar Gateway contract (https://github.com/axelarnetwork/axelar-cgp-solidity/blob/main/contracts/AxelarGateway.sol). The key functions are callContract and callContractWithToken.

The payload parameter in these functions is defined as bytes calldata. This means the payload can contain arbitrary byte data; there is no fixed size limit set in the contract. The bytes type does not restrict the payload size. The practical limit comes from gas considerations on-chain - each byte of data costs additional gas.

So the maximum payload size will depend on the maximum gas limit of the block and how much gas you are willing to spend on the transaction. There is no hardcoded limit in the contract itself.

StephenFluin commented 9 months ago

@Olanetsoft Are you sure? You can pass multiple uint256s, each of which are 32 bytes.

Olanetsoft commented 9 months ago

That's correct @StephenFluin. I assumed the bytes type strictly defined the payload size here, which is incorrect. As you pointed out, the bytes type in Solidity can hold arbitrary data, and there is no strict limit to the payload size defined in the AxelarGateway contract.

I think the practical limitation comes down to gas costs since each byte of data passed into the contract takes additional gas. So the maximum payload size will be dependent on the maximum gas limit of the block/contract logic and how much gas the sender is able to pay for the transaction.

Olanetsoft commented 9 months ago

Response updated!