Skip to content

Conversation

@tim-barry
Copy link
Contributor

@tim-barry tim-barry commented Jul 25, 2025

This PR implements the first part of required changes for issue #80, covering most major malleability changes (everything up until 2025-07-30).

Summary by CodeRabbit

  • New Features

    • Added support for protocol version 8, including updated hashing and verification logic for blocks, events, execution receipts, and collection guarantees.
  • Bug Fixes

    • Corrected JSON configuration by fixing object closure in the accounts section.
    • Improved timestamp formatting for finalized block logs to ensure accurate time representation.
  • Chores

    • Upgraded Go toolchain and multiple dependencies to newer versions for improved stability and compatibility.
    • Extended spork version validation to accept versions up to 8.
    • Added clarifying documentation for internal spork versioning.

@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Walkthrough

The changes update dependency versions in the Go module, extend protocol support to version 8 in state conversion logic, adjust spork version validation, correct a JSON syntax error, and refine timestamp handling in block finalization logs. Several new functions and case branches are added to support protocol version 8's updated hashing and verification schemes.

Changes

Cohort / File(s) Change Summary
Dependency and Toolchain Upgrades
go.mod
Upgraded Go version, toolchain, and numerous direct and indirect dependencies, including core blockchain, cryptography, telemetry, and cloud SDK libraries.
Protocol v8 Support in State Conversion
state/convert.go
Added support for protocol version 8 in block, event, execution receipt, and collection guarantee hashing and verification. Introduced new helper functions and updated logic to accommodate new data structures and hashing schemes.
Spork Version Validation
config/config.go
Extended allowed spork version range from 1–7 to 1–8 in validation logic. Added detailed comment on the Version field.
Block Timestamp Logging
state/state.go
Changed block timestamp formatting to convert from milliseconds since epoch before formatting to RFC3339.
JSON Syntax Fix
script/flow.json
Added a missing closing brace to fix the JSON structure for the "localnet-service-account" entry.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant StateConverter
    participant HashingFunctions

    Client->>StateConverter: Submit block/event/receipt (protocol version 8)
    StateConverter->>HashingFunctions: Call deriveBlockHashV8 / deriveEventsHashV8 / deriveExecutionReceiptHash / deriveCollectionGuaranteeID
    HashingFunctions-->>StateConverter: Return computed hash (v8 logic)
    StateConverter-->>Client: Return/verify result with v8-compliant hash
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

Suggested reviewers

  • peterargue
  • franklywatson

Poem

A rabbit hops through lines of code,
Upgrading modules on its road.
Spork eight arrives—new hashes sprout,
JSON braces sorted out.
Milliseconds now make time so neat,
With every hop, the code’s complete!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 ff8337b and c044abe.

📒 Files selected for processing (1)
  • config/config.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/config.go
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tim/malleability

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

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.

@tim-barry
Copy link
Contributor Author

Completed testing Rosetta (Initially on benchnet, finished on localnet) according to https://github.com/onflow/rosetta/blob/main/script/README.md, everything looks good.

@tim-barry tim-barry marked this pull request as ready for review August 4, 2025 22:25
Copy link
Member

@jordanschalm jordanschalm left a comment

Choose a reason for hiding this comment

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

Functionally the changes looks good to me.

}

if spork.Version < 1 || spork.Version > 7 {
if spork.Version < 1 || spork.Version > 8 {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment to the Spork.Version field:

// Version is a Rosetta-internal version number that tracks Rosetta compatibility with Flow network versions.
// This version number is incremented each time there is a Flow network upgrades which includes a breaking change for Rosetta.
// Not all Flow network upgrades cause breaking changes for Rosetta, so this version number is not incremented for every network upgrade.

Co-authored-by: Jordan Schalm <jordan.schalm@flowfoundation.org>
Copy link
Collaborator

@UlyanaAndrukhiv UlyanaAndrukhiv left a comment

Choose a reason for hiding this comment

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

Looks good to me👍

@tim-barry tim-barry merged commit 3c53a74 into main Sep 5, 2025
1 check passed
@tim-barry tim-barry deleted the tim/malleability branch September 5, 2025 22:43
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.

4 participants