Skip to content

Commit

Permalink
Merge pull request #24 from LayerZero-Labs/max-payload-size
Browse files Browse the repository at this point in the history
Added max payload size check
  • Loading branch information
calebbanister authored Feb 4, 2023
2 parents 9bd53b6 + 7d07e87 commit 48c21c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/RelayerV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe
}

function getFee(uint16 _dstChainId, uint16 _outboundProofType, address _userApplication, uint _payloadSize, bytes calldata _adapterParams) external view override returns (uint) {
require(_payloadSize <= 10000, "Relayer: _payloadSize tooooo big");
(uint basePrice, uint pricePerByte) = _getPrices(_dstChainId, _outboundProofType, _userApplication, _adapterParams);
return basePrice.add(_payloadSize.mul(pricePerByte));
}
Expand All @@ -147,6 +148,7 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe

function assignJob(uint16 _dstChainId, uint16 _outboundProofType, address _userApplication, uint _payloadSize, bytes calldata _adapterParams) external override returns (uint) {
require(msg.sender == address(uln), "Relayer: invalid uln");
require(_payloadSize <= 10000, "Relayer: _payloadSize tooooo big");
(uint basePrice, uint pricePerByte) = _getPrices(_dstChainId, _outboundProofType, _userApplication, _adapterParams);
uint totalFee = basePrice.add(_payloadSize.mul(pricePerByte));
emit AssignJob(totalFee);
Expand Down

0 comments on commit 48c21c3

Please sign in to comment.