feat: add EVM migration support and refactor tx building pipeline#14
feat: add EVM migration support and refactor tx building pipeline#14
Conversation
Reviewed the EVM migration module, tx building refactor, crypto/ethsecp256k1 replacement, and dependency bumps. Found 2 issues to address before merging.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
- Add EVMigration module client with query operations (Params,
MigrationRecord, MigrationRecordByNewAddress, MigrationEstimate,
MigrationStats) and wire it into blockchain.Client
- Refactor tx building into composable stages:
- PrepareTx: builds unsigned tx builder and resolves signer metadata
- SignPreparedTx: signs a prepared builder with explicit signer info
- BuildAndSignTxWithOptions: end-to-end build+sign with TxBuildOptions
- BroadcastAndWait: broadcast + wait-for-inclusion convenience method
- Support explicit AccountNumber/Sequence, GasLimit, SkipSimulation,
FeeAmount, and multi-message transactions via TxBuildOptions
- Replace local ethsecp256k1 implementation with cosmos/evm upstream
(github.com/cosmos/evm/crypto/ethsecp256k1), removing
pkg/crypto/ethsecp256k1/ package
- Register additional module interfaces in NewDefaultTxConfig (bank,
staking, distribution, authz, claim, supernode) for proper tx
encoding/decoding
- Bump dependencies:
- Go 1.25.5 -> 1.26.1
- cosmos-sdk v0.53.5 -> v0.53.6
- cometbft v0.38.20 -> v0.38.21
- grpc v1.77.0 -> v1.79.2
- LumeraProtocol/lumera v1.10.0 -> v1.11.0
- Add github.com/cosmos/evm v0.6.0
- Add comprehensive tests for tx building (manual signer info,
queried account info + simulation, default message sizes)
- Apply config defaults (MaxRecvMsgSize/MaxSendMsgSize) in base.New
- Remove deprecated blockchain/messages.go
- Update docs and copilot-instructions for Go 1.26.1
| github.com/LumeraProtocol/lumera => ../lumera | ||
| github.com/LumeraProtocol/supernode/v2 => ../supernode |
There was a problem hiding this comment.
The local replace directives are uncommented (active). As the PR description itself notes, these must be commented out before merging. With these active, any consumer running go get github.com/LumeraProtocol/sdk-go will fail because ../lumera and ../supernode don't exist on their machine. This is a merge blocker.
| github.com/LumeraProtocol/lumera => ../lumera | |
| github.com/LumeraProtocol/supernode/v2 => ../supernode | |
| // Local development - uncomment these for local testing | |
| // Comment these lines before releasing | |
| // github.com/LumeraProtocol/lumera => ../lumera | |
| // github.com/LumeraProtocol/supernode/v2 => ../supernode |
Fix it with Roo Code or mention @roomote and request a fix.
| if !opts.FeeAmount.Empty() { | ||
| return opts.FeeAmount, nil | ||
| } | ||
| feeDec := c.config.GasPrice.MulInt64(int64(gas)).Ceil().TruncateInt() |
There was a problem hiding this comment.
int64(gas) silently wraps to a negative number when gas > math.MaxInt64. Now that GasLimit is directly user-controllable via TxBuildOptions, a caller passing a very large value (or a value computed from a large simulation result with a high adjustment factor) would produce an incorrect fee. Consider adding a bounds check or using sdkmath.NewIntFromUint64(gas) to avoid the cast.
| feeDec := c.config.GasPrice.MulInt64(int64(gas)).Ceil().TruncateInt() | |
| feeDec := c.config.GasPrice.MulInt(sdkmath.NewIntFromUint64(gas)).Ceil().TruncateInt() |
Fix it with Roo Code or mention @roomote and request a fix.
Summary
Add EVM migration module support, refactor the transaction building pipeline into composable stages, and replace the local
ethsecp256k1implementation with the upstreamcosmos/evmpackage.Changes
EVM Migration Module
EVMigrationClientinblockchain/evmigration.gowith query operations:Params— current module parametersMigrationRecord— lookup by legacy addressMigrationRecordByNewAddress— lookup by new addressMigrationEstimate— pre-flight migration estimateMigrationStats— aggregate statisticsblockchain.Clientalongside existing Action/SuperNode/Claim modulesTransaction Building Refactor
TxBuildOptionsstruct for fine-grained tx control:Messages []sdk.Msg)AccountNumber/Sequence(skip on-chain query when provided)GasLimitoverride &SkipSimulationflagFeeAmountbuildAndSignTxinto composable stages:PrepareTx— builds unsigned builder + resolves signer metadataSignPreparedTx— signs a prepared builder with explicit signer infoBuildAndSignTxWithOptions— end-to-end convenienceBroadcastAndWaitfor broadcast + wait-for-inclusion in a single callBuildAndSignTx/BuildAndSignTxWithGasAdjustmentdelegate to new pipeline (backwards compatible)Crypto / ethsecp256k1
pkg/crypto/ethsecp256k1/packagegithub.com/cosmos/evm/crypto/ethsecp256k1NewKeyringto useevmhd.EthSecp256k1Option()andevmcryptocodec.RegisterInterfacesNewDefaultTxConfig(bank, staking, distribution, authz, claim, supernode) for proper encoding/decodingConfig & Defaults
applyConfigDefaultsintobase.New, applyingMaxRecvMsgSize/MaxSendMsgSize(50 MB) defaultsWaitTxdefaults applicationDependency Bumps
Cleanup
blockchain/messages.godocs/DEVELOPER_GUIDE.mdand.github/copilot-instructions.mdfor Go 1.26.1Tests
TestBuildAndSignTxWithOptions_ManualSignerInfo— offline signing with explicit account/sequenceTestBuildAndSignTxWithOptions_QueriesAccountInfoAndSimulates— full pipeline with mock gRPCTestNewAppliesDefaultMessageSizes— validates config defaultsNote
Local
replacedirectives forlumeraandsupernodeare active for development. These should be commented out before merging/releasing.