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

feat: CCIP-1451 Offramp gasExecution data in event #1297

Closed

Conversation

defistar
Copy link
Contributor

@defistar defistar commented Aug 15, 2024

Motivation

Include execution gas cost in event emission -> ExecutionStateChanged event
JIRA: https://smartcontract-it.atlassian.net/browse/CCIP-1451

Solution

@defistar defistar requested review from makramkd, elatoskinas, RayXpub and a team as code owners August 15, 2024 12:26
@defistar defistar requested a review from a team as a code owner August 15, 2024 12:33
@defistar defistar requested a review from RensR August 15, 2024 12:35
@defistar defistar self-assigned this Aug 15, 2024
@defistar defistar added the looking for review This needs more reviewers label Aug 15, 2024
Copy link
Contributor

github-actions bot commented Aug 15, 2024

LCOV of commit c2905b6 during Solidity Foundry #7296

Summary coverage rate:
  lines......: 98.7% (1897 of 1922 lines)
  functions..: 96.4% (351 of 364 functions)
  branches...: 90.4% (799 of 884 branches)

Files changed coverage rate: n/a

@@ -464,8 +466,13 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
}
}

uint256 gasUsed;
unchecked {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please no unchecked

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@@ -27,6 +27,8 @@ import {MaybeRevertMessageReceiver} from "../helpers/receivers/MaybeRevertMessag
import {MockCommitStore} from "../mocks/MockCommitStore.sol";
import {MultiOCR3BaseSetup} from "../ocr/MultiOCR3BaseSetup.t.sol";
import {PriceRegistrySetup} from "../priceRegistry/PriceRegistry.t.sol";
import {Vm} from "forge-std/Test.sol";
import "forge-std/console.sol";
Copy link
Collaborator

Choose a reason for hiding this comment

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

We only allow explicit imports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

console logging import removed

@@ -489,4 +491,15 @@ contract EVM2EVMMultiOffRampSetup is TokenSetup, PriceRegistrySetup, MultiOCR3Ba
vm.startPrank(s_validTransmitters[0]);
s_offRamp.execute(reportContext, abi.encode(reports));
}

function printExecutionStateChangedEventLogs() public {
Copy link
Collaborator

@RensR RensR Aug 15, 2024

Choose a reason for hiding this comment

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

why do we need this? Could you rework this function to assert on all things except gas and use it instead of the expectEmit with hard coded values

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 on this, hard coded values will be difficult to maintain. We can maybe have 1 or 2 tests using them and ignore the field for the rest, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RensR this is helper function to extract the Execution event from eventLogs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assertion function added

@defistar defistar force-pushed the feature/CCIP-1451-OffRamp-Execution-Emit-GasUsed branch from 26bf845 to c2905b6 Compare August 16, 2024 09:11
@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

@defistar defistar closed this Aug 17, 2024
defistar added a commit that referenced this pull request Aug 19, 2024
#1310)

## Motivation
gasUsed for Execution to be emitted along with
ExecutionStateChangedEvent

## Solution
compute `gasUsed` for execution of a message in EVM2EVMMultiOffRamp
this change is applicable to only 1.6 version
Test Assertion must be added to assert the event body parameters
(excluding the gasUsed as it cant be hardcoded in tests)

** This is extension of the closed PR:
#1297
got signature verification issue with other PR. so moving all changes
over here

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
Co-authored-by: Ryan <80392855+RayXpub@users.noreply.github.com>
asoliman92 pushed a commit to smartcontractkit/chainlink that referenced this pull request Aug 27, 2024
#1310)

## Motivation
gasUsed for Execution to be emitted along with
ExecutionStateChangedEvent

## Solution
compute `gasUsed` for execution of a message in EVM2EVMMultiOffRamp
this change is applicable to only 1.6 version
Test Assertion must be added to assert the event body parameters
(excluding the gasUsed as it cant be hardcoded in tests)

** This is extension of the closed PR:
smartcontractkit/ccip#1297
got signature verification issue with other PR. so moving all changes
over here

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
Co-authored-by: Ryan <80392855+RayXpub@users.noreply.github.com>
asoliman92 pushed a commit to smartcontractkit/chainlink that referenced this pull request Aug 28, 2024
#1310)

## Motivation
gasUsed for Execution to be emitted along with
ExecutionStateChangedEvent

## Solution
compute `gasUsed` for execution of a message in EVM2EVMMultiOffRamp
this change is applicable to only 1.6 version
Test Assertion must be added to assert the event body parameters
(excluding the gasUsed as it cant be hardcoded in tests)

** This is extension of the closed PR:
smartcontractkit/ccip#1297
got signature verification issue with other PR. so moving all changes
over here

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
Co-authored-by: Ryan <80392855+RayXpub@users.noreply.github.com>
asoliman92 pushed a commit to smartcontractkit/chainlink that referenced this pull request Aug 28, 2024
#1310)

## Motivation
gasUsed for Execution to be emitted along with
ExecutionStateChangedEvent

## Solution
compute `gasUsed` for execution of a message in EVM2EVMMultiOffRamp
this change is applicable to only 1.6 version
Test Assertion must be added to assert the event body parameters
(excluding the gasUsed as it cant be hardcoded in tests)

** This is extension of the closed PR:
smartcontractkit/ccip#1297
got signature verification issue with other PR. so moving all changes
over here

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
Co-authored-by: Ryan <80392855+RayXpub@users.noreply.github.com>
asoliman92 pushed a commit to smartcontractkit/chainlink that referenced this pull request Aug 28, 2024
#1310)

## Motivation
gasUsed for Execution to be emitted along with
ExecutionStateChangedEvent

## Solution
compute `gasUsed` for execution of a message in EVM2EVMMultiOffRamp
this change is applicable to only 1.6 version
Test Assertion must be added to assert the event body parameters
(excluding the gasUsed as it cant be hardcoded in tests)

** This is extension of the closed PR:
smartcontractkit/ccip#1297
got signature verification issue with other PR. so moving all changes
over here

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
Co-authored-by: Ryan <80392855+RayXpub@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
looking for review This needs more reviewers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants