Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCIP-4687 Support Solana in the FeeQuoter #15811

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

jhweintraub
Copy link
Collaborator

Add Solana Support to the FeeQuoter by adding

  1. New Family Chain Selector CHAIN_FAMILY_SELECTOR_SOL
  2. New SOL_EXTRA_EXTRA_ARGS_V1_TAG
  3. Adding parsing support and control flow logic for both of the above.

@jhweintraub jhweintraub requested a review from a team as a code owner December 27, 2024 18:47
Copy link
Contributor

github-actions bot commented Dec 27, 2024

Solidity Review Jira issue

Hey! We have taken the liberty to link this PR to a Jira issue for Solidity Review.

This is a new feature, that's currently in the pilot phase, so please make sure that the linkage is correct. In a contrary case, please update it manually in JIRA and replace Solidity Review issue key in the changeset file with the correct one.
Please reach out to the Test Tooling team and notify them about any issues you encounter.

Any changes to the Solidity Review Jira issue should be reflected in the changeset file. If you need to update the issue key, please do so manually in the following changeset file: contracts/.changeset/clean-horses-cheat.md

This PR has been linked to Solidity Review Jira issue: CCIP-3966

Copy link
Contributor

github-actions bot commented Dec 27, 2024

Static analysis results are available

Hey @jhweintraub, you can view Slither reports in the job summary here or download them as artifact here.
Please check them before merging and make sure you have addressed all issues.

Copy link
Contributor

github-actions bot commented Dec 27, 2024

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , GolangCI Lint (.) , test-scripts , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , lint , SonarQube Scan

1. Max code size exceeded:[go_core_ccip_deployment_tests]

Source of Error:
Run tests	2025-01-06T15:19:32.0918221Z logger.go:146: 15:19:29.982106107	ERROR	Failed to deploy contract	{"chain": " (789068866484373046)", "err": "max code size exceeded"}
Run tests	2025-01-06T15:19:32.0919176Z logger.go:146: 15:19:29.982126195	ERROR	Failed to deploy fee quoter	{"chain": " (789068866484373046)", "err": "max code size exceeded"}
Run tests	2025-01-06T15:19:32.0920230Z logger.go:146: 15:19:29.982138988	ERROR	Failed to deploy chain contracts	{"chain": 789068866484373046, "err": "max code size exceeded"}
Run tests	2025-01-06T15:19:32.0921416Z logger.go:146: 15:19:29.986706405	ERROR	Failed to deploy chain contracts	{"err": "failed to deploy chain contracts for chain 789068866484373046: max code size exceeded"}
Run tests	2025-01-06T15:19:32.0929892Z logger.go:146: 15:19:29.986720291	ERROR	Failed to deploy CCIP contracts	{"err": "failed to deploy chain contracts for chain 789068866484373046: max code size exceeded", "newAddresses": {}}
Run tests	2025-01-06T15:19:32.0931397Z 	Error Trace:	/home/runner/work/chainlink/chainlink/deployment/ccip/changeset/test_environment.go:458
Run tests	2025-01-06T15:19:32.0932725Z 	 				/home/runner/work/chainlink/chainlink/deployment/ccip/changeset/test_environment.go:312
Run tests	2025-01-06T15:19:32.0933926Z 	 				/home/runner/work/chainlink/chainlink/deployment/ccip/changeset/view_test.go:11
Run tests	2025-01-06T15:19:32.0934509Z 	Error: 	Received unexpected error:
Run tests	2025-01-06T15:19:32.0935323Z 	 	failed to apply changeset at index 3: max code size exceeded: <nil>
Run tests	2025-01-06T15:19:32.0935796Z 	Test: 	TestSmokeView

Why: The error "max code size exceeded" indicates that the size of the smart contract code being deployed exceeds the maximum allowed size for the blockchain network. This is a common limitation in Ethereum and other EVM-compatible blockchains to prevent excessively large contracts from being deployed, which could lead to performance issues.

Suggested fix: To resolve this issue, consider optimizing the smart contract code to reduce its size. This can include removing unnecessary code, using libraries efficiently, and splitting the contract into smaller, modular contracts if possible. Additionally, ensure that the deployment scripts are correctly configured to handle the optimized contracts.

2. Max code size exceeded:[go_core_tests]

Source of Error:
Run tests	2025-01-06T15:22:36.2894800Z --- FAIL: TestDeployAllV1_6 (0.07s)
Run tests	2025-01-06T15:22:36.2895318Z deployment_test.go:87: 
Run tests	2025-01-06T15:22:36.2899973Z 	Error Trace:	/home/runner/work/chainlink/chainlink/core/gethwrappers/ccip/deployment_test/deployment_test.go:87
Run tests	2025-01-06T15:22:36.2900978Z 	Error: 	Received unexpected error:
Run tests	2025-01-06T15:22:36.2901592Z 	 	max code size exceeded
Run tests	2025-01-06T15:22:36.2902946Z 	Test: 	TestDeployAllV1_6

Why: Similar to the previous error, this indicates that the smart contract code size exceeds the maximum allowed limit for deployment on the blockchain network.

Suggested fix: Apply the same optimizations as suggested for the previous error. Focus on reducing the contract size by optimizing the code, removing redundancies, and possibly splitting the contract into smaller, more manageable pieces. Ensure that the deployment scripts are updated to handle these changes.

AER Report: Operator UI CI

aer_workflow , commit , Breaking Changes GQL Check

1. Submodule path URL not found: Breaking Changes GQL Check

Source of Error:
Checkout repository	2025-01-07T15:03:39.5549208Z ##[error]fatal: No url found for submodule path 'contracts/foundry-lib/forge-std' in .gitmodules
Checkout repository	2025-01-07T15:03:39.5579283Z ##[error]The process '/usr/bin/git' failed with exit code 128

Why: The error occurs because the submodule path 'contracts/foundry-lib/forge-std' does not have a URL specified in the .gitmodules file. This is required for Git to fetch the submodule.

Suggested fix: Ensure that the .gitmodules file includes a valid URL for the 'contracts/foundry-lib/forge-std' submodule. Add the URL if it is missing or correct it if it is incorrect.

contracts/src/v0.8/ccip/FeeQuoter.sol Show resolved Hide resolved
contracts/src/v0.8/ccip/FeeQuoter.sol Outdated Show resolved Hide resolved
contracts/src/v0.8/ccip/FeeQuoter.sol Outdated Show resolved Hide resolved

bytes memory argsData = extraArgs[4:];

Client.SolExtraArgsV1 memory solExtraArgs = abi.decode(argsData, (Client.SolExtraArgsV1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can return, don't need to assign

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need to check the validity of the computeUnits?

// Prevents a stack too deep error on messageData
{
bytes memory data = messageData;
(convertedExtraArgs, isOutOfOrderExecution) = _processChainFamilySelector(destChainSelector, data, extraArgs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the length is ever used, it's a lot cheaper to pass in a single length property

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we don't have to check for message length though we can remove this anyways

contracts/src/v0.8/ccip/FeeQuoter.sol Outdated Show resolved Hide resolved
contracts/src/v0.8/ccip/FeeQuoter.sol Outdated Show resolved Hide resolved
SolanaAccountMeta[] accounts;
}

struct SolanaAccountMeta {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels pretty expensive as we use 33 bytes per account. We could consider the writability as a bool encoding into a digit?

contracts/src/v0.8/ccip/libraries/Internal.sol Outdated Show resolved Hide resolved
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@jhweintraub jhweintraub requested a review from a team as a code owner January 6, 2025 16:02
# Conflicts:
#	core/gethwrappers/ccip/generated/fee_quoter/fee_quoter.go
#	core/gethwrappers/ccip/generated/onramp/onramp.go
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants