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

Add block numbers of network upgrades #912

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fvictorio
Copy link

The network upgrades table is very useful but sometimes you want to know the exact block number at which an ugprade was activated. I added these numbers in the table, following a methodology I'll explain below. I'd recommend someone triple-checks them with some other approach (I guess this information must be somewhere else?).

My approach to get the block numbers was mainly taking the timestamp and using etherscan "Timestamp to Block" feature (op mainnet, op sepolia) to get the block number.

Then, for all upgrades except Delta and Granite, I ran a separate check to confim this was the right block number:

  • For Canyon, I checked that PUSH0 was available in that block, but not in the previous one
  • For Ecotone, I checked that TLOAD was available in that block, but not in the previous one
  • For Fjord, I checked that calling isFjord() in GasPriceOracle returned true in that block, and reverted in the previous one.

Delta doesn't seem to have any way to check its activation using only the JSON-RPC layer, so I just used the result of Etherscan, with one caveat: for mainnet, the value I got was 116480611, but all the other mainnet blocks I got ended in 12, so I used 116480612, since it's too much of a coincidence (and the timestamp-to-block tool can have off-by-one errors).

For Granite I guess I could check if the bn256Pairing precompile has the additional validation, but that seems more work than I can put into this today 😅

Also: the timestamp of the Fjord upgrade for OP Sepolia seems wrong. It had a different date than mainnet, but the UNIX timestamp was the same. I guess it was a copy-paste error.

@fvictorio fvictorio requested a review from a team as a code owner September 20, 2024 11:43
Copy link
Contributor

coderabbitai bot commented Sep 20, 2024

Walkthrough

The changes involve updates to the network upgrades documentation, specifically enhancing the table that lists various upgrades by adding block numbers to their activation timestamps for both the OP Mainnet and OP Sepolia. This includes upgrades such as Granite, Fjord, Ecotone, Delta, and Canyon, while maintaining the existing governance approval links. The timestamp format has been slightly adjusted to include the block number.

Changes

File Path Change Summary
pages/builders/node-operators/network-upgrades.mdx Added block numbers to activation timestamps for network upgrades; modified timestamp format.

Possibly related issues

Possibly related PRs

  • fix broken links #814: This PR updates links in the network-upgrades.mdx file, which is directly related to the main PR's focus on network upgrades, specifically regarding the activation configurations.
  • docs: fjord upgrade completed. #888: This PR modifies the network-upgrades.mdx file to reflect the governance approval status and corrects timestamps for the Fjord upgrade, aligning with the main PR's updates on upgrade activations.
  • Add Granite to network upgrades page. #890: This PR adds detailed descriptions and links for various network upgrades, including Granite, Fjord, Ecotone, Delta, and Canyon, which are also mentioned in the main PR.
  • making updates after the granite activation #899: This PR updates documentation to reflect changes introduced by the Granite activation, which is a key focus of the main PR regarding network upgrades.

Suggested reviewers

  • sbvegan: Suggested reviewer due to their expertise in network upgrades documentation.
  • krofax: Suggested reviewer who may provide valuable insights on the changes made in this PR.

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

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

netlify bot commented Sep 20, 2024

Deploy Preview for docs-optimism ready!

Name Link
🔨 Latest commit a899a96
🔍 Latest deploy log https://app.netlify.com/sites/docs-optimism/deploys/66fa6224a679290008d68c3e
😎 Deploy Preview https://deploy-preview-912--docs-optimism.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@krofax
Copy link
Contributor

krofax commented Sep 27, 2024

@sbvegan how can i confirm that the values in this PR are correct?

@sbvegan
Copy link
Collaborator

sbvegan commented Sep 27, 2024

@fvictorio, thank you for taking the time to investigate this and update our documentation. However, our L2 network upgrades (hard forks) are actually activated by timestamp and not block number. My initial gut feeling is to not add the block numbers they activated at because it doesn't reflect the protocols behavior and might cause confusion. Perhaps we can make a more emphasis on the timestamp activation and link to specs that might describe this in more detail.

@krofax to check the activation timestamps, you can use the superchain-registry as the canoncial source of truth:

@fvictorio
Copy link
Author

