Skip to content

Commit

Permalink
Merge branch 'ccip-develop' into monitoring/bring-back-prom-for-contr…
Browse files Browse the repository at this point in the history
…acts
  • Loading branch information
mateusz-sekara authored Oct 13, 2023
2 parents 1a54dc6 + e5baca5 commit fdc39d0
Show file tree
Hide file tree
Showing 24 changed files with 498 additions and 485 deletions.
188 changes: 94 additions & 94 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio
struct DynamicConfig {
uint32 permissionLessExecutionThresholdSeconds; // ─╮ Waiting time before manual execution is enabled
address router; // ─────────────────────────────────╯ Router address
address priceRegistry; // ─────╮ Price registry address
uint16 maxTokensLength; // │ Maximum number of ERC20 token transfers that can be included per message
uint32 maxDataSize; // │ Maximum payload data size
uint32 maxPoolGas; // ─────────╯ Maximum amount of gas passed on to token pool when calling releaseOrMint
address priceRegistry; // ──────────╮ Price registry address
uint16 maxNumberOfTokensPerMsg; // │ Maximum number of ERC20 token transfers that can be included per message
uint32 maxDataBytes; // │ Maximum payload data size in bytes
uint32 maxPoolReleaseOrMintGas; // ─╯ Maximum amount of gas passed on to token pool when calling releaseOrMint
}

// STATIC CONFIG
Expand Down Expand Up @@ -374,10 +374,11 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio
uint256 offchainTokenDataLength
) private view {
if (sourceChainSelector != i_sourceChainSelector) revert InvalidSourceChain(sourceChainSelector);
if (numberOfTokens > uint256(s_dynamicConfig.maxTokensLength)) revert UnsupportedNumberOfTokens(sequenceNumber);
if (numberOfTokens > uint256(s_dynamicConfig.maxNumberOfTokensPerMsg))
revert UnsupportedNumberOfTokens(sequenceNumber);
if (numberOfTokens != offchainTokenDataLength) revert TokenDataMismatch(sequenceNumber);
if (dataLength > uint256(s_dynamicConfig.maxDataSize))
revert MessageTooLarge(uint256(s_dynamicConfig.maxDataSize), dataLength);
if (dataLength > uint256(s_dynamicConfig.maxDataBytes))
revert MessageTooLarge(uint256(s_dynamicConfig.maxDataBytes), dataLength);
}

/// @notice Try executing a message.
Expand Down Expand Up @@ -608,7 +609,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio
abi.encode(sourceTokenData[i], offchainTokenData[i])
),
address(pool),
s_dynamicConfig.maxPoolGas,
s_dynamicConfig.maxPoolReleaseOrMintGas,
Internal.MAX_RET_BYTES,
Internal.GAS_FOR_CALL_EXACT_CHECK
);
Expand Down
153 changes: 78 additions & 75 deletions contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions contracts/src/v0.8/ccip/test/StructFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ contract StructFactory {
(32 * 34 + 4) *
DEST_GAS_PER_DATA_AVAILABILITY_BYTE; // OffRamp transmission excluding EVM2EVMMessage takes up about 34 slots, plus selector.

// Multiples of 0.0001, use 6840 for OP, same as OP mainnet 0.684.
uint16 internal constant DEST_GAS_DATA_AVAILABILITY_MULTIPLIER = 6840;
// Multiples of bps, or 0.0001, use 6840 to be same as OP mainnet compression factor of 0.684.
uint16 internal constant DEST_GAS_DATA_AVAILABILITY_MULTIPLIER_BPS = 6840;

// OffRamp
uint256 internal constant POOL_BALANCE = 1e25;
Expand All @@ -132,9 +132,9 @@ contract StructFactory {
permissionLessExecutionThresholdSeconds: PERMISSION_LESS_EXECUTION_THRESHOLD_SECONDS,
router: router,
priceRegistry: priceRegistry,
maxTokensLength: MAX_TOKENS_LENGTH,
maxDataSize: MAX_DATA_SIZE,
maxPoolGas: MAX_TOKEN_POOL_RELEASE_OR_MINT_GAS
maxNumberOfTokensPerMsg: MAX_TOKENS_LENGTH,
maxDataBytes: MAX_DATA_SIZE,
maxPoolReleaseOrMintGas: MAX_TOKEN_POOL_RELEASE_OR_MINT_GAS
});
}

Expand All @@ -145,15 +145,15 @@ contract StructFactory {
return
EVM2EVMOnRamp.DynamicConfig({
router: router,
maxTokensLength: MAX_TOKENS_LENGTH,
maxNumberOfTokensPerMsg: MAX_TOKENS_LENGTH,
destGasOverhead: DEST_GAS_OVERHEAD,
destGasPerPayloadByte: DEST_GAS_PER_PAYLOAD_BYTE,
destDataAvailabilityOverheadGas: DEST_DATA_AVAILABILITY_OVERHEAD_GAS,
destGasPerDataAvailabilityByte: DEST_GAS_PER_DATA_AVAILABILITY_BYTE,
destDataAvailabilityMultiplier: DEST_GAS_DATA_AVAILABILITY_MULTIPLIER,
destDataAvailabilityMultiplierBps: DEST_GAS_DATA_AVAILABILITY_MULTIPLIER_BPS,
priceRegistry: priceRegistry,
maxDataSize: MAX_DATA_SIZE,
maxGasLimit: MAX_GAS_LIMIT
maxDataBytes: MAX_DATA_SIZE,
maxPerMsgGasLimit: MAX_GAS_LIMIT
});
}

Expand Down
9 changes: 2 additions & 7 deletions contracts/src/v0.8/ccip/test/helpers/EVM2EVMOnRampHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,14 @@ contract EVM2EVMOnRampHelper is EVM2EVMOnRamp, IgnoreContractSize {
)
{}

function getDataAvailabilityCostUSD(
function getDataAvailabilityCost(
uint112 dataAvailabilityGasPrice,
uint256 messageDataLength,
uint256 numberOfTokens,
uint32 tokenTransferBytesOverhead
) external view returns (uint256) {
return
_getDataAvailabilityCostUSD(
dataAvailabilityGasPrice,
messageDataLength,
numberOfTokens,
tokenTransferBytesOverhead
);
_getDataAvailabilityCost(dataAvailabilityGasPrice, messageDataLength, numberOfTokens, tokenTransferBytesOverhead);
}

function getTokenTransferCost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ contract EVM2EVMOffRampSetup is TokenSetup, PriceRegistrySetup, OCR2BaseSetup {
assertEq(a.permissionLessExecutionThresholdSeconds, b.permissionLessExecutionThresholdSeconds);
assertEq(a.router, b.router);
assertEq(a.priceRegistry, b.priceRegistry);
assertEq(a.maxTokensLength, b.maxTokensLength);
assertEq(a.maxDataSize, b.maxDataSize);
assertEq(a.maxPoolGas, b.maxPoolGas);
assertEq(a.maxNumberOfTokensPerMsg, b.maxNumberOfTokensPerMsg);
assertEq(a.maxDataBytes, b.maxDataBytes);
assertEq(a.maxPoolReleaseOrMintGas, b.maxPoolReleaseOrMintGas);
}
}
Loading

0 comments on commit fdc39d0

Please sign in to comment.