Skip to content

Commit af53a0f

Browse files
vladjdkaljo242
andauthored
docs(migration): boilerplate v0.5.0 migration docs with mempool migra… (cosmos#540)
* docs(migration): boilerplate v0.5.0 migration docs with mempool migration * shorten line * Update docs/migrations/v0.4.0_to_v0.5.0_UNRELEASED.md --------- Co-authored-by: Alex | Interchain Labs <[email protected]>
1 parent 2fff19e commit af53a0f

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Cosmos EVM v0.4.0 → v0.5.0 Migration (UNRELEASED)
2+
3+
## 0) Prep
4+
5+
- Create a branch: `git switch -c upgrade/evm-v0.5`.
6+
- Ensure a clean build + tests green pre-upgrade.
7+
- Snapshot your current params/genesis for comparison later.
8+
9+
---
10+
11+
## 1) Dependency bumps (go.mod)
12+
13+
- Bump `github.com/cosmos/evm` to v0.5.0 and run:
14+
15+
```bash
16+
go mod tidy
17+
```
18+
19+
---
20+
21+
## 2) App wiring in `app.go`
22+
23+
### Mempool
24+
25+
#### Minimal setups: nothing to change
26+
27+
If you use the default mempool wiring (no custom pools), your existing code continues to work. If `BlockGasLimit` is 0, it defaults to `100_000_000`. If `BroadCastTxFn` is not set, it's also set to a default value.
28+
29+
```go
30+
mempoolConfig := &evmmempool.EVMMempoolConfig{
31+
AnteHandler: app.GetAnteHandler(),
32+
BlockGasLimit: 100_000_000, // or 0 to use default
33+
}
34+
evmMempool := evmmempool.NewExperimentalEVMMempool(
35+
app.CreateQueryContext, logger, app.EVMKeeper, app.FeeMarketKeeper, app.txConfig, app.clientCtx, mempoolConfig
36+
)
37+
```
38+
39+
#### Advanced setups: migrate your customizations
40+
41+
PR [#496](https://github.com/cosmos/evm/pull/496) replaced pre-built pools with configs in `EVMMempoolConfig`:
42+
43+
- Replace pools with configs
44+
- Removed: `TxPool *txpool.TxPool`, `CosmosPool sdkmempool.ExtMempool`
45+
- Added: `LegacyPoolConfig *legacypool.Config`, `CosmosPoolConfig *sdkmempool.PriorityNonceMempoolConfig[math.Int]`
46+
47+
If you built custom pools yourself:
48+
49+
```diff
50+
mempoolConfig := &evmmempool.EVMMempoolConfig{
51+
- TxPool: customTxPool,
52+
- CosmosPool: customCosmosPool,
53+
+ LegacyPoolConfig: &legacyCfg, // or nil for defaults
54+
+ CosmosPoolConfig: &cosmosCfg, // or nil for defaults
55+
AnteHandler: app.GetAnteHandler(),
56+
BroadCastTxFn: myBroadcast, // optional
57+
}
58+
```
59+
60+
Example custom configs:
61+
62+
```go
63+
// EVM legacy txpool tuning
64+
legacyCfg := legacypool.DefaultConfig
65+
legacyCfg.PriceLimit = 2
66+
mempoolConfig.LegacyPoolConfig = &legacyCfg
67+
68+
// Cosmos priority mempool tuning
69+
cosmosCfg := sdkmempool.PriorityNonceMempoolConfig[math.Int]{}
70+
cosmosCfg.TxPriority = sdkmempool.TxPriority[math.Int]{
71+
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) math.Int {
72+
// Custom priority function
73+
},
74+
Compare: func(a, b math.Int) int { return a.BigInt().Cmp(b.BigInt()) },
75+
MinValue: math.ZeroInt(),
76+
}
77+
mempoolConfig.CosmosPoolConfig = &cosmosCfg
78+
79+
// Custom EVM broadcast (optional)
80+
mempoolConfig.BroadCastTxFn = func(txs []*ethtypes.Transaction) error { return nil }
81+
```
82+
83+
---
84+
85+
## 3) Build & quick tests
86+
87+
```bash
88+
go build ./...
89+
```
90+
91+
Smoke test on a single node:
92+
- Send a few EVM txs; confirm promotion/broadcast (or your `BroadCastTxFn`).
93+
- Send Cosmos txs; confirm ordering reflects your `CosmosPoolConfig` (if customized).
94+

0 commit comments

Comments
 (0)