@sbvegan thanks for the answer. I know Optimism's upgrades are timestamp-based and not block based, but sometimes you want to know at which block the activation happened because the JSON-RPC layer is still based in block numbers.

For example, in EDR (Hardhat's network simulation engine) we have some tests that fork Mainnet and Optimism at different blocks and replay the transactions to make sure our logic matches the one in the live chain. We normally want to do this for more than one hardfork, and so we need to know the block numbers where it happened. And while it's not super hard to obtain them manually (as I did in this PR), it's frustrating that there's no place in the docs that tells you these values.

I understand that this might be misleading, but the very first sentence before that table explicitly says that upgrades are activated by timestamps. If you still think the trade-off is not worth it, then I think there are two options:

  1. We can close this PR (although I'd recommend fixing the wrong timestamp which I mentioned) and I'll put this information somewhere else.
  2. We can rephrase the content of the table to make it even more clear that these blocks are not what triggers the activation, but I can't think of a good way to do that that doesn't make the content more verbose.

Copy link
Collaborator

@sbvegan sbvegan left a comment

Choose a reason for hiding this comment

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

@fvictorio This makes sense and if its useful to you we'll include it in the docs for reference. However, I can't promise that we'll be able to maintain these block heights very well. Can you:

  1. Update the blockheight language to say something like, "at or around block x"?
  2. Add back ticks around the block number `?

Thank you for fixing the timestamps!

@fvictorio
Copy link
Author

Done, thanks!

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

🧹 Outside diff range and nitpick comments (2)
pages/builders/node-operators/network-upgrades.mdx (2)

26-30: Clarify activation mechanism in the table header

The addition of block numbers provides valuable information for developers. However, to avoid potential confusion, consider adding a note in the table header or as a footnote to clarify that upgrades are activated by timestamps, not block numbers.

Consider adding the following note above or below the table:

Note: Network upgrades are activated based on timestamps. Block numbers are provided for reference only and may vary slightly due to block time variations.

This clarification aligns with the concerns raised in the PR discussion while maintaining the useful information for developers.


Line range hint 1-200: Minor style improvements

The document generally follows the coding guidelines, but there are a few areas where we can improve consistency and clarity:

  1. Use sentence case for subheadings under "Summary of Changes" for consistency.
  2. Consider using bold text instead of all caps for emphasis in some places.
  3. Ensure proper nouns are consistently capitalized (e.g., "Optimism Collective").

Here are some suggested changes:

  1. Change subheadings under "Summary of Changes" to sentence case:

    ### Limit `bn256Pairing` precompile input size
    ### Reduce channel timeout to 50
  2. Replace all-caps emphasis with bold:

    - IMPORTANT: Your task is to ensure that each instruction is followed for each code segment you review.
    + **Important:** Your task is to ensure that each instruction is followed for each code segment you review.
  3. Capitalize proper nouns consistently:

    - governance system votes on proposals.
    + Governance system votes on proposals.

These changes will improve the overall consistency and readability of the document.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 86b86c3 and a899a96.

📒 Files selected for processing (1)
  • pages/builders/node-operators/network-upgrades.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pages/builders/node-operators/network-upgrades.mdx (1)

Pattern **/*.mdx: "ALWAYS review Markdown content THOROUGHLY with the following criteria:

  • Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
  • Avoid gender-specific language and use the imperative form.
  • Monitor capitalization for emphasis. Use bold for prominence instead of all caps or italics.
  • Ensure proper nouns are capitalized in sentences.
  • Apply the Oxford comma.
  • Use proper title case for headers, buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
  • Use correct spelling and grammar at all times (IMPORTANT).
    "
🔇 Additional comments (1)
pages/builders/node-operators/network-upgrades.mdx (1)

Line range hint 1-200: Overall assessment: Approved with minor suggestions

The changes made to this document, particularly the addition of block numbers to the activation table, align well with the PR objectives and provide valuable information for developers. The content is informative, well-structured, and generally adheres to the coding guidelines.

To further improve the document:

  1. Consider adding a clarification note about the timestamp-based activation mechanism.
  2. Implement the suggested minor style improvements for consistency and clarity.

These changes will enhance the document's accuracy and readability while maintaining its informative nature.

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.

3 participants