Skip to content

Commit b9f7854

Browse files
authored
fix: disable memiavl cache when optimistic execution is enabled (#1892)
* fix: disable memiavl cache when optimistic execution is enabled * update go.mod * fmt * add changelog
1 parent 9fb0be5 commit b9f7854

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## v1.5.2
88

9+
* [#1892](https://github.com/crypto-org-chain/cronos/pull/1892) fix: disable memiavl cache when optimistic execution is enabled.
910
* [#1893](https://github.com/crypto-org-chain/cronos/pull/1893) Normalize cache validator queue key to be UTC.
1011
* [#1850](https://github.com/crypto-org-chain/cronos/pull/1850) Optimize staking endblocker execution by caching queue entries from iterators. Upgrade RocksDB to `v10.4.2` and enable asyncIO.
1112

app/app.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,16 +410,19 @@ func New(
410410
})
411411

412412
blockSTMEnabled := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor)) == "block-stm"
413+
optimisticExecutionDisabled := cast.ToString(appOpts.Get(srvflags.EVMOptimisticExecution)) == "disable"
413414

414415
var cacheSize int
415-
if !blockSTMEnabled {
416-
// only enable memiavl cache if block-stm is not enabled, because it's not concurrency-safe.
416+
if !blockSTMEnabled && optimisticExecutionDisabled {
417+
// only enable memiavl cache if neither block-stm nor optimistic execution is enabled, because it's not concurrency-safe.
417418
cacheSize = cast.ToInt(appOpts.Get(memiavlstore.FlagCacheSize))
418419
}
419420
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, false, false, cacheSize, baseAppOptions)
420421

421-
// enable optimistic execution
422-
baseAppOptions = append(baseAppOptions, baseapp.SetOptimisticExecution())
422+
// The default value of optimisticExecution is enabled.
423+
if !optimisticExecutionDisabled {
424+
baseAppOptions = append(baseAppOptions, baseapp.SetOptimisticExecution())
425+
}
423426

424427
// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
425428
bApp := baseapp.NewBaseApp(Name, logger, db, txConfig.TxDecoder(), baseAppOptions...)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ replace (
306306
// release/v1.15
307307
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20250815065500-a4fbafcae0dd
308308
// release/v0.22.x
309-
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.22.1-0.20251023055101-b88263e5b552
309+
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.22.1-0.20251028053456-6d16dd884c83
310310
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
311311
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
312312
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254
912912
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
913913
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254 h1:JzLOFRiKsDtLJt5h0M0jkEIPDKvFFyja7VEp7gG6O9U=
914914
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
915-
github.com/crypto-org-chain/ethermint v0.22.1-0.20251023055101-b88263e5b552 h1:CsOD4gUc6gd7S/J2QghCualcC/Rb1JNdgXjBgMtPbQw=
916-
github.com/crypto-org-chain/ethermint v0.22.1-0.20251023055101-b88263e5b552/go.mod h1:jLZdUMGYqWOuitjw8+U3HcM+BcFeBkoNJYPvRb9r76U=
915+
github.com/crypto-org-chain/ethermint v0.22.1-0.20251028053456-6d16dd884c83 h1:ouTg/5YRD0ne5ZJlKwAGrIGvBsu2rQoHEetWesqzglw=
916+
github.com/crypto-org-chain/ethermint v0.22.1-0.20251028053456-6d16dd884c83/go.mod h1:jLZdUMGYqWOuitjw8+U3HcM+BcFeBkoNJYPvRb9r76U=
917917
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6 h1:6KPEi8dWkDSBddQb4NAvEXmNnTXymF3yVeTaT4Hz1iU=
918918
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
919919
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20250815065500-a4fbafcae0dd h1:ebSnzvM9yKVGFjvoGly7LFQQCS2HuOWMCvQyByJ52Gs=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ schema = 3
315315
version = "v0.2.2"
316316
hash = "sha256-0MLfSJKdeK3Z7tWAXTdzwB4091dmyxIX38S5SKH5QAw="
317317
[mod."github.com/evmos/ethermint"]
318-
version = "v0.22.1-0.20251023055101-b88263e5b552"
319-
hash = "sha256-tqoHuxVFUUDuCms6L4M0IluA1evydzxRjeLp+3mlrHk="
318+
version = "v0.22.1-0.20251028053456-6d16dd884c83"
319+
hash = "sha256-ZMT6uziS698fGQ+tLHcu0WZVTG9iBxv/odrpaxgVx0M="
320320
replaced = "github.com/crypto-org-chain/ethermint"
321321
[mod."github.com/fatih/color"]
322322
version = "v1.17.0"

0 commit comments

Comments
 (0)