Skip to content

Update derive events hash test - #62

Merged
peterargue merged 6 commits into
onflow:mainfrom
The-K-R-O-K:illia-malachyn/56-update-derive-events-hash-test
May 28, 2024
Merged

Update derive events hash test#62
peterargue merged 6 commits into
onflow:mainfrom
The-K-R-O-K:illia-malachyn/56-update-derive-events-hash-test

Conversation

@illia-malachyn

@illia-malachyn illia-malachyn commented May 27, 2024

Copy link
Copy Markdown
Contributor

Closes #56

This PR is made on top #53

Summary by CodeRabbit

  • New Features

    • Updated spork configuration to include a new access node and updated root block and version.
  • Improvements

    • Enhanced event and transaction processing with new encoding version for better compatibility and performance.
  • Bug Fixes

    • Improved error handling and logging for event collection processes.
  • Configuration Updates

    • Updated testnet clone configuration with new spork details.

@coderabbitai

coderabbitai Bot commented May 27, 2024

Copy link
Copy Markdown

Walkthrough

The recent changes introduce an EventEncodingVersion field to several functions in access/access.go, update decoding logic in state/convert.go, and modify test configurations in state/convert_test.go. Additionally, the state/process.go loop handling event hashes has been improved, and the testnet-clone.json file has been updated with new spork configurations. These changes aim to enhance event and transaction processing, improve test reliability, and ensure consistency in spork configurations.

Changes

Files Change Summary
access/access.go Added EventEncodingVersion: entities.EventEncodingVersion_CCF_V0 to various functions to standardize event encoding.
state/convert.go Updated imports and replaced jsoncdc.Decode with decodePayload to handle different payload decoding scenarios.
state/convert_test.go Updated accessAddr, startBlockHeight, and endBlockHeight values, and changed Version and RootBlock in createSpork function.
state/process.go Modified loop to assign eventHash from eventHashes and improved error logging for event collection comparison.
testnet-clone.json Updated sporks configuration with new root_block, version, and added a new address to the access_nodes list.

Assessment against linked issues

Objective Addressed Explanation
[Rosetta] Fix TestDeriveEventsHash test (#56)

In the code's embrace, events now align,
With hashes derived, in a sequence so fine.
New versions take flight, encoding the tale,
As blocks and transactions through the system sail.
Sporks updated, nodes join the dance,
In the world of Flow, we now enhance.


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 full the 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 bab50a2 and 7049b1e.
Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum
Files selected for processing (5)
  • access/access.go (6 hunks)
  • state/convert.go (3 hunks)
  • state/convert_test.go (3 hunks)
  • state/process.go (2 hunks)
  • testnet-clone.json (1 hunks)
Additional comments not posted (5)
testnet-clone.json (1)

21-28: The updates to the spork configuration look correct and align with the intended changes for spork ID 37.

state/convert_test.go (1)

16-18: The updates to the test configuration parameters and the createSpork function align with the new spork settings and are correctly implemented.

Also applies to: 152-155

state/convert.go (1)

7-9: The introduction of new imports and the decodePayload function enhances the handling of different payload formats, aligning with the new EventEncodingVersion. This is a positive change for maintaining robustness in event data processing.

Also applies to: 207-214

access/access.go (1)

168-170: The inclusion of the EventEncodingVersion field in API calls is correctly implemented and essential for ensuring consistent event data handling across the system.

Also applies to: 390-391, 411-413, 434-435, 460-461, 481-482

state/process.go (1)

Line range hint 307-324: Improved error handling and event hash comparison logic.

The changes made to the event hash comparison logic and the addition of detailed error messages enhance the robustness of the function. This should help in identifying and debugging issues related to event hash mismatches more effectively.

Comment thread state/convert_test.go Outdated
}
var execResult *entities.ExecutionResult

//TODO: ILLIA: chunk[0].EventCollection is empty! but should be equal to hash?

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.

is this from the live network?

@illia-malachyn illia-malachyn May 28, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, this is obsolete. I removed this comment. I noticed such a behavior only for the root block of a new spork.
Is it expected? You can resolve this thread and merge if so

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 7049b1e and ca302e4.
Files selected for processing (1)
  • state/convert_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • state/convert_test.go

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.

[Rosetta] Fix TestDeriveEventsHash test

2 participants