Skip to content

feat: Euclid release on Scroll Sepolia #1122

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

Merged
merged 10 commits into from
Mar 5, 2025
Merged

Conversation

Thegaram
Copy link

@Thegaram Thegaram commented Feb 24, 2025

1. Purpose or design rationale of this PR

Enable Euclid upgrade on Scroll Sepolia.

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • feat: A new feature

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change

Summary by CodeRabbit

  • New Features

    • Enhanced blockchain configuration with additional time parameters and system contract settings to improve network management.
    • Expanded Layer 1 messaging capabilities with extra configuration options for more reliable message handling.
  • Chores

    • Updated the patch version from 22 to 23 to reflect the latest release improvements.
  • Bug Fixes

    • Improved error handling and logging in the signer address fetching process for better clarity and consistency.

Copy link

coderabbitai bot commented Feb 24, 2025

Walkthrough

This pull request enhances blockchain configuration settings. In params/config.go, new time parameters (EuclidTime and EuclidV2Time) are added to chain configurations, and a SystemContract structure with fields for period, address, and slot is introduced. Additionally, the L1Config now includes fields for the Layer 1 message queue, with its string representation updated accordingly. In params/version.go, the patch version is incremented from 22 to 23, reflecting a new release update.

Changes

File Change Summary
params/config.go Added EuclidTime and EuclidV2Time to ScrollSepoliaChainConfig; introduced a new SystemContract structure (with Period, SystemContractAddress, & SystemContractSlot) in ScrollAlphaChainConfig; updated L1Config by adding L1MessageQueueV2Address and L1MessageQueueV2DeploymentBlock (and its String() method).
params/version.go Updated the VersionPatch constant from 22 to 23.
consensus/system_contract/system_contract.go Updated the fetchAddressFromL1 method to simplify error handling by removing error returns and consolidating logging within the method.

Possibly related PRs

  • fix: print Euclid genesis config on startup #1118: The changes in the main PR are directly related to the modifications made to the EuclidTime and EuclidV2Time fields in the ScrollAlphaChainConfig and ScrollSepoliaChainConfig structures, which are also present in the retrieved PR's ChainConfig struct.
  • feat: enable p256Verify in EuclidV2 #1111: The changes in the main PR are related to the addition of the EuclidV2Time field in the params/config.go file, which aligns with the modifications in the retrieved PR that also reference the EuclidV2 release and its associated configurations.

Suggested labels

bump-version

Suggested reviewers

  • colinlyguo
  • omerfirmak

Poem

I hop through code with eager feet,
New fields and shifts make our config complete,
Timestamps now dance in a delightful tune,
Contracts and queues sing under the moon,
With each patch leap, I cheer—a bunny beat! 🐇


📜 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 9f586b7 and b050dff.

📒 Files selected for processing (1)
  • consensus/system_contract/system_contract.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • consensus/system_contract/system_contract.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

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.
    • 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 generate docstrings to generate docstrings 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.

@Thegaram Thegaram marked this pull request as ready for review March 4, 2025 20:33
@Thegaram Thegaram changed the title feat: Euclid release on Scroll Sepolia (wip) feat: Euclid release on Scroll Sepolia Mar 4, 2025
Copy link

@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

🧹 Nitpick comments (2)
params/config.go (2)

652-653: Consider adding documentation for Euclid fork features

While the timing parameters are properly added, it would be helpful to include documentation comments describing what the Euclid fork introduces in terms of features, changes, or improvements to the protocol.

+// EuclidTime is the timestamp when the Euclid fork goes into effect. This upgrade introduces...
 EuclidTime          *uint64  `json:"euclidTime,omitempty"`          // Euclid switch time (nil = no fork, 0 = already on euclid)
+// EuclidV2Time is the timestamp when the EuclidV2 fork goes into effect. This upgrade enhances...
 EuclidV2Time        *uint64  `json:"euclidv2Time,omitempty"`        // EuclidV2 switch time (nil = no fork, 0 = already on euclidv2)

1037-1039: Consider updating CheckConfigForkOrder for time-based forks

The CheckConfigForkOrder method currently only checks block-based forks, but does not validate the ordering of time-based forks like Darwin, DarwinV2, Euclid, and EuclidV2. Consider extending this method to ensure time-based forks are also properly ordered.

 	return nil
 }
