-
Notifications
You must be signed in to change notification settings - Fork 19
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
Refactor x/rollup module to adhere to Cosmos SDK suggested standards #124
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe recent changes introduce significant refactoring across the codebase, enhancing modularity and clarity. Key updates include transitioning from specific package dependencies to a more generalized structure, improving transaction handling, and streamlining error management. New script automation for protocol buffer generation and updated configuration files further enhance the system's integration with Go. The overall focus has been on consolidating functionality and improving maintainability, paving the way for better extensibility and usability within the project. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Layer2
participant Layer1
participant Monomer
User->>Layer2: Initiate Withdrawal Request
Layer2->>Monomer: Process Withdrawal
Monomer->>Layer1: Send State Commitment
Layer1-->>User: Confirm Withdrawal
Assessment against linked issues
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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, codebase verification and nitpick comments (1)
x/rollup/keeper/msg_server.go (1)
24-24
:msgServer
does not implementtypes.MsgServiceServer
methods.The
msgServer
struct is defined but does not implement the methods required by thetypes.MsgServiceServer
interface (ApplyL1Txs
andInitiateWithdrawal
). This needs to be addressed to ensure the correct functionality.
msgServer
struct is defined inx/rollup/keeper/msg_server.go
.types.MsgServiceServer
interface requires methodsApplyL1Txs
andInitiateWithdrawal
as defined inx/rollup/types/tx.pb.go
.Analysis chain
Ensure correct implementation of
NewMsgServerImpl
.The function now returns
types.MsgServiceServer
. Verify that thetypes.MsgServiceServer
interface is correctly implemented bymsgServer
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `types.MsgServiceServer` by `msgServer`. # Test: Search for the implementation of `MsgServiceServer` methods in `msgServer`. Expect: Correct implementation. ast-grep --lang go --pattern 'func ($_ msgServer) $_($_) ($_ error) { $$$ }'Length of output: 78
Script:
#!/bin/bash # Find the definition of `msgServer` to understand its structure. ast-grep --lang go --pattern 'type msgServer struct { $$$ }' # List all methods implemented by `msgServer`. ast-grep --lang go --pattern 'func ($_ msgServer) $_($_) ($_ error) { $$$ }' # Find the definition of `types.MsgServiceServer` to list required methods. ast-grep --lang go --pattern 'type MsgServiceServer interface { $$$ }'Length of output: 676
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (5)
gen/rollup/module/v1/module.pb.go
is excluded by!**/*.pb.go
gen/testapp/module/v1/module.pb.go
is excluded by!**/*.pb.go
gen/testapp/v1/get.pb.go
is excluded by!**/*.pb.go
gen/testapp/v1/set.pb.go
is excluded by!**/*.pb.go
x/rollup/types/tx.pb.go
is excluded by!**/*.pb.go
Files selected for processing (21)
- Makefile (1 hunks)
- adapters.go (4 hunks)
- buf.gen.yaml (1 hunks)
- builder/builder.go (3 hunks)
- engine/engine.go (3 hunks)
- monomer.go (2 hunks)
- proto/rollup/module/v1/module.proto (1 hunks)
- proto/rollup/v1/tx.proto (2 hunks)
- scripts/gen-proto.sh (1 hunks)
- testapp/proto/testapp/module/v1/module.proto (1 hunks)
- testapp/proto/testapp/v1/get.proto (1 hunks)
- testapp/proto/testapp/v1/set.proto (1 hunks)
- testutils/utils.go (3 hunks)
- x/rollup/README.md (1 hunks)
- x/rollup/keeper/msg_server.go (7 hunks)
- x/rollup/module.go (3 hunks)
- x/rollup/types/codec.go (1 hunks)
- x/rollup/types/errors.go (1 hunks)
- x/rollup/types/events.go (2 hunks)
- x/rollup/types/msgs.go (1 hunks)
- x/rollup/types/msgs_test.go (2 hunks)
Files skipped from review due to trivial changes (2)
- testapp/proto/testapp/module/v1/module.proto
- testapp/proto/testapp/v1/get.proto
Additional context used
LanguageTool
x/rollup/README.md
[uncategorized] ~15-~15: Possible missing comma found.
Context: ...2 state commitment to L1 through the OP Stack and the user will be able to prove and ...(AI_HYDRA_LEO_MISSING_COMMA)
Additional comments not posted (39)
buf.gen.yaml (1)
5-9
: Improved configuration readability and functionality.The transition to a multi-line list format for the
opt
field enhances readability. The addition of the new optionMcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1
extends the configuration to support additional functionality with the Cosmos SDK.x/rollup/types/codec.go (1)
1-10
: Correct implementation of interface registration.The
RegisterInterfaces
function is correctly implemented, adhering to Cosmos SDK standards for registering message service descriptions.proto/rollup/module/v1/module.proto (1)
7-7
: Enhanced Go package specification.The addition of the
go_package
option improves clarity and integration with Go projects by explicitly defining the package structure for generated code.testapp/proto/testapp/v1/set.proto (1)
7-8
: Addition ofgo_package
option is appropriate.The inclusion of the
go_package
option aligns with Go conventions and improves the integration of generated code.scripts/gen-proto.sh (1)
1-16
: Script structure is well-organized.The script uses standard shell scripting practices and is structured clearly.
x/rollup/types/events.go (1)
15-15
: Removal of unused constants is appropriate.The removal of these constants helps streamline the code. Ensure they are not used elsewhere in the codebase.
Verification successful
Removal of unused constants is confirmed.
The removed constants are not used elsewhere in the codebase, confirming their removal is appropriate. This helps streamline the code and reduce complexity.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that removed constants are not used elsewhere in the codebase. # Test: Search for the removed constants. Expect: No occurrences. rg --type go 'AttributeKeyBridgedTokenType|AttributeKeyFromEvmAddress|AttributeKeyToEvmAddress|L1SystemDepositTxType'Length of output: 119
Script:
#!/bin/bash # Re-run the search for the removed constants to confirm they are not used elsewhere in the codebase. rg --type go 'AttributeKeyBridgedTokenType|AttributeKeyFromEvmAddress|AttributeKeyToEvmAddress|L1SystemDepositTxType'Length of output: 119
x/rollup/README.md (1)
5-7
: Clarify the deposits section.The description of the deposits section is clear and effectively distinguishes it from other cosmos-sdk modules. No issues found.
x/rollup/types/errors.go (1)
18-19
: Addition of new error codes looks good.The new error codes
ErrProcessL1UserDepositTxs
andErrProcessL1SystemDepositTx
are correctly registered, enhancing the granularity of error handling.x/rollup/types/msgs.go (5)
23-28
: ValidateBasic method for ApplyL1TxsRequest is well-implemented.The
ValidateBasic
method checks for the presence of transaction bytes, usingWrapError
for error handling. This aligns with best practices.
30-36
: Type and Route methods for ApplyL1TxsRequest are correctly defined.The
Type
andRoute
methods provide the expected string identifiers for the message type.
38-52
: ValidateBasic method for InitiateWithdrawalRequest is comprehensive.The method includes checks for a valid Ethereum address and gas limit, ensuring robustness.
54-60
: Type and Route methods for InitiateWithdrawalRequest are correctly defined.These methods follow the standard pattern for defining message type and route.
17-21
: Implement GetSigners method for ApplyL1TxsRequest.The
GetSigners
method currently returnsnil
, which might be intentional if no signers are required. Ensure this is the intended behavior.Verification successful
No Signers Required for ApplyL1TxsRequest
The
GetSigners
method inApplyL1TxsRequest
returningnil
is intentional. The usage context indicates that this message type does not require signers, aligning with its role in processing L1 transactions. No changes are needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if the GetSigners method for ApplyL1TxsRequest is correctly implemented. # Test: Search for the ApplyL1TxsRequest usage. Expect: Contextual usage indicating if signers are needed. rg --type go -A 5 $'ApplyL1TxsRequest'Length of output: 9761
proto/rollup/v1/tx.proto (2)
10-10
: Addgo_package
option for better Go integration.The addition of the
go_package
option is a good practice for ensuring that the generated Go code is placed in the correct package, improving maintainability and usability.
11-11
: Verify removal of validation comment.The removal of the comment regarding validations related to the target address and gas limit might imply a change in validation strategy. Ensure that these validations are implemented elsewhere if still required.
x/rollup/types/msgs_test.go (3)
1-1
: Transition totypes_test
package.The transition from
keeper_test
totypes_test
aligns the tests with the refactored package structure, enhancing modularity.
12-12
: Refactor test to focus onInitiateWithdrawalRequest
.Renaming the test function to
TestInitiateWithdrawalRequestValidateBasic
and focusing onInitiateWithdrawalRequest
improves specificity and clarity in testing.
Line range hint
64-72
: Encapsulate validation logic within request structure.Encapsulating the validation logic within the
InitiateWithdrawalRequest
structure promotes object-oriented principles and enhances code maintainability.Makefile (1)
35-35
: Use script forgen-proto
target.Replacing the direct
buf
command with a script (gen-proto.sh
) allows for more flexibility and potential enhancements in the protocol buffer generation process. Ensure the script is well-documented and handles all necessary steps.Verification successful
Script
gen-proto.sh
is present and executable.The
gen-proto.sh
script is correctly located in thescripts
directory and has executable permissions. This satisfies the requirement to use the script for thegen-proto
target in the Makefile. No further action is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the contents and functionality of `gen-proto.sh`. # Test: Check if `gen-proto.sh` exists and is executable. Expect: The script should be present and executable. if [ -x "${SCRIPTS_PATH}/gen-proto.sh" ]; then echo "gen-proto.sh exists and is executable." else echo "gen-proto.sh is missing or not executable." fiLength of output: 121
Script:
#!/bin/bash # Search for the `gen-proto.sh` script in the repository. fd -e sh -e bash -e zsh -e ksh -e fish -e csh -e tcsh -e dash -e ash -e sh -e bash -e zsh -e ksh -e fish -e csh -e tcsh -e dash -e ash -e sh gen-proto.sh # Check if the found script is executable. if [ -f "gen-proto.sh" ]; then if [ -x "gen-proto.sh" ]; then echo "gen-proto.sh is executable." else echo "gen-proto.sh is not executable." fi fiLength of output: 202
Script:
#!/bin/bash # Check if the `scripts/gen-proto.sh` script is executable. if [ -x "scripts/gen-proto.sh" ]; then echo "scripts/gen-proto.sh is executable." else echo "scripts/gen-proto.sh is not executable." fiLength of output: 114
adapters.go (2)
91-94
: Verify the correctness ofrolluptypes.ApplyL1TxsRequest
.Ensure that the
ApplyL1TxsRequest
type fromrolluptypes
is correctly used and compatible with the transaction adaptation logic.
45-48
: Verify the correctness ofrolluptypes.ApplyL1TxsRequest
.Ensure that the
ApplyL1TxsRequest
type fromrolluptypes
is correctly used and compatible with the transaction adaptation logic.Verification successful
The
ApplyL1TxsRequest
type is correctly used.The
ApplyL1TxsRequest
struct fromrolluptypes
is properly defined with a fieldTxBytes
that aligns with its usage in adapting Ethereum transactions to Cosmos transactions. No issues were found with the transaction adaptation logic.
- The
TxBytes
field is a slice of byte slices, suitable for handling Ethereum transaction bytes.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definition and usage of `ApplyL1TxsRequest` in `rolluptypes`. # Test: Search for the definition of `ApplyL1TxsRequest`. Expect: Correct structure and fields. ast-grep --lang go --pattern 'type ApplyL1TxsRequest struct { $$$ }'Length of output: 506
testutils/utils.go (2)
100-100
: Verify the function call tomonomer.AdaptPayloadTxsToCosmosTxs
.Ensure that the function
AdaptPayloadTxsToCosmosTxs
from themonomer
package is correctly used and that the block generation logic remains consistent.
82-82
: Verify the function call tomonomer.AdaptNonDepositCosmosTxToEthTx
.Ensure that the function
AdaptNonDepositCosmosTxToEthTx
from themonomer
package is correctly used and that the transaction generation logic remains consistent.x/rollup/module.go (2)
153-153
: Verify the service registration withtypes.RegisterMsgServiceServer
.Ensure that the
RegisterMsgServiceServer
function from thetypes
package correctly registers all necessary services for the module.
83-83
: Verify the interface registration withtypes.RegisterInterfaces
.Ensure that the
RegisterInterfaces
function from thetypes
package correctly registers all necessary interfaces for the module.monomer.go (1)
125-125
: EnsureAdaptCosmosTxsToEthTxs
is correctly scoped.The function
AdaptCosmosTxsToEthTxs
is now called directly. Verify that this function is accessible in the current scope without therolluptypes
prefix, and ensure there are no naming conflicts.Verification successful
AdaptCosmosTxsToEthTxs
is correctly scoped and accessible. The function is defined without a prefix in the package scope, and no naming conflicts were found in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the scope and definition of `AdaptCosmosTxsToEthTxs`. # Test: Search for the definition of `AdaptCosmosTxsToEthTxs`. Expect: Correct definition without `rolluptypes` prefix. ast-grep --lang go --pattern 'func AdaptCosmosTxsToEthTxs($_) $_'Length of output: 2077
Script:
#!/bin/bash # Check for any other definitions or imports of `AdaptCosmosTxsToEthTxs` in the codebase. rg 'AdaptCosmosTxsToEthTxs' -g '!*.go'Length of output: 38
builder/builder.go (2)
287-287
: Verify the integration ofrolluptypes.InitiateWithdrawalRequest
.The type of
withdrawalMsg
has been changed torolluptypes.InitiateWithdrawalRequest
. Ensure that this type is correctly defined and used throughout the codebase.
257-257
: Verify the integration ofrolluptypes.InitiateWithdrawalRequest
.The type of
withdrawalMsg
has been changed torolluptypes.InitiateWithdrawalRequest
. Ensure that this type is correctly defined and used throughout the codebase.Verification successful
Integration of
rolluptypes.InitiateWithdrawalRequest
is verified.The
InitiateWithdrawalRequest
type is properly defined and used throughout the codebase, including in message handling, validation, and testing. This confirms its correct integration.
- Definition: Located in
x/rollup/types/tx.pb.go
.- Usage: Found in
msg_server.go
,msgs.go
,builder.go
.- Testing: Verified in
msgs_test.go
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the definition and usage of `rolluptypes.InitiateWithdrawalRequest`. # Test: Search for the definition of `InitiateWithdrawalRequest` in `rolluptypes`. Expect: Correct definition. ast-grep --lang go --pattern 'type InitiateWithdrawalRequest struct { $$$ }'Length of output: 1208
Script:
#!/bin/bash # Description: Find all usages of `InitiateWithdrawalRequest` in the codebase. rg 'InitiateWithdrawalRequest' -A 3Length of output: 10360
x/rollup/keeper/msg_server.go (9)
31-65
: Refactor ofApplyL1Txs
for clarity and modularity.The
ApplyL1Txs
method has been refactored to use helper methods for processing transactions. This improves readability and maintainability. Ensure that the helper methods are correctly implemented and integrated.
Line range hint
70-102
:
Refactor ofInitiateWithdrawal
for improved error handling.The
InitiateWithdrawal
method now usestypes.WrapError
for more descriptive error messages. This enhances clarity and debugging. Ensure that error handling is consistent across the module.
105-106
: Adherence to Go naming conventions for unexported methods.The method
mintETH
is now unexported, aligning with Go's naming conventions. Ensure that this change does not affect its usage in other parts of the codebase.
129-130
: Adherence to Go naming conventions for unexported methods.The method
burnETH
is now unexported, aligning with Go's naming conventions. Ensure that this change does not affect its usage in other parts of the codebase.
163-163
: Ensure correct implementation ofsetL1BlockInfo
.The method
setL1BlockInfo
is now unexported. Verify that this change does not affect its usage in other parts of the codebase.
175-175
: Ensure correct implementation ofsetL1BlockHistory
.The method
setL1BlockHistory
is now unexported. Verify that this change does not affect its usage in other parts of the codebase.
187-203
: Refactor ofprocessL1SystemDepositTx
for improved error handling.The method now uses
types.WrapError
for more descriptive error messages. This enhances clarity and debugging. Ensure that error handling is consistent across the module.
206-237
: Refactor ofprocessL1UserDepositTxs
for improved error handling.The method now uses
types.WrapError
for more descriptive error messages. This enhances clarity and debugging. Ensure that error handling is consistent across the module.
242-244
: Ensure correct conversion inevmToCosmos
.The function converts an EVM address to a Cosmos address. Ensure that this conversion is correctly implemented and used.
engine/engine.go (2)
263-263
: Verify the correctness of transaction adaptation.The function
monomer.AdaptCosmosTxsToEthTxs
is now used for adapting transactions. Ensure that this function correctly handles the transaction adaptation process and that all necessary validations are in place.
176-176
: Verify the correctness of transaction adaptation.The function
monomer.AdaptPayloadTxsToCosmosTxs
is now used for adapting transactions. Ensure that this function correctly handles the transaction adaptation process and that all necessary validations are in place.Verification successful
Verified: Transaction adaptation function is correctly implemented.
The function
AdaptPayloadTxsToCosmosTxs
is implemented inadapters.go
. It checks for empty input and returns an appropriate response, indicating correct initial handling of transactions. Further verification of its full logic would require additional context, but the initial setup is correct.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `AdaptPayloadTxsToCosmosTxs` in the `monomer` package. # Test: Search for the function implementation. Expect: Correct handling of transaction adaptation. ast-grep --lang go --pattern $'func AdaptPayloadTxsToCosmosTxs(transactions []$_) ($_, error) { $$$ }'Length of output: 105
Script:
#!/bin/bash # Description: Search for the function `AdaptPayloadTxsToCosmosTxs` in the codebase to verify its existence and implementation. # Use ripgrep to search for the function definition across the codebase. rg 'func\s+AdaptPayloadTxsToCosmosTxs' --type go -A 5Length of output: 296
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.
All good stuff. Minor comments can be taken or left.
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.
Is there a case for splitting this file into deposits
and withdrawals
?
Fairly independent workflows, each somewhat logically dense, etc.
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.
Yeah I thought about that but didn't end up moving it for the initial PR. Your extra nudge convinced me though :) I'll split msg_server
up into deposits.go
and withdrawals.go
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.
Ended up leaving the high level MsgServer
funcs (ApplyL1Txs
, InitiateWithdrawal
) in msg_server.go
and split the helpers out into separate deposits and withdrawals files. Lmk if you think I should move the high level funcs into the separate files as well
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.
Took a quick pass to familiarize myself with the changes.
3976d85
to
a456239
Compare
@NiloCK @joshklop I still have a good bit of commit cleaning before this is ready for merge but I just added my CR changes starting with the |
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, codebase verification and nitpick comments (1)
x/rollup/README.md (1)
14-16
: Enhance clarity in the withdrawals section.The new withdrawals section is informative and provides a clear understanding of the process. Consider adding a comma for better readability.
- through the OP Stack and the user will be able to prove and finalize their withdrawal. + through the OP Stack, and the user will be able to prove and finalize their withdrawal.Tools
LanguageTool
[uncategorized] ~15-~15: Possible missing comma found.
Context: ...2 state commitment to L1 through the OP Stack and the user will be able to prove and ...(AI_HYDRA_LEO_MISSING_COMMA)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (5)
gen/rollup/module/v1/module.pb.go
is excluded by!**/*.pb.go
gen/testapp/module/v1/module.pb.go
is excluded by!**/*.pb.go
gen/testapp/v1/get.pb.go
is excluded by!**/*.pb.go
gen/testapp/v1/set.pb.go
is excluded by!**/*.pb.go
x/rollup/types/tx.pb.go
is excluded by!**/*.pb.go
Files selected for processing (23)
- Makefile (1 hunks)
- adapters.go (4 hunks)
- buf.gen.yaml (1 hunks)
- builder/builder.go (3 hunks)
- engine/engine.go (3 hunks)
- monomer.go (2 hunks)
- proto/rollup/module/v1/module.proto (1 hunks)
- proto/rollup/v1/tx.proto (2 hunks)
- scripts/gen-proto.sh (1 hunks)
- testapp/proto/testapp/module/v1/module.proto (1 hunks)
- testapp/proto/testapp/v1/get.proto (1 hunks)
- testapp/proto/testapp/v1/set.proto (1 hunks)
- testutils/utils.go (3 hunks)
- x/rollup/README.md (1 hunks)
- x/rollup/keeper/deposits.go (1 hunks)
- x/rollup/keeper/msg_server.go (3 hunks)
- x/rollup/keeper/withdrawals.go (1 hunks)
- x/rollup/module.go (3 hunks)
- x/rollup/types/codec.go (1 hunks)
- x/rollup/types/errors.go (1 hunks)
- x/rollup/types/events.go (2 hunks)
- x/rollup/types/msgs.go (1 hunks)
- x/rollup/types/msgs_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
- scripts/gen-proto.sh
Files skipped from review as they are similar to previous changes (17)
- Makefile
- adapters.go
- buf.gen.yaml
- builder/builder.go
- engine/engine.go
- monomer.go
- proto/rollup/module/v1/module.proto
- proto/rollup/v1/tx.proto
- testapp/proto/testapp/module/v1/module.proto
- testapp/proto/testapp/v1/get.proto
- testapp/proto/testapp/v1/set.proto
- testutils/utils.go
- x/rollup/keeper/msg_server.go
- x/rollup/types/codec.go
- x/rollup/types/errors.go
- x/rollup/types/events.go
- x/rollup/types/msgs.go
Additional context used
LanguageTool
x/rollup/README.md
[uncategorized] ~15-~15: Possible missing comma found.
Context: ...2 state commitment to L1 through the OP Stack and the user will be able to prove and ...(AI_HYDRA_LEO_MISSING_COMMA)
Additional comments not posted (8)
x/rollup/module.go (2)
83-83
: Change totypes.RegisterInterfaces
is appropriate.The switch from
rollupv1.RegisterInterfaces
totypes.RegisterInterfaces
aligns with the refactoring goals and maintains functionality.
153-153
: Change totypes.RegisterMsgServiceServer
is appropriate.The switch from
rollupv1.RegisterMsgServiceServer
totypes.RegisterMsgServiceServer
aligns with the refactoring goals and maintains functionality.x/rollup/keeper/deposits.go (6)
22-31
:setL1BlockInfo
function is well-implemented.The function correctly marshals the L1 block info and sets it in the store with appropriate error handling.
34-43
:setL1BlockHistory
function is well-implemented.The function correctly marshals the L1 block info and sets it in the store using the block hash as the key, with appropriate error handling.
46-62
:processL1SystemDepositTx
function is well-implemented.The function correctly unmarshals the transaction, checks its type, and derives the L1 block info with appropriate error handling and logging.
65-97
:processL1UserDepositTxs
function is well-implemented.The function correctly processes each transaction, checks its type, and mints ETH to the user's Cosmos address with appropriate error handling and logging.
101-121
:mintETH
function is well-implemented.The function correctly mints coins and sends them to the user's account, with appropriate error handling and event emission.
125-126
:evmToCosmos
function is well-implemented.The function correctly converts an EVM address to a Cosmos SDK address.
- Rename msg.proto to be tx.proto - Generate tx.pb.go inside of x/rollup/types - Extract helpers.go funcs into msgs.go and codec.go - Split deposit/withdrawal logic in msg_server.go into helper files - Remove unused event keys from x/rollup - Move adapters.go out of x/rollup/types into the top level package - Update x/rollup README
a456239
to
f1d35a2
Compare
Closes: #105
Refactors the
x/rollup
module with the following updates to follow Cosmos SDK suggested practices:msg.proto
to betx.proto
tx.pb.go
inside ofx/rollup/types
instead of thegen
directorygen/rollup/v1/helpers.go
intox/rollup/types/codec.go
(RegisterInterfaces
) andx/rollup/types/msgs.go
(ValidateBasic
,GetSigners
,Type
,Route
, etc)msg_server.go
into helper funcs for readabilityx/rollup
adapters.go
out ofx/rollup/types
and into the top levelmonomer
packageSummary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation
Tests