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 cadence/flow-go/flow-go-sdk/flow-emulator dependencies #738

Merged
merged 12 commits into from
Feb 4, 2025

Conversation

m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Jan 29, 2025

Description


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • Dependency Updates

    • Upgraded Go version from 1.22 to 1.23
    • Updated multiple dependencies across Flow project modules
    • Updated testing libraries and OpenTelemetry instrumentation packages
    • Added new dependency: github.com/onflow/bridged-usdc/lib/go/contracts at version 1.0.0
  • Infrastructure

    • Updated base image in Dockerfile to Go version 1.23
    • Adjusted CI configuration to use Go version 1.23 for testing and linting
  • Bug Fixes

    • Refined expected outcomes in transaction tracing tests to align with updated logic
    • Removed unnecessary logging of transaction execution details, streamlining processing
    • Adjusted expected values in various test cases to reflect changes in underlying logic
    • Corrected expected block numbers in transaction filter tests to match actual outputs
    • Updated expected results for contract call assertions to reflect new logic for flow block height

Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

Walkthrough

The pull request introduces updates to the project's dependencies and modifications in the bootstrap package. The Go version has been upgraded from 1.22 to 1.23, along with various dependencies updated to their latest versions. In the bootstrap package, the util package import has been removed, and the metrics server's startup and shutdown logic has been refined, eliminating explicit waiting mechanisms for server readiness and closure. Additionally, error handling for the metrics server startup has been enhanced.

Changes

File Change Summary
bootstrap/bootstrap.go Removed util package import; simplified metrics server startup/shutdown logic; added error handling for startup
go.mod Updated Go version to 1.23 and upgraded multiple dependencies to their latest versions
tests/go.mod Updated Go version and dependencies; added new dependency for bridged USDC contracts
.github/workflows/ci.yml Updated Go version from 1.22.x to 1.23.x in CI jobs for testing and linting
Dockerfile Updated base image from golang:1.22.0 to golang:1.23
tests/web3js/debug_traces_test.js Updated assertions for gas and gasUsed in transaction tracing tests
api/debug.go Removed variable capturing result of view.DryCall and eliminated log handling in TraceCall method
services/evm/executor.go Removed loop processing logs in Run method of BlockExecutor struct
tests/web3js/config.js Updated startBlockHeight from 4n to 3n and coaDeploymentHeight from 3n to 2n
tests/web3js/eth_filter_endpoints_test.js Updated expected blockNumber values in assertions to reflect current blockchain state
tests/web3js/eth_logs_filtering_test.js Updated blockNumber values in response objects of assertions to correct expected data
tests/web3js/eth_non_interactive_test.js Modified parameters and expected results for batch requests and fee history retrieval
tests/web3js/verify_cadence_arch_calls_test.js Changed expected result of contract call to reflect new logic based on configuration

Possibly related PRs

  • Update to Cadence v1.0.0-preview.34 #301: The changes in the main PR, specifically the updates to the go.mod file for the github.com/onflow/cadence and github.com/onflow/flow-go dependencies, are related to the updates in the retrieved PR which also modifies these same dependencies.
  • Update to Cadence v1.0.0-preview.30 #276: The changes in the main PR focus on the StartMetricsServer method in the Bootstrap struct, while the retrieved PR modifies the Start function in the same bootstrap/bootstrap.go file, indicating a direct relationship between the two.
  • Testnet release #414: The changes in the main PR, specifically the modifications to the StartMetricsServer method in bootstrap/bootstrap.go, are related to the changes in the retrieved PR, which also involves modifications to the bootstrap/bootstrap.go file, particularly the removal of a line of code affecting the handling of a variable in the same method.

Suggested labels

Improvement, Testing

Suggested reviewers

  • peterargue
  • zhangchiqing
  • janezpodhostnik

Poem

