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

docs: add postmortem of zktrie fork #272

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

0xHansLee
Copy link
Contributor

@0xHansLee 0xHansLee commented Mar 14, 2024

Summary by CodeRabbit

  • Documentation
    • Updated post-mortem document detailing the ZKTrie Hardfork incident on March 12, 2024, including causes and resolution steps.

@0xHansLee 0xHansLee requested a review from a team March 14, 2024 09:14
@0xHansLee 0xHansLee self-assigned this Mar 14, 2024
Copy link
Contributor

coderabbitai bot commented Mar 14, 2024

Walkthrough

The incident report describes a critical event on March 12, 2024, where a hardfork was necessary due to a vulnerability in the KromaZKTrie module of kroma-geth version 0.4.4. This issue impacted nodes running older versions of kroma and kroma-geth, prompting the need for a chain rollback to address the issues.

Changes

File Path Change Summary
postmortems/2024-03-12-zktrie-hardfork.md Describes a chain halt incident on March 12, 2024, caused by a bug in KromaZKTrie within kroma-geth v0.4.4. Nodes using kroma v1.3.2 and kroma-geth v0.4.4 experienced issues, leading to a chain rollback for resolution.

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 646eb95 and 5a8801b.
Files ignored due to path filters (1)
  • postmortems/assets/zktrie-deletion.svg is excluded by: !**/*.svg
Files selected for processing (1)
  • postmortems/2024-03-12-zktrie-hardfork.md (1 hunks)
Additional comments: 4
postmortems/2024-03-12-zktrie-hardfork.md (4)
  • 1-1: The document title and headings are clear and appropriately formatted. However, ensure that "ZKTrie" and "Hardfork" are correctly spelled as per your project's terminology, as static analysis tools flagged them as possible spelling mistakes. These are likely false positives but verifying consistency with project terminology is crucial.
  • 5-40: Overall, the document provides a comprehensive overview of the incident, its causes, and the recovery process. It's well-structured and informative. However, consider adding a section on "Future Preventative Measures" to outline specific steps or technologies being implemented to prevent similar incidents. This could enhance the document's utility as a learning resource for the community.
  • 10-10: The explanation of the KromaZKTrie bug is clear, but the technical details might be too complex for readers unfamiliar with blockchain internals. Consider adding a simplified summary or analogy to help less technical readers grasp the impact of the bug on the network.
  • 30-30: Including a visual representation (zktrie-deletion.svg) is an excellent way to illustrate the bug's effect on the state tree. Ensure that the image is accessible and renders correctly on all platforms where the document might be viewed.

Comment on lines 38 to 40
Significant time was required for the chain to be fully recovered after this incident, resulting in a prolonged halt in
block generation. This was due to the absence of a rollback strategy during the upgrade process. In future upgrades, a
rollback strategy will always be provided alongside the upgrade.
Copy link
Contributor

Choose a reason for hiding this comment

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

The section on recovery and lessons learned is insightful. However, explicitly mentioning the development or adoption of new tools, if any, for monitoring or automating rollback processes in future incidents could provide additional value to readers.


# Incident Summary

On March 12, 2024, at 15:16:25 UTC, a hardfork occurred at block number 8171899.

Choose a reason for hiding this comment

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

I guess 'fork' is the more appropriate word than 'hardfork' in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to 'fork' as you mentioned. Thank you

@0xHansLee 0xHansLee changed the title docs: add postmortem of zktrie hardfork docs: add postmortem of zktrie fork Mar 15, 2024
@0xHansLee 0xHansLee force-pushed the docs/zktrie-postmortem branch from 5a8801b to acd78a9 Compare March 18, 2024 01:41
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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 646eb95 and acd78a9.
Files ignored due to path filters (1)
  • postmortems/assets/zktrie-deletion.svg is excluded by: !**/*.svg
Files selected for processing (1)
  • postmortems/2024-03-12-zktrie-hardfork.md (1 hunks)

@@ -0,0 +1,85 @@
# 2024-03-12 Chain Halt due to ZKTrie Upgrade Post-Mortem
Copy link
Contributor

Choose a reason for hiding this comment

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

The title of the document contains "Post-Mortem" which is commonly written as "Postmortem" or "Post-mortem". Consider standardizing the spelling for consistency with common industry practices.

- # 2024-03-12 Chain Halt due to ZKTrie Upgrade Post-Mortem
+ # 2024-03-12 Chain Halt due to ZKTrie Upgrade Postmortem

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
# 2024-03-12 Chain Halt due to ZKTrie Upgrade Post-Mortem
# 2024-03-12 Chain Halt due to ZKTrie Upgrade Postmortem

should be removed, leaving an empty node. However, in this case, after deleting the node, another child node was
mistakenly set as the root node, altering the state tree and resulting in a different state root value.

![zktrie-deletion.svg](assets/zktrie-deletion.svg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the existing comment about the ambiguity of using "L" to denote a leaf or a left node, it's advisable to clarify the diagram or its description to ensure readers can easily understand the tree structure and the issue being described.

Consider adding a more detailed explanation or legend for the diagram to address the ambiguity and enhance understanding.

@0xHansLee 0xHansLee merged commit b5621b2 into dev Mar 19, 2024
2 checks passed
@0xHansLee 0xHansLee deleted the docs/zktrie-postmortem branch March 19, 2024 12: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.

5 participants