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

feat(rollapp): enforce EIP155 chain ID for rollapp creation #1020

Merged
merged 11 commits into from
Aug 7, 2024

Conversation

zale144
Copy link
Contributor

@zale144 zale144 commented Jul 30, 2024

Description


Closes #1014

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

PR review checkboxes:

I have...

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Targeted PR against the correct branch
  • included the correct type prefix in the PR title
  • Linked to the GitHub issue with discussion and accepted design
  • Targets only one GitHub issue
  • Wrote unit and integration tests
  • Wrote relevant migration scripts if necessary
  • All CI checks have passed
  • Added relevant godoc comments
  • Updated the scripts for local run, e.g genesis_config_commands.sh if the PR changes parameters
  • Add an issue in the e2e-tests repo if necessary

SDK Checklist

  • Import/Export Genesis
  • Registered Invariants
  • Registered Events
  • Updated openapi.yaml
  • No usage of go map
  • No usage of time.Now()
  • Used fixed point arithmetic and not float arithmetic
  • Avoid panicking in Begin/End block as much as possible
  • No unexpected math Overflow
  • Used sendCoin and not SendCoins
  • Out-of-block compute is bounded
  • No serialized ID at the end of store keys
  • UInt to byte conversion should use BigEndian

Full security checklist here

----;

For Reviewer:

  • Confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • Confirmed all author checklist items have been addressed

---;

After reviewer approval:

  • In case the PR targets the main branch, PR should not be squash merge in order to keep meaningful git history.
  • In case the PR targets a release branch, PR must be rebased.

Summary by CodeRabbit

  • New Features

    • Enhanced rollapp ID generation using a new randomization method for improved uniqueness.
    • Introduced a new method for retrieving rollapps by name.
  • Bug Fixes

    • Improved error handling in rollapp creation processes to provide clearer error messages.
  • Tests

    • Expanded test cases to include dynamic rollapp ID generation and ensure functionality across various scenarios.
  • Chores

    • Updated import statements for clarity and organization.

@zale144 zale144 self-assigned this Jul 30, 2024
@zale144 zale144 requested a review from a team as a code owner July 30, 2024 11:58
@omritoptix omritoptix linked an issue Jul 31, 2024 that may be closed by this pull request
Copy link
Contributor

@danwt danwt left a comment

Choose a reason for hiding this comment

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

Nice cleanup in general
Left a few things

app/apptesting/test_suite.go Outdated Show resolved Hide resolved
app/apptesting/test_suite.go Outdated Show resolved Hide resolved
x/rollapp/keeper/msg_server_create_rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/msg_server_create_rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/msg_server_create_rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/msg_server_create_rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/rollapp.go Outdated Show resolved Hide resolved
x/rollapp/types/errors.go Outdated Show resolved Hide resolved
@omritoptix omritoptix changed the title feat(rollapp): Enforce EIP155 chain ID for rollapp creation feat(rollapp): enforce EIP155 chain ID for rollapp creation Aug 7, 2024
Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

The recent changes enhance the rollapp ID generation and validation processes, standardizing them across different components. The shift from random string generation to using the urand.RollappID() function ensures consistency and compliance with EIP155 standards. Additionally, error handling improvements and the introduction of new methods aim to bolster the overall robustness of the codebase, making it more reliable for future rollapp implementations.

Changes

Files Change Summary
app/apptesting/test_suite.go, x/incentives/client/cli/query_test.go, x/incentives/keeper/suite_test.go, x/rollapp/keeper/msg_server_create_rollapp_test.go, x/rollapp/keeper/rollapp_suite_test.go, x/rollapp/keeper/rollapp_test.go Updated rollapp ID generation from random strings to urand.RollappID() for consistency and compliance with EIP155 standards.
app/export.go, x/rollapp/keeper/rollapp.go, x/rollapp/types/errors.go Improved error handling and validation logic, including replacing error-returning functions with must functions to prevent silent failures.
go.mod Updated dependency version for github.com/dymensionxyz/sdk-utils.
x/rollapp/keeper/rollapp.go Added a new method GetRollappByName and updated chain ID handling.

Assessment against linked issues