🐰 In the meadow, changes bloom,
Go's new version makes room,
Metrics dance without a wait,
Dependencies, oh, they elevate!
Hopping forward, we celebrate! ✨

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3547fb4 and 1620391.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • Dockerfile (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Dockerfile
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test
  • GitHub Check: Lint
🔇 Additional comments (1)
.github/workflows/ci.yml (1)

19-19: Verify Go version compatibility with dependencies.

Since you're updating Flow-related dependencies, let's verify their Go version requirements.

Also applies to: 36-36

✅ Verification successful

Go version 1.23.x is compatible with all dependencies

The Go version specified in CI matches the version requirements in both go.mod files and is compatible with all Flow-related dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Go version requirements in go.mod files of Flow dependencies

# Check go.mod files for Go version
echo "Checking Go version in go.mod files..."
rg -A 5 "^go \d+\.\d+" 

# Check if dependencies specify Go version constraints
echo -e "\nChecking version constraints in go.mod..."
rg "require\s+.*flow-" -A 10

Length of output: 619


Script:

#!/bin/bash
# Search for all Flow-related dependencies and their versions
echo "Searching for Flow dependencies in go.mod files..."
rg "github.com/onflow" go.mod tests/go.mod

# Get the content of go.mod files for manual inspection
echo -e "\nContent of go.mod files:"
echo "=== go.mod ==="
cat go.mod
echo -e "\n=== tests/go.mod ==="
cat tests/go.mod

Length of output: 26609

.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@@ -364,10 +363,6 @@ func (b *Bootstrap) StartMetricsServer(ctx context.Context) error {
b.logger.Info().Msg("bootstrap starting metrics server")

b.metrics = flowMetrics.NewServer(b.logger, uint(b.config.MetricsPort))
err := util.WaitClosed(ctx, b.metrics.Ready())
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like metrics server is a component. why remove these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good question! So the metrics server became a component in this commit: onflow/flow-go@4c8ac17.

Which means that with:

err := util.WaitClosed(ctx, b.metrics.Ready())

The entire test suite would fail, due to indefinite blocking. The same goes for the shutdown of the metrics server:

<-b.metrics.Done()

I had to remove the above line.

The flow-go commit I linked above, was intended to be used from this PR: #682. I am unsure as to how to proceed here..

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll take a look today.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should do it I think: #741

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should do it I think: #741

@janezpodhostnik That piece of code works like a charm 💯 Could you prepare that PR and merge on this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

merged!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome!

Dockerfile Outdated Show resolved Hide resolved
@m-Peter m-Peter force-pushed the mpeter/update-dependencies branch 2 times, most recently from 54b261f to 75031c7 Compare February 3, 2025 09:29
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

🧹 Nitpick comments (1)
bootstrap/bootstrap.go (1)

371-392: LGTM! Consider enhancing error handling in the monitoring goroutine.

The new metrics server startup implementation correctly handles the component lifecycle. However, the panic in the monitoring goroutine could be replaced with a more graceful shutdown mechanism.

Consider this alternative error handling approach:

 go func() {
     err := <-errCh
     if err != nil {
         b.logger.Err(err).Msg("error in metrics server")
-        panic(err)
+        // Signal shutdown to the main context
+        cancel()
     }
 }()

This would require passing a cancel function to StartMetricsServer:

func (b *Bootstrap) StartMetricsServer(ctx context.Context, cancel context.CancelFunc) error {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54b261f and 75031c7.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • .github/workflows/ci.yml (2 hunks)
  • Dockerfile (1 hunks)
  • api/debug.go (1 hunks)
  • bootstrap/bootstrap.go (2 hunks)
  • go.mod (5 hunks)
  • services/evm/executor.go (0 hunks)
  • tests/go.mod (5 hunks)
  • tests/web3js/debug_traces_test.js (2 hunks)
💤 Files with no reviewable changes (1)
  • services/evm/executor.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • Dockerfile
  • .github/workflows/ci.yml
  • tests/web3js/debug_traces_test.js
  • go.mod
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Lint
  • GitHub Check: Test
🔇 Additional comments (23)
bootstrap/bootstrap.go (2)

17-17: LGTM!

The import of irrecoverable package is appropriate for the new metrics server lifecycle management.


401-401: LGTM!

The addition of the warning log message improves observability during the metrics server shutdown process.

tests/go.mod (20)

3-3: Update Go Version Directive
The Go version is now set to 1.23, which aligns this module with the updated Dockerfile and CI configuration. Please ensure all local builds and tests run successfully with this new version.


7-7: Upgrade onflow/cadence Dependency
The github.com/onflow/cadence dependency has been updated to v1.3.1. This upgrade should bring in the latest features and fixes. Double-check that any changes in its API are compatible with the rest of the integration tests.


9-9: Upgrade flow-emulator Dependency
The github.com/onflow/flow-emulator dependency is now at v1.1.1-0.20250128000351-085706c390e1. Confirm that the emulator’s behavior remains consistent with your integration expectations.


11-11: Upgrade flow-go Dependency
The github.com/onflow/flow-go dependency has been updated to v0.38.0-util.0.20250203085701-72e6e6235fa5. This should ensure compatibility with the latest protocol improvements; please verify that no breaking changes affect your use cases.


12-12: Upgrade flow-go-sdk Dependency
The github.com/onflow/flow-go-sdk is now at v1.3.1. Ensure that any API changes are accounted for across the codebase and that tests confirming SDK behavior have been updated accordingly.


15-15: Upgrade Testify Dependency
The github.com/stretchr/testify library has been upgraded to v1.10.0. This minor bump should offer improvements without breaking tests; please run all tests to confirm that assertions and mock functionalities behave as expected.


19-19: Upgrade Google Compute Metadata Client
The dependency cloud.google.com/go/compute/metadata has been updated to v0.5.0. Verify that any code interacting with Google Cloud metadata behaves correctly with this newer version.


91-91: Update googleapis/gax-go Dependency
The github.com/googleapis/gax-go/v2 dependency is now at v2.12.2. Confirm that this update does not disrupt any gRPC-related operations or client interactions that depend on GAX for retries and error handling.


151-151: Upgrade onflow/atree Dependency
The github.com/onflow/atree dependency has been updated to v0.9.0. Ensure that any tree-related operations or integrity checks relying on this module remain fully functional after the upgrade.


152-152: Add Bridged-USDC Contracts Dependency
A new dependency, github.com/onflow/bridged-usdc/lib/go/contracts at v1.0.0, has been added. Please verify that this new package is correctly integrated and that its usage is well documented across the codebase.


206-206: Upgrade zeebo/blake3 Dependency
The github.com/zeebo/blake3 package is now at v0.2.4, which may include important bug fixes or performance improvements for hashing. Ensure that any cryptographic functionalities using Blake3 are retested for expected behavior.


208-208: Upgrade opentelemetry otelgrpc Instrumentation
The go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc module has been updated to v0.49.0. Please confirm that gRPC tracing and metrics collection are working correctly with the new version.


209-209: Upgrade opentelemetry otelhttp Instrumentation
The go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp dependency is also updated to v0.49.0, which should complement the otelgrpc upgrade. Verify that HTTP instrumentation and tracing are performing as expected.


223-223: Upgrade golang.org/x/net Dependency
The module golang.org/x/net has been upgraded to v0.26.0. This update may enhance networking functions; ensure that any custom network logic or integrations are not adversely affected.


224-224: Upgrade golang.org/x/oauth2 Dependency
The golang.org/x/oauth2 package is now at v0.18.0. Confirm that all OAuth interactions, token retrieval, and refresh logic remain compatible after this version change.


232-232: Upgrade google.golang.org/api Dependency
The google.golang.org/api dependency has been updated to v0.169.0. Verify that all client interactions with Google APIs continue to function as intended, particularly any authentication or service discovery flows.


235-235: Upgrade Genproto for Google APIs
The google.golang.org/genproto/googleapis/api module is now at v0.0.0-20240814211410-ddb44dafa142. Please check that any generated code or proto-based integrations are updated and compile correctly.


236-236: Upgrade Genproto for Google RPCs
The google.golang.org/genproto/googleapis/rpc dependency has been updated to v0.0.0-20240814211410-ddb44dafa142. Validate that this change does not introduce issues in gRPC serialization or remote procedure call implementations.


237-237: Upgrade gRPC Dependency
The google.golang.org/grpc library has been updated to v1.64.1. This upgrade should provide performance improvements and bug fixes; ensure that any gRPC communications or service endpoints remain stable.


238-238: Upgrade Protocol Buffers Dependency
The google.golang.org/protobuf module is now at v1.34.2. Confirm that all proto definitions and any generated code continue to work seamlessly with this updated version.

api/debug.go (1)

241-248: Verify the intentional discarding of DryCall result.

The DryCall result is now discarded using the blank identifier _. This change aligns with the removal of log processing in the broader codebase, but let's verify that this is intentional and doesn't impact error reporting or debugging capabilities.

Run the following script to check for any other usages of DryCall results in the codebase:

✅ Verification successful

Intentional Discarding of DryCall Result Confirmed

The DryCall result is intentionally discarded in api/debug.go (line 241) to align with the removal of log processing in this context. Notably, other parts of the codebase—such as in services/requester/requester.go—continue to capture the DryCall result, confirming that the change is specific to the Debug API’s needs. This approach is consistent with broader changes in log handling.

  • In api/debug.go, the DryCall result is ignored since its logs are no longer processed.
  • In services/requester/requester.go, the DryCall return is captured for further usage, indicating context-specific handling.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how DryCall results are used across the codebase

# Search for DryCall method usage patterns
ast-grep --pattern 'view.DryCall($$$)'

# Search for any references to DryCall logs
rg -A 5 'DryCall.*Logs'

Length of output: 66


Script:

#!/bin/bash
# Description: Search for all occurrences of DryCall usage and its definition across the codebase

echo "Searching for DryCall method usages and definitions:"
rg -n "DryCall(" .

Length of output: 202


Script:

#!/bin/bash
# Description: Corrected search for all occurrences of DryCall usage across the codebase using proper escaping.
echo "Searching for DryCall usages in the codebase:"
rg -n 'DryCall\(' .

Length of output: 233

@m-Peter m-Peter mentioned this pull request Feb 3, 2025
@turbolent turbolent requested a review from a team February 3, 2025 19:03
@m-Peter m-Peter force-pushed the mpeter/update-dependencies branch from 75031c7 to b0ee1d1 Compare February 4, 2025 09:46
@m-Peter
Copy link
Collaborator Author

m-Peter commented Feb 4, 2025

@turbolent I have updated this PR to use the latest tagged release of flow-emulator. And while at it, fixed some breaking changes which occurred in the integration tests.

Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

added a comment about a corner case for the metrics server, but otherwise looks good

bootstrap/bootstrap.go Outdated Show resolved Hide resolved
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: 1

🧹 Nitpick comments (1)
bootstrap/bootstrap.go (1)

402-403: Move warning log before server shutdown.

The warning log message should be placed before the server shutdown to ensure it's logged even if the shutdown hangs.

Apply this diff to fix the log message placement:

+	b.logger.Warn().Msg("shutting down metrics server")
 	<-b.metrics.Done()
-	b.logger.Warn().Msg("shutting down metrics server")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0ee1d1 and 8978836.

📒 Files selected for processing (1)
  • bootstrap/bootstrap.go (3 hunks)
🧰 Additional context used
🪛 GitHub Check: Test
bootstrap/bootstrap.go

[failure] 377-377:
undefined: util

🪛 golangci-lint (1.62.2)
bootstrap/bootstrap.go

377-377: undefined: util

(typecheck)

🪛 GitHub Actions: CI
bootstrap/bootstrap.go

[error] 377-377: undefined: util

🔇 Additional comments (1)
bootstrap/bootstrap.go (1)

375-394: LGTM! Robust error handling implementation.

The error handling implementation is well-designed:

  • Uses irrecoverable.WithSignaler for proper context management
  • Monitors startup errors through a dedicated error channel
  • Handles errors asynchronously in a goroutine
🧰 Tools
🪛 GitHub Check: Test

[failure] 377-377:
undefined: util

🪛 golangci-lint (1.62.2)

377-377: undefined: util

(typecheck)

🪛 GitHub Actions: CI

[error] 377-377: undefined: util

bootstrap/bootstrap.go Show resolved Hide resolved
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8978836 and 6d60018.

📒 Files selected for processing (1)
  • bootstrap/bootstrap.go (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test
🔇 Additional comments (2)
bootstrap/bootstrap.go (2)

17-17: LGTM: Import of irrecoverable package.

The addition of the irrecoverable package is appropriate for handling component lifecycle management.


399-405: LGTM: Metrics server shutdown logic.

The shutdown logic is correct and includes appropriate logging.

bootstrap/bootstrap.go Show resolved Hide resolved
@turbolent turbolent merged commit 4d3dfcd into main Feb 4, 2025
2 checks passed
@turbolent turbolent deleted the mpeter/update-dependencies branch February 4, 2025 21:35
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.

5 participants