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

Update to Cadence v1.0.0-preview.35 #324

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Jun 27, 2024

Description

Automatically update to:

Summary by CodeRabbit

  • New Features

    • Improved transaction hash computation by removing unnecessary error handling, leading to more streamlined and efficient code.
  • Refactor

    • Simplified the assignment logic for transaction hashes across multiple functions and tests.
  • Tests

    • Updated test functions to remove error checks for transaction hash assignments, making tests more concise.

Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Walkthrough

This update encompasses dependency upgrades related to the OnFlow blockchain platform, simplifications to the calculation of transaction hashes by removing error handling, and code refactoring for improved readability and maintainability. The changes streamline various functions and tests by directly assigning transaction hashes without intermediate error checks.

Changes

File Change Summary
go.mod, tests/go.mod Updated dependencies for cadence, flow-go, flow-go-sdk, flow-core-contracts, and sdks.
api/api.go, api/models.go Simplified the assignment of transaction hashes, removing error handling for tx.Hash().
api/pull.go, api/stream.go Simplified logic by directly appending or assigning transaction hashes without intermediate variables.
models/receipt.go, models/transaction.go Removed error return values from Hash methods and directly assigned the hash value.
models/transaction_test.go Refactored tests by directly assigning transaction hashes and removing error checks.
services/ingestion/engine.go Simplified transaction hash assignment by removing error handling.
services/ingestion/engine_test.go Refactored hash comparisons to use concise assertion methods.
storage/index_testsuite.go Simplified assignment of transaction hashes, removing error handling.
storage/pebble/transactions.go Simplified logic in Store method by removing error handling for hash computation.

Poem

In the land of code, updates took flight,
Dependencies soared to a brand-new height.
Hashes now simpler, error checks out,
Clean and concise, there's no need for doubt.
Tests have been streamlined, all errors disband,
Cheers to the changes, from this rabbit's hand! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d69a16c and f474d7f.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
Files selected for processing (2)
  • go.mod (2 hunks)
  • tests/go.mod (2 hunks)
Additional comments not posted (10)
go.mod (5)

10-10: Updated dependency: github.com/onflow/cadence

The update from v1.0.0-preview.34 to v1.0.0-preview.35 aligns with the PR objectives. Ensure that this version is compatible with other updated dependencies and the overall system.

Verification successful

Updated dependency: github.com/onflow/cadence

The update from v1.0.0-preview.34 to v1.0.0-preview.35 is confirmed to be included in the go.sum file and no breaking changes were found in the release notes. The update aligns with the PR objectives and does not introduce any immediate issues.

  • go.sum file entries:
    • github.com/onflow/cadence v1.0.0-preview.35 h1:HZgt/9Foa6sCSH9SNaIFUSXK6q2ZxETg0ivsZbf+hhU=
    • github.com/onflow/cadence v1.0.0-preview.35/go.mod h1:jOwvPSSLTr9TvaKMs7KKiBYMmpdpNNAFxBsjMlrqVD0=
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify compatibility of Cadence v1.0.0-preview.35 with other dependencies.

# Test: Check for known issues or incompatibilities in the release notes or issue tracker.
gh issue list --repo onflow/cadence --search "v1.0.0-preview.35 incompatibilities"

Length of output: 84



Script:

#!/bin/bash
# Description: Verify the presence and consistency of the updated dependency in go.sum and check for breaking changes in the release notes.

# Check if the updated version exists in go.sum
grep "github.com/onflow/cadence v1.0.0-preview.35" go.sum

# Fetch the release notes for the updated version
gh release view v1.0.0-preview.35 --repo onflow/cadence --json body --jq '.body' | grep "breaking change"

Length of output: 356


139-139: Updated dependency: github.com/onflow/sdks

Updated to v0.6.0-preview.1. Check for any new features or critical updates that might affect the current implementation.


12-12: Updated dependency: github.com/onflow/flow-go-sdk

Updating to v1.0.0-preview.37 should bring new features or fixes. Verify that this version works well with the updated versions of other dependencies.

Verification successful

Updated dependency: github.com/onflow/flow-go-sdk

The update to v1.0.0-preview.37 includes updates to Cadence and other SDKs. No issues or pull requests specifically mention this version, indicating no known compatibility problems. The release notes do not highlight any breaking changes, suggesting that the update should be compatible with the other components.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Ensure compatibility of flow-go-sdk v1.0.0-preview.37 with other components.

# Test: Check for issues related to the new SDK version.
gh issue list --repo onflow/flow-go-sdk --search "v1.0.0-preview.37 issues"

Length of output: 77



Script:

#!/bin/bash
# Description: Ensure compatibility of flow-go-sdk v1.0.0-preview.37 with other components.

# Search for issues mentioning the new SDK version
gh issue list --repo onflow/flow-go-sdk --search "v1.0.0-preview.37"

# Search for pull requests mentioning the new SDK version
gh pr list --repo onflow/flow-go-sdk --search "v1.0.0-preview.37"

# Fetch release notes for the new SDK version
gh release view v1.0.0-preview.37 --repo onflow/flow-go-sdk

Length of output: 879


132-133: Updated dependency: github.com/onflow/flow-core-contracts

Both lib/go/contracts and lib/go/templates have been updated to v1.3.0. This is a significant version jump which might include major changes. Review the release notes to ensure no breaking changes affect existing deployments.


11-11: Updated dependency: github.com/onflow/flow-go

The update to a specific commit 604590f19db9 provides a precise version control. Ensure that this commit does not introduce any breaking changes or regressions.

