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

Implement GetLatestValueWithHeadData contract reader method on ethereum #14999

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

Conversation

ettec
Copy link
Collaborator

@ettec ettec commented Oct 29, 2024

Implement GetLatestValueWithHeadData contract reader method on ethereum

depends on:
smartcontractkit/chainlink-common#898

@ettec ettec marked this pull request as ready for review October 29, 2024 13:29
@ettec ettec requested review from a team as code owners October 29, 2024 13:29
@ettec ettec requested a review from patrickhuie19 October 29, 2024 13:29
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found in: PR title, commit message, or branch name. Please include the issue ID in one of these.

@ettec ettec requested a review from a team as a code owner October 29, 2024 13:34
Copy link
Contributor

github-actions bot commented Oct 29, 2024

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Find New Flaky Tests / Find Tests To Run , lint , Core Tests (go_core_tests) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_race_tests) , Core Tests (go_core_fuzz) , Find New Flaky Tests / Run Tests , Find New Flaky Tests / Report , SonarQube Scan , Flakey Test Detection

1. Integer overflow conversion error: Golang Lint

Source of Error:
core/services/relay/evm/chain_reader.go:254:20: G115: integer overflow conversion int64 -> uint64 (gosec)
Timestamp: uint64(finalizedHead.Timestamp.Unix()),

Why: This error occurs because converting an int64 value to uint64 can result in an integer overflow if the int64 value is negative.

Suggested fix: Ensure that the int64 value is non-negative before converting it to uint64. Alternatively, handle the conversion safely by checking the value's range.

2. Incorrect nolint directive format: Golang Lint

Source of Error:
core/services/relay/evm/chain_reader.go:253:3: directive `//nolint:G115 Timestamp is always positive` should match `//nolint[:<comma-separated-linters>] [// <explanation>]` (nolintlint)

Why: The nolint directive format is incorrect. It should follow the pattern //nolint[:<comma-separated-linters>] [// <explanation>].

Suggested fix: Correct the nolint directive to match the required format, e.g., //nolint:gosec // Timestamp is always positive.

3. Unclean state after generate: Ensure clean after generate

Source of Error:
git diff --stat --exit-code
.../logeventcap/trigger_builders_generated.go | 74 +++++++++++++-------
.../webapi/webapicap/trigger_builders_generated.go | 78 ++++++++++++++--------
2 files changed, 100 insertions(+), 52 deletions(-)

Why: The generated files have changes that were not committed, indicating that the code generation step modified files but did not result in a clean state.

Suggested fix: Ensure that all generated files are up-to-date and committed before running the git diff check. Run the code generation step and commit any changes.

4. Test failure due to unexpected nil error: Core Tests (go_core_tests)

Source of Error:
Error: An error is expected but got nil.
Test: TestChainComponents/GetLatestValueWithHeadData_for_EVM_on_loop/Get_latest_value_based_on_confidence_level_for_EVM_on_loop

Why: The test expected an error but received nil, indicating that the function did not behave as expected under test conditions.

Suggested fix: Review the test case and the function under test to ensure that the expected error conditions are correctly simulated and handled.

5. Test failure due to context deadline exceeded: Core Tests (go_core_tests)

Source of Error:
Error: Received unexpected error: failed to get transaction status: failed to find transaction with IdempotencyKey e12f68e3-7db9-41d1-b981-b9ef8e2df948: FindTxWithIdempotencyKey failed to load evm.txes: context deadline exceeded
Test: TestChainComponents/QueryKey_for_EVM_on_loop/QueryKey_can_filter_data_with_value_comparator_for_EVM_on_loop

Why: The test encountered a timeout while waiting for a transaction status, indicating that the operation took longer than the allowed time.

Suggested fix: Increase the context timeout for the test or optimize the function to complete within the expected time frame.

6. Test failure due to RPC deadline exceeded: Core Tests (go_core_tests)

Source of Error:
Error: Received unexpected error: rpc error: code = DeadlineExceeded desc = context deadline exceeded
Test: TestChainComponents/QueryKey_for_EVM_on_loop/QueryKey_can_limit_results_with_cursor_for_EVM_on_loop

Why: The test encountered an RPC timeout, indicating that the remote procedure call took longer than the allowed time.

Suggested fix: Increase the RPC timeout for the test or optimize the RPC call to complete within the expected time frame.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@ettec ettec requested review from a team as code owners October 30, 2024 15:13
@ettec ettec force-pushed the eth_get_latest_value_with_head_data branch 2 times, most recently from 821d0b5 to ec6840e Compare October 30, 2024 15:17
@ettec ettec force-pushed the eth_get_latest_value_with_head_data branch from 190d83d to cf8de14 Compare October 31, 2024 09:45
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

return nil, err
}

latestHead, finalizedHead, err := cr.ht.LatestAndFinalizedBlock(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't give you a guarantee that the attached block is the same block that the data was read from. You'll have to return the same block height calculated in EventBinding or MethodBinding

Copy link
Contributor

github-actions bot commented Jan 5, 2025

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants