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-4223 bubble up revert for estimation #15504

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

Conversation

0xsuryansh
Copy link
Member

@0xsuryansh 0xsuryansh commented Dec 4, 2024

PR adds logic to bubble up the revert when gas estimation address Is address(1)

@0xsuryansh 0xsuryansh changed the title feat: fix estimation by adding a reverting clause CCIP-4223 fix estimation by adding a reverting clause Dec 4, 2024
Copy link
Contributor

github-actions bot commented Dec 4, 2024

Static analysis results are available

Hey @0xsuryansh, 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 4, 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/twelve-pianos-chew.md

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

Copy link
Contributor

github-actions bot commented Dec 4, 2024

AER Report: CI Core

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

1. Remote end closed connection without response:[go_core_tests]

Source of Error:
Run tests	2025-01-10T09:52:01.9969574Z raise RemoteDisconnected("Remote end closed connection without"
Run tests	2025-01-10T09:52:01.9970400Z http.client.RemoteDisconnected: Remote end closed connection without response
Run tests	2025-01-10T09:52:01.9971124Z panic: exit status 1
Run tests	2025-01-10T09:52:01.9971324Z 
Run tests	2025-01-10T09:52:01.9971524Z goroutine 1 [running]:
Run tests	2025-01-10T09:52:01.9972248Z github.com/smartcontractkit/chainlink/v2/core/gethwrappers.ensureArtifacts()
Run tests	2025-01-10T09:52:01.9973349Z 	/home/runner/work/chainlink/chainlink/core/gethwrappers/go_generate_test.go:140 +0x31e
Run tests	2025-01-10T09:52:01.9974143Z github.com/smartcontractkit/chainlink/v2/core/gethwrappers.TestMain(0xc0006361e0)
Run tests	2025-01-10T09:52:01.9975345Z 	/home/runner/work/chainlink/chainlink/core/gethwrappers/go_generate_test.go:108 +0x88
Run tests	2025-01-10T09:52:01.9975876Z main.main()
Run tests	2025-01-10T09:52:01.9976312Z 	_testmain.go:49 +0xa8

Why: The error occurred because the remote server closed the connection without sending a response. This could be due to network issues, server overload, or the server being down.

Suggested fix: Implement retry logic for network requests to handle transient network issues. Additionally, ensure the server is stable and capable of handling the load.

2. Encountered test failures:[go_core_tests]

Source of Error:
Run tests	2025-01-10T09:53:24.3332669Z Exit code: 1
Run tests	2025-01-10T09:53:24.3333179Z Encountered test failures.
Run tests	2025-01-10T09:53:24.3361483Z go_core_tests exiting with code 1
Run tests	2025-01-10T09:53:24.3375682Z ##[error]Process completed with exit code 1.

Why: The test suite encountered failures, which caused the process to exit with a non-zero status code. This indicates that some tests did not pass successfully.

Suggested fix: Review the test logs to identify the specific tests that failed and address the underlying issues. Ensure all dependencies and configurations are correct before rerunning the tests.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

# Conflicts:
#	contracts/gas-snapshots/ccip.gas-snapshot
#	core/gethwrappers/ccip/generated/multi_ocr3_helper/multi_ocr3_helper.go
#	core/gethwrappers/ccip/generated/offramp/offramp.go
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@0xsuryansh 0xsuryansh marked this pull request as ready for review December 9, 2024 12:34
@0xsuryansh 0xsuryansh requested a review from a team as a code owner December 9, 2024 12:34
@0xsuryansh 0xsuryansh requested a review from RensR December 9, 2024 12:35
@0xsuryansh 0xsuryansh requested review from a team as code owners December 9, 2024 13:05
Copy link
Contributor

github-actions bot commented Dec 9, 2024

Flakeguard Summary

Setting Value
Project github.com/smartcontractkit/chainlink/v2
Max Pass Ratio 100.00%
Test Run Count 3
Race Detection false
Excluded Tests TestChainComponents

Found Flaky Tests ❌

Category Total
Tests 1
Panicked Tests 0
Raced Tests 0
Flaky Tests 1
Flaky Test Ratio 100.00%
Runs 3
Passes 0
Failures 3
Skips 0
Pass Ratio 0.00%
Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployAllV1_6 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/deployment_test false 133.333333ms @smartcontractkit/ccip-onchain

@0xsuryansh 0xsuryansh changed the title CCIP-4223 fix estimation by adding a reverting clause CCIP-4223 bubble up revert for estimation Dec 9, 2024
# Conflicts:
#	contracts/gas-snapshots/ccip.gas-snapshot
#	core/gethwrappers/ccip/generated/multi_ocr3_helper/multi_ocr3_helper.go
#	core/gethwrappers/ccip/generated/offramp/offramp.go
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@0xsuryansh 0xsuryansh requested a review from jhweintraub January 6, 2025 11:19
# Conflicts:
#	core/gethwrappers/ccip/generated/multi_ocr3_helper/multi_ocr3_helper.go
#	core/gethwrappers/ccip/generated/offramp/offramp.go
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@0xsuryansh 0xsuryansh enabled auto-merge January 9, 2025 11:18
@@ -3,12 +3,17 @@ pragma solidity ^0.8.24;

import {Internal} from "../../../libraries/Internal.sol";
import {RateLimiter} from "../../../libraries/RateLimiter.sol";
import {MultiOCR3Base} from "../../../ocr/MultiOCR3Base.sol";
import {OffRamp} from "../../../offRamp/OffRamp.sol";
import {OffRampSetup} from "./OffRampSetup.t.sol";

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rm newline

import {IERC20} from "../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

contract OffRamp_trialExecute is OffRampSetup {
address private constant GAS_ESTIMATION_SENDER = address(0xC11C11C11C11C11C11C11C11C11C11C11C11C1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure we can import this value and not have to redefine it. Probably means moving it to the internal lib? Would be nice if the offchain code can also use a reference and not a duplicated value


vm.mockCallRevert(
address(s_offRamp),
abi.encodeWithSelector(s_offRamp.executeSingleMessage.selector, message, offchainTokenData, tokenGasOverrides),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: prefer encodeCall

@@ -117,4 +122,68 @@ contract OffRamp_trialExecute is OffRampSetup {
assertEq(uint256(Internal.MessageExecutionState.FAILURE), uint256(newState));
assertEq(abi.encodeWithSelector(OffRamp.NotACompatiblePool.selector, address(0)), err);
}

function test_trialExecute_CallWithExactGasRevertsAndSenderIsNotGasEstimator() public {
uint256[] memory amounts = new uint256[](2);
Copy link
Contributor

Choose a reason for hiding this comment

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

test setup can be more minimal, tokens have no impact here

);

vm.expectRevert(MultiOCR3Base.InsufficientGasForCallWithExact.selector);
changePrank(GAS_ESTIMATION_SENDER);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no code should be between the expectRevert and the call, you can more the prank up

@smartcontractkit smartcontractkit deleted a comment from github-actions bot Jan 9, 2025
@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

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.

3 participants