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 Flow Go v0.34.0-crescendo-preview.16 #218

Merged
merged 21 commits into from
Apr 30, 2024

Conversation

devbugging
Copy link
Contributor

@devbugging devbugging commented Apr 26, 2024

Update to latest flow-go feature/cadence release v0.34.0-crescendo-preview.16 version that includes several breaking changes which this PR addresses.

Breaking changes are coming from these PRs:

Summary by CodeRabbit

  • New Features

    • Enhanced error handling in APIs to use subscription.ErrBlockNotReady for better clarity on block readiness.
    • Introduced Timestamp and TotalGasUsed fields in block information to provide more detailed block data.
    • Updated ingestion process to include network ID for improved data handling across different networks.
    • Added new test assertions for block.timestamp to ensure accuracy in block data retrieval.
  • Bug Fixes

    • Adjusted event type checks in model functions to use string containment for better reliability.
  • Refactor

    • Updated numerous internal components to use updated libraries and methods, enhancing code efficiency and maintainability.
    • Replaced deprecated references and methods with current ones in test suites to align with updated practices.
  • Tests

    • Improved test configurations and timeout handling to ensure more robust and reliable testing outcomes.
  • Chores

    • Upgraded Go version in CI workflows to take advantage of the latest language features and improvements.

@devbugging devbugging self-assigned this Apr 26, 2024
Copy link
Contributor

coderabbitai bot commented Apr 26, 2024

Important

Auto Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (2)
  • tests/go.mod is excluded by !**/*.mod
  • tests/go.sum is excluded by !**/*.sum

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The updates involve refining blockchain components and event handling in the software system. Changes include adding new fields like Timestamp and adjusting error handling by replacing specific errors. There are enhancements in event decoding, test adjustments, and API improvements, enhancing functionality and robustness across various parts of the system.

Changes

File Path Change Summary
api/api.go, models/block.go, tests/web3js/eth_non_interactive_test.js Added Timestamp field initialization and handling.
api/stream.go Replaced error references from flowgoStorage to subscription.ErrBlockNotReady.
bootstrap/bootstrap.go, services/ingestion/subscriber.go Modified function signatures to include network and chain IDs.
models/... Updated event and transaction decoding logic, replaced references to common with gethCommon.
tests/web3js/eth_streaming_test.js Enhanced test structures with import reordering, timeout adjustments, and subscription management.

🐇💻
CodeRabbit hopped through the code,
Refining blocks with a clever mode.
Timestamps added, errors swapped,
In the blockchain burrow, no bug was trapped.
Cheers to changes, neat and bold,
In the land of code, where stories unfold.
🌟🚀


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@turbolent
Copy link
Member

Could you please update to the new releases:

  • github.com/onflow/flow-emulator v1.0.0-preview.19
  • github.com/onflow/flow-go v0.34.0-crescendo-preview.15

Thanks!

@devbugging devbugging marked this pull request as ready for review April 30, 2024 13:04
@devbugging devbugging changed the title Update to latest flow Go Update to Flow Go v0.34.0-crescendo-preview.16 Apr 30, 2024
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: 4

Comment on lines +74 to +75
CumulativeGasUsed: tx.GasConsumed, // todo use cumulative after added to the tx result
EffectiveGasPrice: t.GasPrice(), // since there's no base fee we can always use gas price
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider verifying the assignment of CumulativeGasUsed and GasUsed. If they are intended to be different, adjust the logic accordingly.

return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace errors.Join with fmt.Errorf to correctly format the error message with subscription.ErrBlockNotReady.

- return nil, errors.Join(subscription.ErrBlockNotReady, err)
+ return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return nil, errors.Join(subscription.ErrBlockNotReady, err)
return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace errors.Join with fmt.Errorf to correctly format the error message with subscription.ErrBlockNotReady.

- return nil, errors.Join(subscription.ErrBlockNotReady, err)
+ return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return nil, errors.Join(subscription.ErrBlockNotReady, err)
return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace errors.Join with fmt.Errorf to correctly format the error message with subscription.ErrBlockNotReady.

- return nil, errors.Join(subscription.ErrBlockNotReady, err)
+ return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return nil, errors.Join(subscription.ErrBlockNotReady, err)
return nil, fmt.Errorf("%w: %v", subscription.ErrBlockNotReady, err)

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!

@devbugging devbugging merged commit 59f309f into main Apr 30, 2024
2 checks passed
@m-Peter m-Peter deleted the gregor/update-flow-go-latest branch April 30, 2024 14:58
@turbolent
Copy link
Member

Could we please continue to go through the normal dependency update flow and update all upstream dependencies first?

This PR updates the emulator, but e.g. the Cadence test framework hasn't gotten updated yet.

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.

3 participants