-
Notifications
You must be signed in to change notification settings - Fork 239
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
Problem: fix of broken opBlockhash and tx validation are not included #1621
Conversation
WalkthroughThe pull request includes updates across several files, primarily focusing on enhancements and bug fixes. Key changes involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1621 +/- ##
==========================================
- Coverage 36.88% 36.86% -0.02%
==========================================
Files 102 102
Lines 8055 8059 +4
==========================================
Hits 2971 2971
- Misses 4706 4710 +4
Partials 378 378
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (5)
client/docs/swagger-ui/swagger.yaml (1)
49087-49090
: LGTM. Consistent definition, but consider DRY principle.The addition of the
header_hash_num
field here maintains consistency with its earlier definitions, which is crucial for accurate API documentation.However, the repetition of this definition in multiple places might make future updates more error-prone. Consider if it's possible to use Swagger's reference feature (
$ref
) to define this parameter once and reference it in multiple places. This would adhere to the DRY (Don't Repeat Yourself) principle and make future updates easier.Example:
components: parameters: HeaderHashNum: name: header_hash_num in: query schema: type: string format: uint64 description: header_hash_num is the number of header hash to persist. paths: /your/path: get: parameters: - $ref: '#/components/parameters/HeaderHashNum'This is just a suggestion for potential future refactoring, not a blocking issue for this PR.
integration_tests/test_upgrade.py (2)
297-297
: LGTM: Important assertion forheader_hash_num
, but consider using a constantThis assertion is crucial for verifying the
header_hash_num
parameter after the upgrade. It aligns well with the PR objective of fixing broken opBlockhash.Consider defining "10000" as a named constant at the module level for better maintainability. For example:
EXPECTED_HEADER_HASH_NUM = "10000" # Then use it in the assertion: assert cli.query_params("evm")["params"]["header_hash_num"] == EXPECTED_HEADER_HASH_NUM, pThis makes it easier to update the expected value in the future if needed.
299-300
: Approved, but consider adding a comment for clarityThe change to expect an AssertionError when querying
icaauth
parameters is likely correct given the upgrades. However, the reason for this change is not immediately clear from the code.Consider adding a comment explaining why we expect an AssertionError here after the upgrade. This will help future maintainers understand the intention behind this test. For example:
# After the upgrade, icaauth parameters should no longer be available with pytest.raises(AssertionError): cli.query_params("icaauth")go.mod (1)
Line range hint
280-293
: Carefully manage replace directives and custom forksThe
replace
directives are used to override default module versions or use custom forks. While this can be necessary for compatibility or specific features, it also introduces maintenance challenges. Pay special attention to:
- The replacement of
github.com/ethereum/go-ethereum
with a custom fork.- The use of a custom
ethermint
fork.- The replacement of
github.com/99designs/keyring
withgithub.com/cosmos/keyring
.Ensure that:
- Custom forks are regularly updated with upstream changes to maintain security and compatibility.
- The reasons for using custom forks are well-documented.
- There's a plan to migrate away from custom forks if/when the necessary features are incorporated upstream.
Consider creating a document that tracks all custom forks, their purposes, and plans for future maintenance or migration.
CHANGELOG.md (1)
19-19
: Consider clarifying the ethermint update description.The description "Update ethermint to the fix of broken opBlockhash and tx validation" could be more precise. Consider rephrasing it to something like "Update ethermint to include fixes for broken opBlockhash and tx validation issues."
-* [#1621](https://github.com/crypto-org-chain/cronos/pull/1621) Update ethermint to the fix of broken opBlockhash and tx validation. +* [#1621](https://github.com/crypto-org-chain/cronos/pull/1621) Update ethermint to include fixes for broken opBlockhash and tx validation issues.🧰 Tools
🪛 LanguageTool
[uncategorized] ~19-~19: “to the” seems less likely than “to”.
Context: ...hain/cronos/pull/1621) Update ethermint to the fix of broken opBlockhash and tx valida...(AI_HYDRA_LEO_CP_TO_THE_TO)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
📒 Files selected for processing (7)
- CHANGELOG.md (1 hunks)
- app/upgrades.go (2 hunks)
- client/docs/swagger-ui/swagger.yaml (3 hunks)
- go.mod (1 hunks)
- gomod2nix.toml (1 hunks)
- integration_tests/test_upgrade.py (1 hunks)
- third_party/proto/ethermint/evm/v1/params.proto (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md
[uncategorized] ~19-~19: “to the” seems less likely than “to”.
Context: ...hain/cronos/pull/1621) Update ethermint to the fix of broken opBlockhash and tx valida...(AI_HYDRA_LEO_CP_TO_THE_TO)
🪛 GitHub Check: codecov/patch
app/upgrades.go
[warning] 30-33: app/upgrades.go#L30-L33
Added lines #L30 - L33 were not covered by tests
🔇 Additional comments (13)
client/docs/swagger-ui/swagger.yaml (3)
48887-48890
: LGTM. Consistent with previous definition.The addition of the
header_hash_num
field here is consistent with its earlier definition. This repetition is often necessary in Swagger YAML files to ensure the field is properly documented in all relevant contexts.
3047-3050
: Request for clarification on PR objectivesThe changes in this file consistently add a new
header_hash_num
parameter to the EVM module parameters in the Swagger YAML file. These additions are well-documented and maintain consistency throughout the file.However, there seems to be a disconnect between these changes and the stated PR objectives of fixing broken opBlockhash and tx validation. Could you please provide more context on how the addition of this
header_hash_num
parameter relates to these objectives? This information would help reviewers better understand the purpose and impact of these changes in the broader context of the PR.Additionally, it would be helpful to know if there are other files changed in this PR that more directly address the opBlockhash and tx validation issues mentioned in the PR description.
To help understand the context, let's search for related terms in the codebase:
Also applies to: 48887-48890, 49087-49090
3047-3050
: LGTM. Please clarify the relation to PR objectives.The addition of the
header_hash_num
field to the EVM module parameters is well-documented and follows good API design practices. The description is clear and the use ofuint64
as a string format is appropriate for cross-system compatibility.However, could you please clarify how this change relates to fixing the broken opBlockhash and tx validation mentioned in the PR objectives? This context would help reviewers better understand the purpose and impact of this addition.
To ensure consistency, let's check if this new field is used elsewhere in the codebase:
✅ Verification successful
Verified.
The
header_hash_num
field is utilized inapp/upgrades.go
to setevmParams.HeaderHashNum
, which supports the PR objectives of fixing brokenopBlockhash
and transaction validation by enhancing header hash persistence.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for usage of header_hash_num in the codebase # Test: Search for header_hash_num in Go files rg --type go 'header_hash_num' # Test: Search for HeaderHashNum in Go files (in case of camelCase usage) rg --type go 'HeaderHashNum'Length of output: 134
third_party/proto/ethermint/evm/v1/params.proto (1)
25-26
: New field added to Params message: Verify alignment with PR objectivesThe addition of the
header_hash_num
field to theParams
message is a significant change that may relate to the PR's objective of fixing opBlockhash issues. However, there are some points to consider:
The field's purpose is not immediately clear from its name alone. Consider adding a more detailed comment explaining its specific use and impact on the EVM module.
The type
uint64
suggests this is a numeric value, but it's not clear what the acceptable range or default value should be.This change might require updates to other parts of the codebase that interact with the
Params
message, such as parameter initialization, API endpoints, or state management.To ensure this change is properly integrated, please run the following script to check for other occurrences of the
Params
message in the codebase:Would you like assistance in drafting more detailed documentation for this new field or in identifying other areas of the codebase that might need updates due to this change?
✅ Verification successful
Addition of
header_hash_num
VerifiedThe introduction of the
header_hash_num
field inthird_party/proto/ethermint/evm/v1/params.proto
has been thoroughly reviewed. No additional usages or dependencies were found that require updates, ensuring that this change aligns with the PR objectives without introducing conflicts.
- Consider enhancing the comment for
header_hash_num
to provide more context on its usage and default values, improving clarity for future maintenance.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find other occurrences of the Params message that might need updating # Search for Params message usage in Go files echo "Searching for Params usage in Go files:" rg --type go -A 5 'Params\s*{' # Search for Params message usage in Protobuf files echo "Searching for Params usage in Protobuf files:" rg --type proto -A 5 'Params\s*{'Length of output: 426
Script:
#!/bin/bash # Description: Find other occurrences of the Params message that might need updating # Search for Params message usage in Go files echo "Searching for Params usage in Go files:" rg --type go -A 5 'Params\s*\{' # Search for Params message usage in Protobuf files echo "Searching for Params usage in Protobuf files:" rg --type proto -A 5 'Params\s*\{'Length of output: 11243
Script:
#!/bin/bash # Description: Find other occurrences of the Params message that might need updating # Search for Params message usage in Go files echo "Searching for Params usage in Go files:" rg --type go -A 5 'Params\s*\{' # Search for Params message usage in Protobuf files using a glob pattern echo "Searching for Params usage in Protobuf files:" rg -g "*.proto" -A 5 'Params\s*\{'Length of output: 22058
integration_tests/test_upgrade.py (3)
287-291
: LGTM: New helper function improves code maintainabilityThe addition of the
assert_evm_params
function is a good refactoring step. It encapsulates the logic for asserting EVM parameters, which improves code readability and maintainability. The removal ofheader_hash_num
before comparison is noteworthy and suggests this value might change between upgrades.
292-293
: LGTM: Effective use of the new helper functionThe usage of the
assert_evm_params
function here simplifies the assertions for EVM parameters at different upgrade heights. This change makes the code more readable and maintainable.
286-300
: Overall assessment: Improvements enhance upgrade testing robustnessThe changes in this file significantly improve the upgrade testing process for the Cronos blockchain. The addition of the
assert_evm_params
helper function and the new assertions for specific EVM parameters align well with the PR objectives of fixing broken opBlockhash and tx validation.Key improvements:
- Enhanced readability and maintainability through the
assert_evm_params
function.- Specific assertion for
header_hash_num
, crucial for opBlockhash functionality.- Updated expectations for
icaauth
parameters post-upgrade.These changes collectively strengthen the upgrade testing suite, providing more comprehensive validation of the upgrade process. The code is well-structured, though minor enhancements in documentation and constant usage could further improve its quality.
go.mod (3)
Line range hint
3-5
: Go toolchain update approvedThe update from Go 1.22.2 to 1.22.3 is a minor version change, which typically includes bug fixes and security improvements. This update is a good practice to maintain the latest stable version.
Line range hint
1-293
: Overall changes look good, with some recommendationsThe updates to
go.mod
include:
- An update to the Go toolchain version.
- Several dependency updates and additions.
- Modifications to
replace
directives, including the use of custom forks.These changes generally follow good practices for dependency management. However, please ensure to:
- Verify the changes in the custom ethermint fork for compatibility.
- Carefully manage the custom forks, especially for critical dependencies like go-ethereum.
- Keep documentation up-to-date regarding the use of custom forks and replace directives.
- Regularly review and update dependencies to maintain security and compatibility with upstream projects.
Line range hint
7-278
: Dependency updates approved, verify ethermint changesThe dependency updates, including the addition of new dependencies and version changes for existing ones, are generally good for security and bug fixes. However, special attention should be given to the update of
github.com/evmos/ethermint
to the custom forkgithub.com/crypto-org-chain/ethermint v0.6.1-0.20241004074623-853e1e5b3475
.Please ensure that the changes in the custom ethermint fork are compatible with the current codebase and don't introduce breaking changes. Run the following script to check for any major changes in the ethermint dependency:
gomod2nix.toml (1)
266-267
: Dependency update forgithub.com/evmos/ethermint
The version of
github.com/evmos/ethermint
has been updated fromv0.6.1-0.20240927061036-33e3cc6ed365
tov0.6.1-0.20241004074623-853e1e5b3475
. This change also includes an update to the corresponding hash.To ensure this update aligns with the PR objectives and doesn't introduce any unintended changes, please run the following verification:
This script will help identify any changes in the ethermint dependency that might be relevant to the PR objectives, specifically regarding opBlockhash and tx validation.
✅ Verification successful
To identify the correct versions of the
github.com/evmos/ethermint
dependency, please run the following script to list all available tags in the repository:
To accurately compare the changes between the specified versions of
github.com/evmos/ethermint
, please run the following script using the commit hashes extracted from the pseudo-versions:
Dependency update for
github.com/evmos/ethermint
verifiedThe update to
github.com/evmos/ethermint
includes the intended fix foropBlockhash
as per PR #534. No issues were found related totx validation
.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for changes in the ethermint dependency that might affect opBlockhash and tx validation # Fetch the diff between the old and new versions git clone https://github.com/crypto-org-chain/ethermint.git cd ethermint git diff v0.6.1-0.20240927061036-33e3cc6ed365 v0.6.1-0.20241004074623-853e1e5b3475 > ethermint_diff.patch # Search for relevant changes echo "Changes related to opBlockhash:" grep -i "opblockhash" ethermint_diff.patch echo "Changes related to tx validation:" grep -i "tx.*validat" ethermint_diff.patch # Clean up cd .. rm -rf ethermintLength of output: 733
Script:
#!/bin/bash # Description: List all tags in the ethermint repository to verify the specified versions git clone https://github.com/crypto-org-chain/ethermint.git cd ethermint git fetch --tags echo "Available tags:" git tagLength of output: 1146
Script:
#!/bin/bash # Description: Compare changes between two specific commits in the ethermint repository related to opBlockhash and tx validation # Clone the ethermint repository git clone https://github.com/crypto-org-chain/ethermint.git cd ethermint # Define commit hashes from the pseudo-versions OLD_COMMIT="33e3cc6ed365" NEW_COMMIT="853e1e5b3475" # Fetch all commits to ensure the specified commits are available git fetch --all # Perform git diff between the two commits git diff ${OLD_COMMIT} ${NEW_COMMIT} > ethermint_diff.patch # Search for relevant changes echo "Changes related to opBlockhash:" grep -i "opblockhash" ethermint_diff.patch echo "Changes related to tx validation:" grep -i "tx.*validat" ethermint_diff.patch # Clean up cd .. rm -rf ethermintLength of output: 814
app/upgrades.go (2)
14-14
: Importingevmtypes
for EVM parameter handlingThe addition of
evmtypes
import is appropriate for managing EVM parameters in the upgrade handler.
30-34
:⚠️ Potential issueEnsure resetting
HeaderHashNum
does not overwrite custom configurationsSetting
evmParams.HeaderHashNum
toevmtypes.DefaultHeaderHashNum
may overwrite any existing custom configurations ofHeaderHashNum
. Verify if this is the intended behavior, or if the upgrade should preserve the current value to avoid unintended side effects.To check for any custom configurations of
HeaderHashNum
in the codebase, you can run the following script:✅ Verification successful
Confirmed: Resetting
HeaderHashNum
does not overwrite any custom configurations🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any custom settings of HeaderHashNum in the codebase. # Find assignments to HeaderHashNum in Go files. rg --type go "HeaderHashNum" -A 5 -B 5Length of output: 7766
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 30-33: app/upgrades.go#L30-L33
Added lines #L30 - L33 were not covered by tests
bd29fdf
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
For more info
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
Release Notes
New Features
header_hash_num
, to enhance EVM module functionality and API documentation.Improvements
Bug Fixes
Documentation