Objective Addressed Explanation
All rollapps ID should follow the EIP155 standards (#1014)
Enhance error handling in rollapp functionality (#1014)

🐇 In the code where the rollapps play,
Unique IDs now lead the way!
With urand guiding, no more strife,
Robust and clear, the future's bright!
Errors handled, standards met,
In this rabbit's world, no regret! 🥕


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

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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, codebase verification and nitpick comments (1)
x/rollapp/keeper/invariants.go (1)

Reintroduce EIP155 Format Check in RollappByEIP155KeyInvariant

The EIP155 format is extensively used across the codebase, including in invariants, queries, and key management functions. Removing the EIP155 format check in the RollappByEIP155KeyInvariant function could compromise data integrity. Please reintroduce the EIP155 format check to ensure consistency and integrity of the rollapp data.

  • Files Impacted:
    • x/rollapp/keeper/invariants.go
Analysis chain

Line range hint 39-57:
LGTM! But verify the impact of removing the EIP155 format check.

The removal of the EIP155 format check simplifies the logic and ensures that all rollapps are processed uniformly.

However, ensure that this change does not introduce any issues in other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing the EIP155 format check on the codebase.

# Test: Search for any references to the removed EIP155 format check. Expect: No issues introduced.
rg --type go 'NewChainID'

Length of output: 1032


Script:

#!/bin/bash
# Description: Extract the implementation of the NewChainID and MustNewChainID functions to verify their logic.

# Extract the implementation of NewChainID function
ast-grep --lang go --pattern 'func NewChainID($_) ($_, $_) { $$$ }' -A 20

# Extract the implementation of MustNewChainID function
ast-grep --lang go --pattern 'func MustNewChainID($_) $_ { $$$ }' -A 20

Length of output: 4437


Script:

#!/bin/bash
# Description: Search for other invariants or checks related to the EIP155 format in the codebase.

# Search for references to EIP155 in the codebase to identify other checks or invariants.
rg --type go 'EIP155'

Length of output: 10114

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between babc49b and 443bd0a.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (19)
  • app/apptesting/test_suite.go (2 hunks)
  • app/upgrades/v4/upgrade_test.go (1 hunks)
  • go.mod (1 hunks)
  • x/incentives/client/cli/query_test.go (2 hunks)
  • x/incentives/keeper/suite_test.go (2 hunks)
  • x/rollapp/genesis_test.go (3 hunks)
  • x/rollapp/keeper/block_height_to_finalization_queue_test.go (14 hunks)
  • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go (9 hunks)
  • x/rollapp/keeper/invariants.go (2 hunks)
  • x/rollapp/keeper/invariants_test.go (3 hunks)
  • x/rollapp/keeper/msg_server_create_rollapp_test.go (10 hunks)
  • x/rollapp/keeper/msg_server_update_state_test.go (17 hunks)
  • x/rollapp/keeper/rollapp.go (4 hunks)
  • x/rollapp/keeper/rollapp_suite_test.go (2 hunks)
  • x/rollapp/keeper/rollapp_test.go (2 hunks)
  • x/rollapp/types/chain_id.go (1 hunks)
  • x/rollapp/types/errors.go (1 hunks)
  • x/sequencer/keeper/msg_server_create_sequencer_test.go (4 hunks)
  • x/sequencer/keeper/sequencer_suite_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • x/rollapp/types/errors.go
Additional comments not posted (68)
x/rollapp/genesis_test.go (1)

15-18: Good use of constants for readability and maintainability.

Replacing hardcoded RollappId values with constants enhances the readability and maintainability of the test code.

x/rollapp/types/chain_id.go (6)

43-43: Improved error message for maintainability.

Referencing types.MaxChainIDLen dynamically in the error message improves maintainability.


49-49: Enhanced error handling for invalid chain IDs.

The enhanced error handling improves the robustness of the NewChainID function.


54-54: Base-10 integer format validation for EIP155 part.

Ensuring that the EIP155 part is in base-10 integer format enhances the reliability of the chain ID parsing logic.


57-59: Improved error reporting for revision number parsing.

Enhanced error reporting for parsing the revision number improves the clarity of error messages.


62-67: Streamlined chain ID parsing logic.

The streamlined chain ID parsing logic makes the NewChainID function more straightforward and easier to understand.


70-75: Introduction of MustNewChainID for simplified chain ID creation.

The MustNewChainID function provides a more straightforward way to obtain a ChainID without handling errors explicitly, offering an alternative method for chain ID creation.

x/rollapp/keeper/rollapp_test.go (4)

18-19: Consistent renaming of keeper to k.

Renaming the keeper variable to k enhances the consistency and readability of the test code.


34-35: Consistent renaming of keeper to k.

Renaming the keeper variable to k enhances the consistency and readability of the test code.


48-49: Consistent renaming of keeper to k.

Renaming the keeper variable to k enhances the consistency and readability of the test code.


56-89: Introduction of TestKeeper_FindRollappByName for expanded test coverage.

The TestKeeper_FindRollappByName function expands the test coverage by introducing functionality tests for rollapp name retrieval, enhancing the robustness of the test suite.

x/rollapp/keeper/rollapp_suite_test.go (2)

12-12: Import statement approved.

The import statement for the urand package is correct and necessary for the new functionality.


71-71: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to createNRollapp are updated if necessary.

x/sequencer/keeper/sequencer_suite_test.go (2)

13-13: Import statement approved.

The import statement for the urand package is correct and necessary for the new functionality.


55-55: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to CreateRollappWithInitialSequencer are updated if necessary.

x/incentives/client/cli/query_test.go (2)

13-13: Import statement approved.

The import statement for the urand package is correct and necessary for the new functionality.


35-35: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to CreateDefaultRollapp are updated if necessary.

x/rollapp/keeper/invariants_test.go (2)

62-62: LGTM! Verify the identifier format consistency.

The rollapp identifiers have been updated to the new format. Ensure that this format is consistent across the codebase.

Verification successful

Verification successful!

The new rollapp identifier format is used consistently across the codebase.

  • Instances of rollapp_ identifiers in various files follow the pattern rollapp_<numeric>-<revision>.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'rollapp_'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type go -A 5 $'rollapp_'

Length of output: 39203


34-34: LGTM! Verify the identifier format consistency.

The rollapp identifier has been updated to the new format. Ensure that this format is consistent across the codebase.

Verification successful

Let's correct the file type and re-run the search to verify the consistency of the rollapp identifier format.


The rollapp identifier format is consistent across the codebase.

The rollapp identifier "rollapp_-" is used consistently in various files and contexts. The changes in x/rollapp/keeper/invariants_test.go align with this format.

  • x/rollapp/keeper/invariants_test.go
  • x/rollapp/genesis_test.go
  • x/sequencer/types/tx.pb.go
  • x/incentives/types/query.pb.gw.go
  • x/eibc/types/demand_order.pb.go
  • x/eibc/types/types.go
  • x/sequencer/types/events.go
  • x/incentives/types/gauge.pb.go
  • x/eibc/types/query.pb.go
  • x/rollapp/types/events.go
  • x/rollapp/types/proposal.pb.go
  • x/rollapp/types/tx.pb.go
  • x/rollapp/types/rollapp.pb.go
  • x/eibc/client/cli/query_command_orders.go
  • x/rollapp/keeper/rollapp_test.go
  • x/rollapp/keeper/msg_server_update_rollapp_test.go
  • x/rollapp/keeper/block_height_to_finalization_queue_test.go
  • x/rollapp/keeper/msg_server_create_rollapp_test.go
  • x/sequencer/keeper/msg_server_update_sequencer_test.go
  • x/common/types/events.go
  • x/common/types/rollapp_packet.pb.go
  • x/delayedack/types/genesis.pb.go
  • x/delayedack/keeper/invariants_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'rollapp_'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type go -A 5 $'rollapp_'

Length of output: 39203

app/apptesting/test_suite.go (2)

34-34: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

LGTM! The rollapp identifier generation mechanism is consistent across the codebase.

The usage of urand.RollappID() is consistent in various files, ensuring uniformity in the rollapp identifier generation mechanism.

  • Files with consistent usage:
    • x/sequencer/keeper/sequencer_suite_test.go
    • x/rollapp/keeper/msg_server_create_rollapp_test.go
    • x/rollapp/keeper/msg_server_update_state_test.go
    • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
    • x/rollapp/keeper/rollapp_suite_test.go
    • x/incentives/keeper/suite_test.go
    • x/incentives/client/cli/query_test.go
    • app/apptesting/test_suite.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type go -A 5 $'urand.RollappID()'

Length of output: 12326


9-12: LGTM! Verify the identifier format consistency.

The rollapp identifier format has been updated. Ensure that this format is consistent across the codebase.

Verification successful

The new rollapp identifier format is consistent across the codebase.

The rollapp_ identifier format is used uniformly in various files, confirming that the new format has been applied correctly.

  • Verified files include x/sequencer/types/tx.pb.go, x/rollapp/genesis_test.go, x/eibc/types/types.go, and several others.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'rollapp_'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type go -A 5 'rollapp_'

Length of output: 39203

x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go (6)

62-62: LGTM! Verify the identifier format consistency.

The rollapp identifier has been updated to the new format. Ensure that this format is consistent across the codebase.

Verification successful

The rollapp identifier format is consistent across the codebase.

The rollapp identifier "rollapp_1234-1" is used consistently in various files and contexts, confirming that the new format is correctly applied throughout the codebase.

  • Instances found in files such as x/sequencer/types/events.go, x/sequencer/types/tx.pb.go, x/eibc/types/types.go, and others.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'rollapp_'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier format.

# Test: Search for the new rollapp identifier format. Expect: Consistent usage across the codebase.
rg --type go -A 5 'rollapp_'

Length of output: 39203


100-100: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

LGTM! The rollapp identifier generation mechanism is consistent.

The usage of urand.RollappID() is consistent across the codebase, confirming the uniform application of the new identifier generation mechanism.

  • Instances found in multiple files such as:
    • x/sequencer/keeper/sequencer_suite_test.go
    • x/rollapp/keeper/msg_server_update_state_test.go
    • x/incentives/keeper/suite_test.go
    • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()` in Go files. Expect: Consistent usage across the codebase.
rg --type go -A 5 $'urand.RollappID()'

Length of output: 12326


206-207: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

The rollapp identifier generation mechanism is consistent across the codebase.

The usage of urand.RollappID() is consistently applied in multiple files, confirming the uniformity of the new rollapp identifier generation mechanism.

  • x/sequencer/keeper/msg_server_create_sequencer_test.go
  • x/sequencer/keeper/sequencer_suite_test.go
  • x/incentives/keeper/suite_test.go
  • x/incentives/client/cli/query_test.go
  • x/rollapp/keeper/rollapp_suite_test.go
  • x/rollapp/keeper/msg_server_update_state_test.go
  • x/rollapp/keeper/msg_server_create_rollapp_test.go
  • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
  • app/apptesting/test_suite.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type go -A 5 'urand.RollappID()'

Length of output: 12326


229-230: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

The rollapp identifier generation mechanism is consistent across the codebase.

The new mechanism using urand.RollappID() is applied consistently in various test files, ensuring uniformity in rollapp identifier generation.

  • Verified in multiple files including:
    • x/sequencer/keeper/msg_server_create_sequencer_test.go
    • x/sequencer/keeper/sequencer_suite_test.go
    • x/incentives/keeper/suite_test.go
    • x/incentives/client/cli/query_test.go
    • x/rollapp/keeper/msg_server_update_state_test.go
    • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
    • app/apptesting/test_suite.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type go -A 5 'urand.RollappID()'

Length of output: 12326


126-127: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

The rollapp identifier generation mechanism is consistent across the codebase.

The new rollapp identifier generation mechanism using urand.RollappID() is consistently applied in various test files, ensuring uniformity.

  • x/sequencer/keeper/sequencer_suite_test.go
  • x/sequencer/keeper/msg_server_create_sequencer_test.go
  • x/rollapp/keeper/rollapp_suite_test.go
  • x/rollapp/keeper/msg_server_update_state_test.go
  • x/rollapp/keeper/msg_server_create_rollapp_test.go
  • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
  • x/incentives/keeper/suite_test.go
  • x/incentives/client/cli/query_test.go
  • app/apptesting/test_suite.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type go -A 5 $'urand.RollappID()'

Length of output: 12326


78-78: LGTM! Verify the identifier generation mechanism consistency.

The rollapp identifier generation mechanism has been updated to use urand.RollappID(). Ensure that this mechanism is consistent across the codebase.

Verification successful

Verification successful!

The rollapp identifier generation mechanism using urand.RollappID() is consistently used across the codebase, indicating proper integration.

  • x/incentives/keeper/suite_test.go
  • x/incentives/client/cli/query_test.go
  • x/rollapp/keeper/msg_server_create_rollapp_test.go
  • x/rollapp/keeper/rollapp_suite_test.go
  • x/rollapp/keeper/msg_server_update_state_test.go
  • x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
  • x/sequencer/keeper/msg_server_create_sequencer_test.go
  • x/sequencer/keeper/sequencer_suite_test.go
  • app/apptesting/test_suite.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'urand.RollappID()'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the consistency of the new rollapp identifier generation mechanism.

# Test: Search for the usage of `urand.RollappID()`. Expect: Consistent usage across the codebase.
rg --type go -A 5 'urand.RollappID()'

Length of output: 12326

app/upgrades/v4/upgrade_test.go (1)

175-175: LGTM! The use of MustNewChainID improves error handling.

The change to use MustNewChainID ensures that any errors in rollapp ID creation are handled explicitly, improving the robustness of the code.

x/incentives/keeper/suite_test.go (1)

213-213: LGTM! The use of urand.RollappID improves ID generation.

The change to use urand.RollappID for rollapp ID generation likely improves the randomness or consistency of the generated IDs.

x/rollapp/keeper/rollapp.go (6)

241-257: LGTM!

The new function GetRollappByName is well-implemented and enhances the querying capabilities of the Keeper class.


21-21: LGTM!

The change to use types.MustNewChainID enforces stricter error handling, ensuring that invalid chain IDs are not silently ignored.


126-145: LGTM!

The additional checks for rollapps by name enhance the validation process. The use of types.MustNewChainID for creating existingRollappChainId ensures stricter error handling.


143-145: LGTM!

The use of types.MustNewChainID for creating existingRollappChainId ensures stricter error handling.


172-173: LGTM!

The change to use types.MustNewChainID for creating rollappID ensures stricter error handling.


136-139: Ensure proper testing for new validation logic.

The new validation logic for checking rollapps by name should be thoroughly tested to ensure correctness.

Verification successful

The output indicates that the GetRollappByName function is tested in x/rollapp/keeper/rollapp_test.go. To ensure thorough testing of the new validation logic, we need to confirm that these tests cover scenarios where rollapps with the same name are handled correctly.

Let's examine the test cases in x/rollapp/keeper/rollapp_test.go to verify that they adequately cover the new validation logic.


To ensure thorough testing of the new validation logic, we need to see the complete test cases, including the setup and different scenarios being tested. This will help us confirm if the new validation logic is adequately tested.


The new validation logic for checking rollapps by name is thoroughly tested.

The TestKeeper_FindRollappByName function in x/rollapp/keeper/rollapp_test.go covers both the positive and negative scenarios for rollapps with the same name.

  • TestKeeper_FindRollappByName: Tests both cases where a rollapp with the same name is found and where it is not found.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new validation logic for checking rollapps by name.

# Test: Search for test cases that cover the new validation logic. Expect: Test cases for rollapps with the same name.
rg --type go -A 5 'GetRollappByName'

Length of output: 1030


Script:

#!/bin/bash
# Description: Examine test cases for GetRollappByName function to verify thorough testing of new validation logic.

# Print the relevant test cases from rollapp_test.go
rg --type go -A 10 'GetRollappByName' x/rollapp/keeper/rollapp_test.go

Length of output: 187


Script:

#!/bin/bash
# Description: Extract full test cases for GetRollappByName function to verify thorough testing of new validation logic.

# Print the full test cases from rollapp_test.go
rg --type go -A 20 'func Test' x/rollapp/keeper/rollapp_test.go

Length of output: 1403

go.mod (1)

20-20: LGTM!

The version update for github.com/dymensionxyz/sdk-utils may include bug fixes, improvements, or new features.

However, ensure that the new version does not introduce breaking changes.

x/rollapp/keeper/msg_server_create_rollapp_test.go (7)

31-85: LGTM!

The test cases for TestCreateRollappAlreadyExists cover various scenarios and error conditions effectively.


Line range hint 90-115:
LGTM!

The test cases for TestCreateRollappAliasAlreadyExists cover the scenario effectively.


Line range hint 126-173:
LGTM!

The test cases for TestCreateRollappId cover various rollapp ID validation scenarios effectively.


Line range hint 179-219:
LGTM!

The test cases for TestCreateRollappIdRevisionNumber cover different revision number validation scenarios effectively.


Line range hint 225-275:
LGTM!

The test cases for TestForkChainId cover different forking scenarios effectively.


Line range hint 281-362:
LGTM!

The test cases for TestOverwriteEIP155Key cover different scenarios effectively.


Line range hint 402-456:
LGTM!

The function createRollappWithCreatorAndVerify ensures that rollapp creation is thoroughly tested.

x/sequencer/keeper/msg_server_create_sequencer_test.go (6)

12-12: LGTM!

The addition of the urand package is necessary for generating unique rollapp IDs.


113-113: LGTM!

The introduction of the numRollapps constant improves maintainability and readability by centralizing the number of rollapps to be tested.


114-114: LGTM!

The introduction of the rollappIDs array is necessary for storing the generated rollapp IDs for later use during querying.


116-118: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


136-136: LGTM!

Storing the generated rollapp IDs in the rollappIDs array ensures they can be used later during querying.


194-195: LGTM!

Using the rollappIDs array for querying rollapps aligns with the new random ID generation approach and ensures consistency.

x/rollapp/keeper/msg_server_update_state_test.go (12)

7-7: LGTM!

The addition of the urand package is necessary for generating unique rollapp IDs.


23-23: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


81-81: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


190-190: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


208-208: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


237-237: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


272-273: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


312-314: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


350-352: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


410-412: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


456-458: LGTM!

The use of urand.RollappID() ensures that rollapp IDs are unique and random, increasing the variability in the tests.


307-307: LGTM!

The correction of the function name improves clarity and correctness in the test naming conventions.

x/rollapp/keeper/block_height_to_finalization_queue_test.go (7)

134-139: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


156-160: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


182-199: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


Line range hint 208-225: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


Line range hint 230-249: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


258-263: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.


272-272: LGTM!

The updated rollapp IDs enhance the clarity and consistency of the rollapp identifiers used in the tests.

omritoptix
omritoptix previously approved these changes Aug 7, 2024
Copy link
Contributor

@omritoptix omritoptix left a comment

Choose a reason for hiding this comment

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

approved with small comments (about left-over godocs)

x/rollapp/keeper/rollapp.go Outdated Show resolved Hide resolved
x/rollapp/keeper/rollapp.go Show resolved Hide resolved
x/rollapp/keeper/rollapp.go Outdated Show resolved Hide resolved
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 443bd0a and ed7075c.

Files selected for processing (7)
  • app/apptesting/test_suite.go (2 hunks)
  • app/export.go (1 hunks)
  • x/incentives/client/cli/query_test.go (2 hunks)
  • x/incentives/keeper/suite_test.go (2 hunks)
  • x/rollapp/keeper/msg_server_create_rollapp_test.go (8 hunks)
  • x/rollapp/keeper/rollapp.go (5 hunks)
  • x/rollapp/types/errors.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/export.go
Files skipped from review as they are similar to previous changes (4)
  • app/apptesting/test_suite.go
  • x/incentives/client/cli/query_test.go
  • x/incentives/keeper/suite_test.go
  • x/rollapp/types/errors.go
Additional comments not posted (9)
x/rollapp/keeper/rollapp.go (4)

17-18: LGTM! Enforcing stricter error handling with types.MustNewChainID.

The change ensures that invalid chain IDs will not propagate through the system.


134-137: LGTM! Enhanced validation for rollapps by name.

The additional check ensures that rollapps are not duplicated by name, maintaining uniqueness and preventing conflicts.


170-171: LGTM! Enforcing stricter error handling with types.MustNewChainID.

The change ensures that invalid chain IDs will not propagate through the system.


238-254: LGTM! New function GetRollappByName enhances querying capabilities.

The function allows rollapps to be queried by name, improving the flexibility of rollapp management.

x/rollapp/keeper/msg_server_create_rollapp_test.go (5)

31-40: LGTM! Enhanced uniqueness and coverage in TestCreateRollappAlreadyExists.

The changes improve the robustness and reliability of the test case by ensuring unique rollapp identifiers and covering more scenarios.

Also applies to: 42-87


Line range hint 92-113:
LGTM! Enhanced uniqueness in TestCreateRollappAliasAlreadyExists.

The changes reduce the likelihood of conflicts during rollapp creation by ensuring unique rollapp identifiers.


129-178: LGTM! Improved coverage in TestCreateRollappId.

The changes ensure that various invalid rollapp IDs lead to specific error responses, improving the robustness of the test case.


Line range hint 181-228:
LGTM! Improved coverage in TestForkChainId.

The changes ensure that forked rollapp IDs are validated correctly, improving the robustness of the test case.


Line range hint 291-308:
LGTM! Improved coverage in TestOverwriteEIP155Key.

The changes ensure that rollapp IDs with extra whitespace and same EIP ID are handled correctly, improving the robustness of the test case.

x/rollapp/keeper/rollapp.go Show resolved Hide resolved
Copy link
Contributor

@danwt danwt left a comment

Choose a reason for hiding this comment

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

gj!

@zale144 zale144 merged commit 55a7517 into main Aug 7, 2024
10 of 116 checks passed
@zale144 zale144 deleted the zale144/1014-enforce-eip155-on-rollapp-registration branch August 7, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce eip 155 chain id for all rollapps All rollapps id should follow the eip155 standards
3 participants