+
+// CheckConfigTimeForksOrder checks that time-based forks are properly ordered
+func (c *ChainConfig) CheckConfigTimeForksOrder() error {
+	var lastForkTime uint64
+	
+	for _, cur := range []struct {
+		name string
+		time *uint64
+	}{
+		{name: "darwinTime", time: c.DarwinTime},
+		{name: "darwinV2Time", time: c.DarwinV2Time},
+		{name: "euclidTime", time: c.EuclidTime},
+		{name: "euclidV2Time", time: c.EuclidV2Time},
+	} {
+		if cur.time != nil {
+			if lastForkTime != 0 && *cur.time < lastForkTime {
+				return fmt.Errorf("unsupported fork ordering: %v time (%v) cannot be less than previous fork time (%v)",
+					cur.name, *cur.time, lastForkTime)
+			}
+			lastForkTime = *cur.time
+		}
+	}
+	return nil
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c454e7 and 8ef4920.

📒 Files selected for processing (2)
  • params/config.go (3 hunks)
  • params/version.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • params/version.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (8)
params/config.go (8)

331-332: Well-structured fork timing configuration for Euclid

The new fork timing parameters are properly added to the ScrollSepoliaChainConfig. The timestamp values indicate this upgrade is scheduled for mid-July 2025:

  • EuclidTime: July 18, 2025, 8:00:00 PM GMT
  • EuclidV2Time: July 20, 2025, 8:00:00 PM GMT (2 days after Euclid)

This follows the established pattern of previous forks like Darwin/DarwinV2.


337-341: New SystemContract configuration added appropriately

The addition of the SystemContract configuration block provides important parameters for the consensus mechanism:

  • Period: 3 seconds between blocks (matching Clique configuration)
  • SystemContractAddress: Contract address on L1 for system operations
  • SystemContractSlot: Storage slot for the signer address in the system contract

This implements what appears to be a new consensus mechanism or an extension to the existing one, providing better integration with the L1 chain.


714-717: String method correctly updated to include new L1Config fields

The String() method for L1Config has been properly updated to include the new V2 message queue fields in its string representation. This is important for debugging and logging purposes.


822-829: ChainConfig String method updated to include Euclid time parameters

The String() method of ChainConfig has been properly updated to include the new Euclid time parameters in its output. This ensures consistent logging and debugging capabilities for the new fork times.

Also applies to: 852-853


956-964: IsEuclid and IsEuclidV2 helper methods correctly implemented

These helper methods follow the established pattern for time-based fork activation checks, allowing the codebase to easily determine if the Euclid forks are active at a given timestamp.


1178-1178: Rules struct and method properly updated to include Euclid flags

The Rules struct and the Rules() method have been correctly updated to include the Euclid fork activation flags. This ensures that the EVM and other components can check for Euclid activation through the Rules interface.

Also applies to: 1204-1205


511-512: TestChainConfig updated to include Euclid parameters

The test configuration has been properly updated to include the new Euclid parameters, ensuring test cases can properly exercise the new fork conditions.


348-354:

✅ Verification successful

L1 Message Queue V2 configuration properly defined

The addition of V2 message queue parameters indicates an upgrade to the cross-layer messaging system:

  • L1MessageQueueV2Address points to the new message queue contract
  • L1MessageQueueV2DeploymentBlock specifies when the V2 contract was deployed (block 7773746)

This ensures that nodes know about both messaging versions and can handle the transition appropriately.


🏁 Script executed:

#!/bin/bash
# Verify if the L1MessageQueueV2 fields are properly used in the codebase

# Check for references to the new L1MessageQueueV2Address
echo "Checking for references to L1MessageQueueV2Address..."
rg -A 3 "L1MessageQueueV2Address" --type go

Length of output: 1754


L1 Message Queue V2 configuration validated and integrated correctly

The new parameters in params/config.go are correctly defined and referenced:

  • L1MessageQueueV2Address: Points to the new message queue contract.
  • L1MessageQueueV2DeploymentBlock: Specifies the deployment block (7773746) for the new contract.

Additionally, the fields are properly used in the sync service (see rollup/sync_service/sync_service.go), allowing nodes to select between V1 and V2 as intended. No further changes are required.

jonastheis
jonastheis previously approved these changes Mar 5, 2025
Copy link

@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

🧹 Nitpick comments (1)
consensus/system_contract/system_contract.go (1)

87-109: Thread-safety improvement with better error handling strategy.

The updated implementation correctly adds explicit locking with s.lock.Lock() and provides more nuanced error handling for different scenarios. This improves both thread safety and error visibility.

However, the error handling approach for empty addresses could be more consistent:

  1. Line 100 logs at Debug level
  2. Line 103 logs at Warn level
  3. Line 107 logs at Error level

These different severity levels for what appears to be the same condition might be confusing for troubleshooting.

Consider standardizing the log levels or adding more context to clarify why empty addresses are treated with different severity levels:

 // Validate the address is not empty
 if bAddress == (common.Address{}) {
-    log.Debug("retrieved empty signer address from L1 System Contract", "contract", s.config.SystemContractAddress.Hex(), "slot", s.config.SystemContractSlot.Hex())
+    log.Info("retrieved empty signer address from L1 System Contract", "contract", s.config.SystemContractAddress.Hex(), "slot", s.config.SystemContractSlot.Hex())

     if s.signerAddressL1 == (common.Address{}) {
-        log.Warn("System Contract signer address not initialized")
+        log.Warn("System Contract signer address not initialized yet, will retry")
         return
     }

-    log.Error("retrieved empty signer address from L1 System Contract")
+    log.Warn("Unexpected empty address from L1 System Contract after previous successful initialization")
     return
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ef4920 and 9f586b7.

📒 Files selected for processing (2)
  • consensus/system_contract/system_contract.go (2 hunks)
  • params/version.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • params/version.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (3)
consensus/system_contract/system_contract.go (3)

49-51: Improved error handling approach.

The code now properly attempts to initialize the signer address without blocking the constructor if the fetch fails. This is a better approach for initialization that might fail in a non-critical way, allowing the system to retry later.


81-81: Error handling simplified in background process.

The removal of error checking simplifies the periodic fetch operation. Since this runs in a background goroutine, logging errors directly in the fetch method is more appropriate than returning errors that would be ignored anyway.


95-97: Thread safety improvement with explicit locking.

Adding explicit locking here is an important improvement that ensures thread safety when modifying the shared state (s.signerAddressL1). This prevents potential race conditions when reading the address in other methods.

@Thegaram Thegaram merged commit 478940e into develop Mar 5, 2025
9 checks passed
@Thegaram Thegaram deleted the feat-sepolia-euclid-release branch March 5, 2025 15:10
@coderabbitai coderabbitai bot mentioned this pull request Mar 20, 2025
3 tasks
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