Skip to content

Update to Cadence v1.7.0 - #877

Merged
m-Peter merged 6 commits into
mainfrom
auto-update-onflow-cadence-v1.7.0
Sep 11, 2025
Merged

Update to Cadence v1.7.0#877
m-Peter merged 6 commits into
mainfrom
auto-update-onflow-cadence-v1.7.0

Conversation

@turbolent

@turbolent turbolent commented Sep 10, 2025

Copy link
Copy Markdown
Member

Description

Automatically update to:

Summary by CodeRabbit

  • Chores

    • Upgraded runtime to Go 1.25.0 and removed the toolchain directive.
    • Broad dependency refresh across Ethereum/Flow ecosystems; updated OpenTelemetry (v1.37.0), gRPC, Google proto stack, and many indirects for stability/security.
    • CI and linting action upgrades and lint config adjustments.
  • Tests

    • Updated test dependencies and test code to align with Go 1.25.0; tests now reference block heights directly.
  • Minor

    • Added a small public identifier for a requester implementation.
    • Silenced some Close() error returns during shutdown/cleanup.

@coderabbitai

coderabbitai Bot commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Update Go toolchain to 1.25.0, perform a broad dependency refresh (Flow/Cadence, flow-go/sdk/emulator, go-ethereum, OpenTelemetry, google/gRPC/protobuf, golang.org/x/*, and various utilities), adjust CI/linter configs, minor refactors, and add Name() to RemoteCadenceArch. No exported signatures removed.

Changes

Cohort / File(s) Summary
Root module dependencies
go.mod
Set go 1.25.0 (removed toolchain directive). Wide dependency upgrades across Flow/Cadence (cadence v1.7.0, flow-go dev 0.43.x, flow-go-sdk v1.8.1), Ethereum (github.com/ethereum/go-ethereum v1.16.3), OpenTelemetry v1.37.0, gRPC v1.75.0, google proto stack, golang.org/x/*, and various utilities/indirects.
Tests module dependencies
tests/go.mod
Set go 1.25.0. Mirrored dependency refresh consistent with root module (Flow, cadence, flow-emulator, flow-go-sdk, go-ethereum, OpenTelemetry, google/gRPC/protobuf, golang.org/x/*, indirects).
CI workflow
.github/workflows/ci.yml
Bumped Go in CI 1.23 → 1.25; upgraded golangci-lint action v6 → v8 and updated linter version input.
Linter config
.golangci.toml
Removed legacy [linters], set top-level version = "2", added [formatters] enabling goimports.
Requester service
services/requester/remote_cadence_arch.go
Reordered imports and added exported method func (rca *RemoteCadenceArch) Name() string returning the cadence precompile name constant.
API small refactor
api/pull.go
Simplified boolean expression to full := fullTx != nil && *fullTx.
Cmd small refactor
cmd/run/cmd.go
Replaced if/else chain with switch for txStateValidation mapping; behavior unchanged.
Models adjustments
models/transaction.go
Use promoted methods/fields (dc.EmptyToField(), dc.GasLimit, dc.Encode()); no signature changes.
Tests adjustments
tests/tx_batching_test.go
Tests now reference Block.Height instead of Block.Header.Height throughout; imports reordered.
Close handling & import reorders
api/server.go, bootstrap/bootstrap.go, cmd/blocks/cmd.go
Several Close() calls changed to ignore returned errors (e.g., _ = ...Close()), pebble DB close deferred with ignored error; minor import reordering.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant RemoteCadenceArch
  Note over RemoteCadenceArch: New exported method Name() added\nreturns constant from evm/precompiles
  Caller->>RemoteCadenceArch: Name()
  RemoteCadenceArch-->>Caller: evmPrecompiles.CADENCE_ARCH_PRECOMPILE_NAME
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Chore, Improvement

Suggested reviewers

  • peterargue
  • zhangchiqing
  • janezpodhostnik

"I twitch my whiskers, patch in paw,
Go hops to 1.25 — hurrah! 🥕
Cadence and deps all set in row,
A tiny Name() gives them a show.
Commit sealed with a carrot glow. 🐇"

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Update to Cadence v1.7.0" is a short, single-sentence summary that correctly highlights the PR's primary intent (upgrading Cadence to v1.7.0); the PR description and branch name confirm the Cadence bump is the main objective while other dependency updates are secondary, and the phrasing is concise and clear for teammates scanning history.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c0189f and 837981b.

📒 Files selected for processing (1)
  • services/requester/remote_cadence_arch.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • services/requester/remote_cadence_arch.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch auto-update-onflow-cadence-v1.7.0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
go.mod (1)

1-228: Update CI and Docker to Go 1.25 toolchain

  • go.mod declares go 1.25.0 — Dockerfile (line 3) currently: FROM golang:1.23 as app-builder → change to golang:1.25.
  • Bump any CI workflow references (actions/setup-go go-version, runner/base images, other Dockerfiles) to 1.25 so pipeline images match go.mod.
🧹 Nitpick comments (3)
go.mod (1)

148-149: Align Flow core-contracts/templates with tests to avoid drift.

Root uses older commits than tests. Use the same revisions everywhere to prevent subtle integration mismatches.

Apply (to match tests/go.mod):

-github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224 // indirect
-github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224 // indirect
+github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250905214304-819c6e946442 // indirect
+github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250905214304-819c6e946442 // indirect
tests/go.mod (2)

222-227: Align OTel exporters with core v1.37.0.

Same consistency suggestion as root.

Apply:

-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 // indirect

159-160: Align flow-core-contracts versions across modules

tests/go.mod pins newer pseudo-versions than root go.mod — keep them identical to avoid dependency surprises.

  • go.mod (lines 148–149):
    github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224 // indirect
    github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224 // indirect
  • tests/go.mod (lines 159–160):
    github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250905214304-819c6e946442 // indirect
    github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250905214304-819c6e946442 // indirect

Action: align the versions (update tests/go.mod to match root or update root to the newer pseudo-version) and run go mod tidy.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a55163d and 4b01642.

⛔ 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 (8 hunks)
  • tests/go.mod (8 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.
📚 Learning: 2025-01-29T17:20:28.143Z
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.

Applied to files:

  • go.mod
📚 Learning: 2025-03-07T01:35:09.751Z
Learnt from: peterargue
PR: onflow/flow-evm-gateway#772
File: services/requester/keystore/key_store.go:50-62
Timestamp: 2025-03-07T01:35:09.751Z
Learning: In the flow-evm-gateway codebase, panics are acceptable in scenarios where immediate detection of critical bugs is desired during development and testing, particularly for invariant violations that should never occur in a correctly functioning system (e.g., when a key is available but locked in the keystore implementation).

Applied to files:

  • go.mod
  • tests/go.mod
🔇 Additional comments (7)
go.mod (5)

14-15: Non-release Flow-Go pseudo-version — confirm intent.

You’re pinning to a dev-pebble commit. If that’s required for Cadence 1.7.0, fine; otherwise prefer a release to reduce churn.


7-7: Deps bump LGTM.

go-ethereum v1.16.3, testify v1.11.1, grpc v1.75.0 look fine.

Also applies to: 23-23, 27-28


6-6: Don't drop Pebble v1 — it's imported directly.

go.mod requires github.com/cockroachdb/pebble v1.1.5 while github.com/cockroachdb/pebble/v2 v2.0.6 is only indirect. Multiple files import the v1 path (e.g. storage/index.go, storage/pebble/db.go, storage/pebble/transactions.go, services/ingestion/engine.go, storage/mocks/*, storage/register_delta_test.go) — removing v1 will break builds. If you want a single major in the binary, migrate these imports to pebble/v2 or update the dependency that pulls in v2.

Likely an incorrect or invalid review comment.


201-206: Incorrect recommendation — OTLP exporters are v0.x, not v1.37.0

otlptrace and otlptracegrpc latest release is v0.60.0 (as of 2025-09-10); do not change them to v1.37.0. Either update the exporter lines in go.mod to v0.60.0 or upgrade go.opentelemetry.io/otel to the matching release (v1.38.0) that bundles v0.60.0. File: go.mod (lines 201-206).

Likely an incorrect or invalid review comment.


3-3: Fix invalid go directive (must be major.minor).

go 1.25.0 will fail module parsing. Use go 1.25 and, if you want to pin toolchain patch, add a separate toolchain directive.

Apply:

-go 1.25.0
+go 1.25
+toolchain go1.25.0
⛔ Skipped due to learnings
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 is scheduled to be released on August 13, 2024, and should not be used in production before its official release.
tests/go.mod (2)

6-7: Deps bump LGTM for tests.

go-ethereum v1.16.3, cadence v1.7.0, emulator v1.7.0, flow-go-sdk v1.8.1, testify v1.11.1, x/sync v0.16.0.

Also applies to: 10-13, 15-16


248-249: grpc/protobuf updates LGTM.

Minor bumps, no action needed.

Comment thread tests/go.mod
go 1.23.7

toolchain go1.23.8
go 1.25.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid go directive (must be major.minor).

Same as root: change to go 1.25 and optionally add toolchain.

Apply:

-go 1.25.0
+go 1.25
+toolchain go1.25.0
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
go 1.25.0
go 1.25
toolchain go1.25.0
🤖 Prompt for AI Agents
In tests/go.mod around line 3, the go directive is invalid ("go 1.25.0") and
must be major.minor; change it to "go 1.25" (and optionally add a // toolchain
directive if you want to pin the toolchain), updating the file so the third line
reads the corrected go directive.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
services/requester/remote_cadence_arch.go (2)

60-67: Returning 0 gas on error undercharges the precompile.

If runCall errors, RequiredGas returns 0, allowing execution with no gas charge. Fall back to a safe upper bound instead (e.g., cadenceArchCallGasLimit).

 func (rca *RemoteCadenceArch) RequiredGas(input []byte) uint64 {
   evmResult, err := rca.runCall(input)
   if err != nil {
-    return 0
+    // Fallback to an upper bound to avoid undercharging on transient failures.
+    return cadenceArchCallGasLimit
   }
   return evmResult.GasConsumed
 }

108-116: Add a timeout to the remote script execution.

External call uses context.Background() (no deadline). Add a bounded timeout to prevent hangs.

-    scriptResult, err := rca.client.ExecuteScriptAtBlockHeight(
-        context.Background(),
+    ctx, cancel := context.WithTimeout(context.Background(), cadenceArchScriptTimeout)
+    defer cancel()
+    scriptResult, err := rca.client.ExecuteScriptAtBlockHeight(
+        ctx,
         rca.blockHeight,
         replaceAddresses(dryRunScript, rca.chainID),
         []cadence.Value{hexEncodedTx, hexEncodedAddress},
     )

Additions outside this hunk:

// at top imports
import (
    // ...
    "time"
)

// near other consts
const cadenceArchScriptTimeout = 10 * time.Second
🧹 Nitpick comments (3)
.golangci.toml (1)

3-6: Formatter enablement is valid; consider setting local prefixes.

formatters.enable = ["goimports"] is valid in v2. Optionally set formatters.settings.goimports.local-prefixes to keep repo imports grouped.
Docs for v2 formatters. (golangci-lint.run)

Apply if desired:

 [formatters]
 enable = [
     "goimports",
 ]
+[formatters.settings.goimports]
+local-prefixes = [
+  "github.com/onflow/flow-evm-gateway",
+]
.github/workflows/ci.yml (1)

20-23: Optional: derive Go version from go.mod to avoid drift.

Using go-version-file: go.mod removes the need to maintain GO_VERSION and picks the latest patch automatically.

-    - uses: actions/setup-go@v5
-      with:
-        go-version: ${{ env.GO_VERSION }}
+    - uses: actions/setup-go@v5
+      with:
+        go-version-file: go.mod

Docs: setup-go supports go-version-file and enables caching by default. (github.com)

services/requester/remote_cadence_arch.go (1)

72-75: Map cache may be accessed concurrently.

If RemoteCadenceArch instances are shared, unsynchronized cachedCalls risks data races. Consider guarding with sync.RWMutex (or sync.Map).

Minimal change:

 type RemoteCadenceArch struct {
     blockHeight uint64
     client      *CrossSporkClient
     chainID     flow.ChainID
     cachedCalls map[string]evmTypes.Data
+    mu          sync.RWMutex
 }

 // in Run
-    if result, ok := rca.cachedCalls[key]; ok {
+    rca.mu.RLock()
+    result, ok := rca.cachedCalls[key]
+    rca.mu.RUnlock()
+    if ok {
         return result, nil
     }

 // in runCall (before write)
-    rca.cachedCalls[key] = evmResult.ReturnedData
+    rca.mu.Lock()
+    rca.cachedCalls[key] = evmResult.ReturnedData
+    rca.mu.Unlock()

And add sync to imports.

Also applies to: 123-125

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b01642 and 736c332.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml (2 hunks)
  • .golangci.toml (1 hunks)
  • services/requester/remote_cadence_arch.go (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.
📚 Learning: 2025-01-29T17:20:28.143Z
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.

Applied to files:

  • .github/workflows/ci.yml
🔇 Additional comments (3)
.golangci.toml (1)

1-1: Config v2 switch looks correct.

version = '2' matches the new GolangCI-Lint v2 config schema.
See: official config docs. (golangci-lint.run)

.github/workflows/ci.yml (1)

35-39: Action and linter versions are consistent.

Using golangci/golangci-lint-action@v8 with version: v2.4 aligns with the action’s v8 compatibility matrix (supports golangci-lint v2.x) and accepted version formats.
Refs: action README (compat/inputs). (github.com)

services/requester/remote_cadence_arch.go (1)

52-54: New Name() satisfies the updated interface.

Method addition is straightforward and stable.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
api/pull.go (2)

386-393: Fix data race: iterating over api.filters without holding the mutex can panic

filterExpiryChecker ranges over api.filters while other goroutines add/remove filters under api.mux. This can cause "concurrent map iteration and map write" panics. Collect expired IDs under lock, then uninstall outside the lock.

Apply this diff:

 func (api *PullAPI) filterExpiryChecker() {
-	for range time.Tick(api.config.FilterExpiry) {
-		for id, f := range api.filters {
-			if f.expired() {
-				api.logger.Debug().Str("id", string(id)).Msg("filter expired")
-				api.UninstallFilter(id)
-			}
-		}
-	}
+	ticker := time.NewTicker(api.config.FilterExpiry)
+	defer ticker.Stop()
+	for range ticker.C {
+		var expired []rpc.ID
+		api.mux.Lock()
+		for id, f := range api.filters {
+			if f.expired() {
+				expired = append(expired, id)
+			}
+		}
+		api.mux.Unlock()
+		for _, id := range expired {
+			api.logger.Debug().Str("id", string(id)).Msg("filter expired")
+			api.UninstallFilter(id)
+		}
+	}
 }

400-406: Off-by-one on max filters check; consider returning an error

if len(api.filters) > maxFilters allows one extra filter (10,001st). Use >=. Also, returning "" without error makes upstream return success with an empty ID.

Apply this minimal fix now:

-	if len(api.filters) > maxFilters {
-		return ""
-	}
+	if len(api.filters) >= maxFilters {
+		api.logger.Warn().Int("limit", maxFilters).Msg("max filters limit reached")
+		return ""
+	}

Optionally, we should propagate an error to callers so JSON-RPC returns a proper error instead of an empty ID. I can draft that change if desired.

🧹 Nitpick comments (3)
cmd/run/cmd.go (2)

218-225: Make flag parsing resilient to casing/whitespace

Normalize the input to avoid surprising rejections like "Tx-Seal" or trailing spaces.

-	switch txStateValidation {
+	txStateValidation = strings.ToLower(strings.TrimSpace(txStateValidation))
+	switch txStateValidation {

127-129: Wrong variable in error message

This path validates cloudKMSKey but prints key (COA private key), misleading users.

-				return fmt.Errorf("wrong format for Cloud KMS key: %s", key)
+				return fmt.Errorf("wrong format for Cloud KMS key: %s", cloudKMSKey)
models/transaction.go (1)

153-155: Confirm encode/decode round-trip for DirectCall

Switching to dc.Encode() should keep MarshalBinary consistent with DirectCallFromEncoded. Recommend a quick round-trip test to guard against future Cadence upgrades.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 736c332 and aa81143.

📒 Files selected for processing (4)
  • api/pull.go (1 hunks)
  • cmd/run/cmd.go (1 hunks)
  • models/transaction.go (3 hunks)
  • tests/tx_batching_test.go (8 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: m-Peter
PR: onflow/flow-evm-gateway#738
File: .github/workflows/ci.yml:19-19
Timestamp: 2025-01-29T17:20:28.143Z
Learning: Go 1.23 was released and is available for use in CI/CD pipelines and Docker images.
🧬 Code graph analysis (1)
cmd/run/cmd.go (1)
config/config.go (3)
  • LocalIndexValidation (29-29)
  • TxStateValidation (26-26)
  • TxSealValidation (30-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Lint
  • GitHub Check: Test
🔇 Additional comments (12)
api/pull.go (1)

181-181: Nil-safe boolean simplification LGTM

The new full := fullTx != nil && *fullTx is correct and clearer.

cmd/run/cmd.go (1)

218-225: Switch-based mapping reads well and preserves behavior

Mapping user flag to cfg.TxStateValidation via switch is clear; default error remains intact.

models/transaction.go (2)

82-85: Access path update LGTM; verify To() semantics with deploy calls

Using dc.EmptyToField() aligns with promoted API. Please ensure we still return nil for deployments and the correct to otherwise (add/keep a focused test).


105-107: Gas accessor update LGTM

Returning dc.GasLimit matches the promoted field.

tests/tx_batching_test.go (8)

21-23: Import reorder OK

No behavioral change.


172-176: Block height API change handled correctly

Using startBlock.Height/endBlock.Height aligns with the struct update.


255-256: Height lookup update LGTM

latestBlock.Height + 1 is correct with the new API.


271-271: Second height lookup update LGTM

Consistent with the first change.


369-370: Height lookup update LGTM (recent interval test)

Matches the new Block.Height field.


385-385: Second height lookup update LGTM (recent interval test)

Consistent change.


484-485: Height lookup update LGTM (non-recent interval test)

Consistent with other tests.


500-500: Second height lookup update LGTM (non-recent interval test)

Consistent change.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (4)
bootstrap/bootstrap.go (1)

432-432: Consider logging Close() errors at debug level instead of fully discarding.

Swallowing Close() is fine in shutdown paths, but a debug log helps post-mortems if Close() indicates a partial/forced teardown.

-            _ = b.profiler.Close()
+            if cerr := b.profiler.Close(); cerr != nil {
+                b.logger.Debug().Err(cerr).Msg("forced profiler close returned error")
+            }
cmd/blocks/cmd.go (1)

24-26: Defer Close() with error ignored is acceptable here; optionally surface at debug.

This CLI is read-only, but Pebble Close() errors can be interesting under FS issues. Consider a low-noise debug log.

-        defer func() {
-            _ = pebbleDB.Close()
-        }()
+        defer func() {
+            if err := pebbleDB.Close(); err != nil {
+                log.Debug().Err(err).Msg("pebble close error")
+            }
+        }()
api/server.go (2)

251-271: Close the original request body, not the re-wrapped NopCloser.

After reassigning r.Body, the Close() currently targets the new NopCloser (a no-op), not the original body. Close the original to be precise and avoid subtle leaks under proxies/middleboxes.

-    if b, err := io.ReadAll(r.Body); err == nil {
+    origBody := r.Body
+    if b, err := io.ReadAll(origBody); err == nil {
         _ = json.Unmarshal(b, &requestBody)
         ...
-        r.Body = io.NopCloser(bytes.NewBuffer(b))
-        _ = r.Body.Close()
+        r.Body = io.NopCloser(bytes.NewBuffer(b))
+        _ = origBody.Close()
     }

327-330: Ignoring Close() errors during forced shutdown is reasonable; consider errors.Is on Shutdown.

LGTM to discard Close() errors here. As a tiny robustness nit, use errors.Is for the Shutdown timeout check.

-    if err != nil && err == ctx.Err() {
+    if err != nil && (errors.Is(err, context.DeadlineExceeded) || errors.Is(err, ctx.Err())) {
         h.logger.Warn().Msg("HTTP server graceful shutdown timed out")
         _ = h.server.Close()
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa81143 and 1c0189f.

📒 Files selected for processing (3)
  • api/server.go (2 hunks)
  • bootstrap/bootstrap.go (1 hunks)
  • cmd/blocks/cmd.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
🔇 Additional comments (1)
cmd/blocks/cmd.go (1)

10-12: Import reordering looks fine.

@m-Peter m-Peter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! 💯

@m-Peter
m-Peter merged commit 12eaf53 into main Sep 11, 2025
2 checks passed
@m-Peter
m-Peter deleted the auto-update-onflow-cadence-v1.7.0 branch September 11, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants