Skip to content

Commit

Permalink
Problem: v1.0.x changes are not merged into main (#816)
Browse files Browse the repository at this point in the history
* Problem: eth_sendTransaction is not tested

* Problem: json-rpc apis fail for legacy blocks after upgrade (#696)

* Problem: json-rpc apis fail for legacy blocks

Solution:
- keep the query handler in cosmos-sdk backward-compatible
- add integration test to check

* update sdk to upstream

* ibc-go to rc2

* Problem: file changes detection in workflow is problematic (backport #703) (#705)

* Problem: file changes detection in workflow is problematic

Solution:
- fix wildcards according the plugin's doc
- reformat python

* fix py-lint

* Problem: after v0.9.0 upgrade eth_call failed on old blocks (backport #713) (#719)

* Problem: after v0.9.0 upgrade eth_call failed on old blocks

Solution:
- make grpc query compatible with old format

* debug

* fix eth_call

* fix gravity upgrade test

* update ethermint to main branch

* update sdk

* Problem: state streamers are not integrated (backport #702) (#721)

Solution:
- integration the basic file streamer

* add integration test

* changelog

* fix build

* fix lint

* fix deliver tx event in cosmos-sdk

* fix integration test

* Update integration_tests/test_streamer.py

Signed-off-by: yihuang <[email protected]>

* update ethermint and fix build

* add a small cli utility into test_streamer.py

* fix integration test

* update sdk to upstream

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: new iavl indexes migration is slow and not optional (#714) (#720)

* Problem: new iavl indexes migration is slow and not optional

Closes: #712
Solution:
- Integrate the option introduced in cosmos-sdk

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: recent dependencies are not used (backport #729) (#730)

* Problem: recent dependencies are not used (backport #729)

Solution:
- update cosmos-sdk to 0.46.2, ibc-go to v5.0.0, ethermint to recent main branch

Update highlights:
- new flag to disable fast node migration
- fix streaming listeners bug
- fix grpc server panic
- fix index-eth-tx error on empty db

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: chain state is inconsistent if upgrade migration is interrupted (#748)

* Problem: chain state is inconsistent if upgrade migration is interrupted

Solution:
- update cosmos-sdk with the fix

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* gomod2nix

* skip streamer test

Signed-off-by: yihuang <[email protected]>

* Problem: recent fixes in dependencies are not included (#752)

* Problem: recent fixes in dependencies are not included

Solution:
- update cosmos-sdk and iavl

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* fix build

Signed-off-by: yihuang <[email protected]>

* Problem: binary version is not bump to v1.0.0 (#753)

* Problem: recent fixes in dependencies are not used (#757)

* Problem: recent fixes in dependencies are not used

Solution:
- cosmos-sdk -> v0.46.4
- ethermint -> main
- ibc-go -> v5.0.1
- add dragonberry ics20 replacement

* maintain ethermint fork

* Problem: gas used is not backward compatible (#760)

Solution:
- revert the changes in ethermint

* Problem: evm execute result is non-deterministic with concurrent grpc query (#761)

* Problem: evm execute result is non-deterministic with concurrent grpc query

Solution:
- update dependencies to include the fix

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* Update go.mod

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: extra_eips is not cleared on production network (#762)

* Problem: extra_eips is not cleared on production network

Closes: #755
Solution:
- add 1.0.0 upgrade plan to clear it

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* Update integration_tests/test_upgrade.py

Signed-off-by: yihuang <[email protected]>

* fix integration test

Signed-off-by: yihuang <[email protected]>

* Problem: no error log when iavl set failure trigger app hash mismatch (#763)

* Problem: no error log when iavl set failure trigger app hash mismatch

Solution:
- log the error in cosmos-sdk

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* PR merged

Signed-off-by: yihuang <[email protected]>

* Problem: different result from eth_getProof comparing with Ethereum (#764)

* Problem: different result from eth_getProof comparing with Ethereum

Solution:
- cherry-pick solution from ethermint, thanks @mmsqe

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: nix exceeds github rate limit occationally in CI (backport #766) (#768)

Solution:
- configure access-token
- update the action plugins

* Problem: fixes in ibc-go v5.1 are not included (#765)

* Problem: fixes in ibc-go v5.1 are not included

Solution:
- make a breaking change to upgrade to ibc-go `v5.1.0`.
- will do v1.0.0 upgrade on both testnet and mainnet.

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* fix lint

* include cache fix in tendermint

* update sdk

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* make different plan name v1.0.0-testnet3 for testnet3

Signed-off-by: yihuang <[email protected]>
Co-authored-by: mmsqe <[email protected]>

* Problem: london hardfork number failed validation (#771)

* fix upgrade set parameters

* changelog

* Problem: formal v0.46.5 cosmos-sdk release is not used (#772)

* Problem: formal v0.46.5 cosmos-sdk release is not used

Solution:
- update dependency, should be non-breaking for cronos

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* update to v0.46.6

Signed-off-by: yihuang <[email protected]>

* Problem: final v1.0.0 is not released (#774)

Solution:
- update changelog

* Problem: manual prune cmd is not included (backport #781) (#782)

Solution:
- add to root cmd

* Problem: cosmos-sdk `v0.46.7` is not used (#790)

* Problem: cosmos-sdk `v0.46.7` is not used

Solution:
- update dependency
- `v0.46.7` fix a gov migration issue which affect query votes of old proposals.

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* use sdk streamers config

* fix streamer test

* fix file streamer integration test

* changelog

Signed-off-by: yihuang <[email protected]>

* Problem: discontinued ibc-go version (#802)

* Problem: discontinued ibc-go version

Solution:
- update ibc-go to v5.2.0.
- do another coordinated upgrade on testnet3.

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* Update app/upgrades.go

Signed-off-by: yihuang <[email protected]>

Signed-off-by: yihuang <[email protected]>

* Problem: production rocksdb configuration is not optimal (#813)

* Problem: production rocksdb configuration is not optimal

Solution:
- update related dependencies to allow customize rocksdb options.
- especially using rocksdb v7.
- tune rocksdb options.

* Update Makefile

Signed-off-by: yihuang <[email protected]>

* remove rocksdb from niv

* rocksdb options

* update flake

* fix build

* create_if_missing

* OptimizeLevelStyleCompaction and IncreaseParallelism

* remove SetLevelCompactionDynamicLevelBytes and add BlockCache

* fix integration test

* comments

Signed-off-by: yihuang <[email protected]>

* Problem: prometheus metrics is lost (#814)

* Problem: prometheus metrics is lost

Solution:
- setup correctly in ethermint

* changelog

* release v1.0.3

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* fix changelog

* fix merge

* Update integration_tests/test_upgrade.py

Co-authored-by: mmsqe <[email protected]>
Signed-off-by: yihuang <[email protected]>

* fix test

* Update integration_tests/configs/default.jsonnet

Signed-off-by: yihuang <[email protected]>

* fix test_multiple_attestation_processing

* fix changelog

Signed-off-by: yihuang <[email protected]>
Co-authored-by: mmsqe <[email protected]>
Co-authored-by: mmsqe <[email protected]>
Co-authored-by: Tomas Tauber <[email protected]>
  • Loading branch information
4 people authored Jan 26, 2023
1 parent 79ebec3 commit c6dd8f9
Show file tree
Hide file tree
Showing 25 changed files with 628 additions and 344 deletions.
107 changes: 103 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,118 @@
## Unreleased

### State Machine Breaking

- [cronos#695](https://github.com/crypto-org-chain/cronos/pull/695) Implement ADR-007, generic events format with indexed params.
- [cronos#728](https://github.com/crypto-org-chain/cronos/pull/728) Upgrade gravity bridge latest bugfix, including multi attestation processing and double spend check.
- [cronos#742](https://github.com/crypto-org-chain/cronos/pull/742) Add upgrade handler for v0.8.0-gravity-alpha2.
- [cronos#750](https://github.com/crypto-org-chain/cronos/pull/750) Add upgrade handler for v0.8.0-gravity-alpha3.
- [cronos#769](https://github.com/crypto-org-chain/cronos/pull/769) Prevent cancellation function to be called outside the scope of the contract that manage it.
- [cronos#775](https://github.com/crypto-org-chain/cronos/pull/775) Support turnbridge transaction.
- [cronos#781](https://github.com/crypto-org-chain/cronos/pull/781) Add prune command.

### Bug Fixes

- [#814](https://github.com/crypto-org-chain/cronos/pull/814) Fix prometheus metrics.

### Improvements

- [cronos#702](https://github.com/crypto-org-chain/cronos/pull/702) Integrate the file state streamer.
- [cronos#714](https://github.com/crypto-org-chain/cronos/pull/714) Add option `iavl-disable-fastnode` to disable iavl fastnode indexing migration.
- [cronos#729](https://github.com/crypto-org-chain/cronos/pull/729) Update dependencies to recent versions.
- [cronos#781](https://github.com/crypto-org-chain/cronos/pull/781) Add prune command.
- [#813](https://github.com/crypto-org-chain/cronos/pull/813) Tune up rocksdb options.

*Jan 04, 2023*

## v1.0.2

### State Machine Breaking

- [#802](https://github.com/crypto-org-chain/cronos/pull/802) Update ibc-go to `v5.2.0`.

*December 14, 2022*

## v1.0.1

### Improvements

- [#781](https://github.com/crypto-org-chain/cronos/pull/781) Add prune command.
- [#790](https://github.com/crypto-org-chain/cronos/pull/790) Update cosmos-sdk to `v0.46.7`, it fix a migration issue which affects pending proposals's votes during upgrade,
it also adds the config entries for file streamer.

*Nov 22, 2022*

## v1.0.0

### Improvements

- [#772](https://github.com/crypto-org-chain/cronos/pull/772) Update cosmos-sdk to `v0.46.6`, it's non-breaking for cronos.

*Nov 17, 2022*

## v1.0.0-rc4

### Bug Fixes

- [#771](https://github.com/crypto-org-chain/cronos/pull/771) Fix london hardfork number in testnet3 parameters.

*Nov 13, 2022*

## v1.0.0-rc3

### State Machine Breaking

- [#765](https://github.com/crypto-org-chain/cronos/pull/765) Upgrade ibc-go to [v5.1.0](https://github.com/cosmos/ibc-go/releases/tag/v5.1.0) and related dependencies.

*Nov 10, 2022*

## v1.0.0-rc2

### Bug Fixes

- [#761](https://github.com/crypto-org-chain/cronos/pull/761) Fix non-deterministic evm execution result when there are concurrent grpc queries.
- [#762](https://github.com/crypto-org-chain/cronos/pull/762) Add `v1.0.0` upgrade plan for dry-run and mainnet upgrade, which clears the `extra_eips` parameter.
- [#763](https://github.com/crypto-org-chain/cronos/pull/763) Add error log for iavl set error.
- [#764](https://github.com/crypto-org-chain/cronos/pull/764) Make `eth_getProof` result compatible with ethereum.

*Nov 4, 2022*

## v1.0.0-rc1

### Bug Fixes

- [#760](https://github.com/crypto-org-chain/cronos/pull/760) Revert breaking changes on gas used in Ethermint.

*Nov 1, 2022*

## v1.0.0-rc0

### Bug Fixes

- [#748](https://github.com/crypto-org-chain/cronos/pull/748) Fix inconsistent state if upgrade migration commit is interrupted.
- [#752](https://github.com/crypto-org-chain/cronos/pull/752) Update iavl to `v0.19.4`.

*Oct 15, 2022*

## v0.9.0-beta4

### Bug Fixes

- [cronos#719](https://github.com/crypto-org-chain/cronos/pull/719) Fix `eth_call` for legacy blocks (backport #713).

### Improvements

- [cronos#720](https://github.com/crypto-org-chain/cronos/pull/720) Add option `iavl-disable-fastnode` to disable iavl fastnode indexing migration (backport #714).
- [cronos#721](https://github.com/crypto-org-chain/cronos/pull/721) Integrate the file state streamer (backport #702).
- [cronos#730](https://github.com/crypto-org-chain/cronos/pull/730) Update dependencies to recent versions (backport #729).

*Sep 20, 2022*

## v0.9.0-beta3

### Bug Fixes

- [cronos#696](https://github.com/crypto-org-chain/cronos/pull/696) Fix json-rpc apis for legacy blocks.

*Aug 29, 2022*

## v0.9.0-beta2

*September 13, 2022*

Expand Down
15 changes: 1 addition & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ GOPATH ?= $(shell $(GO) env GOPATH)
BINDIR ?= ~/go/bin
NETWORK ?= mainnet
LEDGER_ENABLED ?= true
# RocksDB is a native dependency, so we don't assume the library is installed.
# Instead, it must be explicitly enabled and we warn when it is not.
ENABLE_ROCKSDB ?= false
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)

TESTNET_FLAGS ?=
Expand Down Expand Up @@ -47,13 +44,6 @@ ifeq ($(LEDGER_ENABLED),true)
endif
endif

ifeq ($(ENABLE_ROCKSDB),true)
BUILD_TAGS += rocksdb_build
test_tags += rocksdb_build
else
$(warning RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true)
endif

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
BUILD_TAGS += gcc
Expand All @@ -63,11 +53,8 @@ ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
endif
# handle rocksdb
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
ifneq ($(ENABLE_ROCKSDB),true)
$(error Cannot use RocksDB backend unless ENABLE_ROCKSDB=true)
endif
CGO_ENABLED=1
BUILD_TAGS += rocksdb
BUILD_TAGS += rocksdb grocksdb_clean_link
endif
# handle boltdb
ifeq (boltdb,$(findstring boltdb,$(COSMOS_BUILD_OPTIONS)))
Expand Down
35 changes: 7 additions & 28 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package app

import (
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"sync"

"github.com/crypto-org-chain/cronos/x/cronos/middleware"

Expand All @@ -20,13 +20,12 @@ import (
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/store/streaming/file"
"github.com/cosmos/cosmos-sdk/store/streaming"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -121,7 +120,7 @@ import (
gravitytypes "github.com/peggyjv/gravity-bridge/module/v2/x/gravity/types"

// this line is used by starport scaffolding # stargate/app/moduleImport
cronosappclient "github.com/crypto-org-chain/cronos/client"

"github.com/crypto-org-chain/cronos/x/cronos"
cronosclient "github.com/crypto-org-chain/cronos/x/cronos/client"
cronoskeeper "github.com/crypto-org-chain/cronos/x/cronos/keeper"
Expand Down Expand Up @@ -347,30 +346,10 @@ func New(
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)

// configure state listening capabilities using AppOptions
// we are doing nothing with the returned streamingServices and waitGroup in this case
// Only support file streamer right now.
if cast.ToString(appOpts.Get(cronosappclient.FlagStreamers)) == "file" {
streamingDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", FileStreamerDirectory)
if err := os.MkdirAll(streamingDir, os.ModePerm); err != nil {
panic(err)
}

// default to exposing all
exposeStoreKeys := make([]storetypes.StoreKey, 0, len(keys))
for _, storeKey := range keys {
exposeStoreKeys = append(exposeStoreKeys, storeKey)
}
service, err := file.NewStreamingService(streamingDir, "", exposeStoreKeys, appCodec)
if err != nil {
panic(err)
}
bApp.SetStreamingService(service)

wg := new(sync.WaitGroup)
if err := service.Stream(wg); err != nil {
panic(err)
}
// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil {
fmt.Printf("failed to load state streaming: %s", err)
os.Exit(1)
}

app := &App{
Expand Down
26 changes: 24 additions & 2 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"fmt"

sdkmath "cosmossdk.io/math"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -11,8 +12,29 @@ import (
)

func (app *App) RegisterUpgradeHandlers(experimental bool) {
planName := "v0.9.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
upgradeHandlerV1 := func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
m, err := app.mm.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return m, err
}
// clear extra_eips from evm parameters
// Ref: https://github.com/crypto-org-chain/cronos/issues/755
params := app.EvmKeeper.GetParams(ctx)
params.ExtraEIPs = []int64{}

// fix the incorrect value on testnet parameters
zero := sdkmath.ZeroInt()
params.ChainConfig.LondonBlock = &zero

app.EvmKeeper.SetParams(ctx, params)
return m, nil
}
// `v1.0.0` upgrade plan will clear the `extra_eips` parameters, and upgrade ibc-go to v5.2.0.
planName := "v1.0.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, upgradeHandlerV1)
// "v1.0.0-testnet3-2" is another coordinated upgrade on testnet3 to upgrade ibc-go to "v5.2.0".
planNameTestnet3 := "v1.0.0-testnet3-2"
app.UpgradeKeeper.SetUpgradeHandler(planNameTestnet3, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

Expand Down
3 changes: 0 additions & 3 deletions client/flags.go

This file was deleted.

15 changes: 15 additions & 0 deletions cmd/cronosd/cmd/open_db.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build !rocksdb
// +build !rocksdb

package cmd

import (
"path/filepath"

dbm "github.com/tendermint/tm-db"
)

func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) {
dataDir := filepath.Join(rootDir, "data")
return dbm.NewDB("application", backendType, dataDir)
}
74 changes: 74 additions & 0 deletions cmd/cronosd/cmd/open_db_rocksdb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//go:build rocksdb
// +build rocksdb

package cmd

import (
"path/filepath"
"runtime"

"github.com/linxGnu/grocksdb"
dbm "github.com/tendermint/tm-db"
)

func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) {
dataDir := filepath.Join(rootDir, "data")
if backendType == dbm.RocksDBBackend {
// customize rocksdb options
db, err := grocksdb.OpenDb(newRocksdbOptions(), filepath.Join(dataDir, "application.db"))
if err != nil {
return nil, err
}
ro := grocksdb.NewDefaultReadOptions()
wo := grocksdb.NewDefaultWriteOptions()
woSync := grocksdb.NewDefaultWriteOptions()
woSync.SetSync(true)
return dbm.NewRocksDBWithRawDB(db, ro, wo, woSync), nil
} else {
return dbm.NewDB("application", backendType, dataDir)
}
}

func newRocksdbOptions() *grocksdb.Options {
opts := grocksdb.NewDefaultOptions()
opts.SetCreateIfMissing(true)
opts.IncreaseParallelism(runtime.NumCPU())
opts.OptimizeLevelStyleCompaction(512 * 1024 * 1024)
opts.SetTargetFileSizeMultiplier(2)

// block based table options
bbto := grocksdb.NewDefaultBlockBasedTableOptions()

// 1G block cache
bbto.SetBlockCache(grocksdb.NewLRUCache(1 << 30))

// larger block means smaller index and better compression ratio.
bbto.SetBlockSize(32 * 1024)

// http://rocksdb.org/blog/2021/12/29/ribbon-filter.html
bbto.SetFilterPolicy(grocksdb.NewRibbonHybridFilterPolicy(9.9, 1))

// partition index
// http://rocksdb.org/blog/2017/05/12/partitioned-index-filter.html
bbto.SetIndexType(grocksdb.KTwoLevelIndexSearchIndexType)
bbto.SetPartitionFilters(true)

// hash index is better for iavl tree which mostly do point lookup.
bbto.SetDataBlockIndexType(grocksdb.KDataBlockIndexTypeBinarySearchAndHash)

opts.SetBlockBasedTableFactory(bbto)

// in iavl tree, we almost always query existing keys
opts.SetOptimizeFiltersForHits(true)

// heavier compression option at bottommost level,
// 110k dict bytes is default in zstd library,
// train bytes is recommended to be set at 100x dict bytes.
opts.SetBottommostCompression(grocksdb.ZSTDCompression)
compressOpts := grocksdb.NewDefaultCompressionOptions()
compressOpts.MaxDictBytes = 110 * 1024
compressOpts.Level = 12
opts.SetBottommostCompressionOptions(compressOpts, true)
opts.SetBottommostCompressionOptionsZstdMaxTrainBytes(compressOpts.MaxDictBytes*100, true)
return opts
}
Loading

0 comments on commit c6dd8f9

Please sign in to comment.