Verification successful

No breaking changes or regressions identified in the updated dependency.

The commit 604590f19db9 only adds a development.md file, indicating no code changes that could introduce breaking changes or regressions.

  • Commit message: "Add development.md"
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for breaking changes or regressions in the specified commit of flow-go.

# Test: Search commits for breaking changes or regressions.
gh pr list --repo onflow/flow-go --search "604590f19db9 breaking changes"

Length of output: 75



Script:

#!/bin/bash
# Description: Check the commit messages and diff for the specified commit in flow-go repository for any breaking changes or significant modifications.

# Fetch the commit details
gh repo clone onflow/flow-go -- -q
cd flow-go
git show 604590f19db9 --name-only --pretty=format:"%B"

Length of output: 247

tests/go.mod (5)

9-9: Updated dependency for testing: github.com/onflow/flow-emulator

Updated to v1.0.0-preview.33. Verify that the emulator functions as expected with the new version, especially in testing scenarios.


148-149: Updated dependency for testing: github.com/onflow/flow-core-contracts

The update to v1.3.0 for both contracts and templates should be carefully tested to ensure no disruptions in contract-related tests.


7-7: Updated dependency for testing: github.com/onflow/cadence

Ensure the updated version v1.0.0-preview.35 is properly integrated into the test environment without issues.


11-11: Updated dependency for testing: github.com/onflow/flow-go

Same update as in go.mod. It is crucial to ensure that this update does not affect the testing frameworks or results.


12-12: Updated dependency for testing: github.com/onflow/flow-go-sdk

As with the main module, ensure that the SDK update to v1.0.0-preview.37 integrates well with existing tests and does not introduce regressions.

@turbolent
Copy link
Member Author

I tried to adjust the code to the API changes in flow-go / resolve the TODO in aa3c504, but it looks like the direct call tests are failing.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
storage/index_testsuite.go (1)

Line range hint 402-402: Potential security issue detected: Generic API key.

The static analysis tool has flagged a potential security issue with a generic API key. It's crucial to ensure that no sensitive keys or credentials are hardcoded in the codebase.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f474d7f and aa3c504.

Files selected for processing (11)
  • api/api.go (1 hunks)
  • api/models.go (1 hunks)
  • api/pull.go (1 hunks)
  • api/stream.go (1 hunks)
  • models/receipt.go (1 hunks)
  • models/transaction.go (3 hunks)
  • models/transaction_test.go (5 hunks)
  • services/ingestion/engine.go (1 hunks)
  • services/ingestion/engine_test.go (2 hunks)
  • storage/index_testsuite.go (4 hunks)
  • storage/pebble/transactions.go (2 hunks)
Files skipped from review due to trivial changes (5)
  • api/pull.go
  • models/transaction.go
  • services/ingestion/engine.go
  • services/ingestion/engine_test.go
  • storage/pebble/transactions.go
Additional context used
Gitleaks
storage/index_testsuite.go

402-402: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (7)
models/receipt.go (1)

155-155: Simplified error handling in MarshalReceipt function.

The removal of error handling for tx.Hash() simplifies the code and aligns with updates across other files.

api/stream.go (1)

143-143: Simplified error handling in NewPendingTransactions method.

The removal of error handling for tx.Hash() simplifies the code and aligns with updates across other files.

models/transaction_test.go (1)

34-34: Consistent simplification of error handling in transaction tests.

The removal of error handling for tx.Hash() in multiple test functions simplifies the code and aligns with the overall codebase changes.

Also applies to: 83-83, 129-129, 183-183, 237-237

api/models.go (1)

174-174: Simplified error handling in NewTransaction function.

The removal of error handling for tx.Hash() simplifies the code and aligns with updates across other files.

storage/index_testsuite.go (1)

355-355: Consistent simplification of error handling in transaction storage tests.

The removal of error handling for tx.Hash() in multiple test functions simplifies the code and aligns with the overall codebase changes.

Also applies to: 375-375

api/api.go (2)

239-239: Simplified Error Handling: Direct Assignment of Transaction Hash

The removal of error handling for the tx.Hash() method simplifies the code and reduces the complexity of error management. However, it's crucial to ensure that the Hash() method is reliable and does not fail under any expected conditions since the error handling has been removed.


239-239: Ensure Consistency and Reliability of Hash() Method

With the direct assignment of the transaction hash, it's important to ensure that all uses of the Hash() method across the codebase are consistent and that the method itself is reliable, especially since error checks have been removed.

@m-Peter
Copy link
Collaborator

m-Peter commented Jun 28, 2024

I tried to adjust the code to the API changes in flow-go / resolve the TODO in aa3c504, but it looks like the direct call tests are failing.

Much thanks for the update 🙌

I have fixed the tests in 85cbd6f
The failures were expected, due to a breaking change in the DirectCall hash calculation. See onflow/flow-go#6118

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa3c504 and 85cbd6f.

Files selected for processing (1)
  • models/transaction_test.go (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • models/transaction_test.go

Copy link
Collaborator

@m-Peter m-Peter left a comment

Choose a reason for hiding this comment

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

LGTM 💯

@turbolent
Copy link
Member Author

Thank you @m-Peter!

@turbolent turbolent merged commit 07940bf into main Jun 28, 2024
2 checks passed
@turbolent turbolent deleted the auto-update-onflow-cadence-v1.0.0-preview.35 branch June 28, 2024 11:55
@coderabbitai coderabbitai bot mentioned this pull request Sep 20, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants