Skip to content
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

Problem: v1.0.x changes are not merged into main #816

Merged
merged 37 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b0099d1
Problem: eth_sendTransaction is not tested
yihuang Sep 9, 2022
c34a372
Problem: json-rpc apis fail for legacy blocks after upgrade (#696)
yihuang Sep 19, 2022
35abeee
Problem: file changes detection in workflow is problematic (backport …
yihuang Sep 20, 2022
10bb672
Problem: after v0.9.0 upgrade eth_call failed on old blocks (backport…
yihuang Sep 26, 2022
7981ed1
Problem: state streamers are not integrated (backport #702) (#721)
yihuang Sep 26, 2022
d6457e8
Problem: new iavl indexes migration is slow and not optional (#714) (…
yihuang Sep 27, 2022
29e51e7
Problem: recent dependencies are not used (backport #729) (#730)
yihuang Oct 6, 2022
36bb343
Problem: chain state is inconsistent if upgrade migration is interrup…
yihuang Oct 26, 2022
3ddaa0b
Problem: recent fixes in dependencies are not included (#752)
yihuang Oct 31, 2022
2d5a72d
Problem: binary version is not bump to v1.0.0 (#753)
yihuang Nov 1, 2022
3921c10
Problem: recent fixes in dependencies are not used (#757)
yihuang Nov 2, 2022
9998985
Problem: gas used is not backward compatible (#760)
yihuang Nov 4, 2022
f394c8c
Problem: evm execute result is non-deterministic with concurrent grpc…
yihuang Nov 8, 2022
90c2c3e
Problem: extra_eips is not cleared on production network (#762)
yihuang Nov 9, 2022
57d1c53
Problem: no error log when iavl set failure trigger app hash mismatch…
yihuang Nov 9, 2022
df0452a
Problem: different result from eth_getProof comparing with Ethereum (…
yihuang Nov 9, 2022
eba04a0
Problem: nix exceeds github rate limit occationally in CI (backport #…
yihuang Nov 11, 2022
a6f5bbc
Problem: fixes in ibc-go v5.1 are not included (#765)
yihuang Nov 13, 2022
4d14c8f
Problem: london hardfork number failed validation (#771)
yihuang Nov 17, 2022
79254b6
Problem: formal v0.46.5 cosmos-sdk release is not used (#772)
yihuang Nov 21, 2022
68f98e4
Problem: final v1.0.0 is not released (#774)
yihuang Nov 21, 2022
db6ed7a
Problem: manual prune cmd is not included (backport #781) (#782)
yihuang Dec 2, 2022
ca4b871
Problem: cosmos-sdk `v0.46.7` is not used (#790)
yihuang Dec 14, 2022
b3da22d
Problem: discontinued ibc-go version (#802)
yihuang Jan 4, 2023
7ef5b04
Problem: production rocksdb configuration is not optimal (#813)
yihuang Jan 19, 2023
8bd3be9
Problem: prometheus metrics is lost (#814)
yihuang Jan 19, 2023
63b2f37
release v1.0.3
yihuang Jan 19, 2023
d61449f
Merge branch 'release/v1.0.x'
yihuang Jan 19, 2023
0ffc3cd
Update CHANGELOG.md
yihuang Jan 19, 2023
7e2cf47
fix changelog
yihuang Jan 19, 2023
cc26687
fix merge
yihuang Jan 19, 2023
d5022ed
Update integration_tests/test_upgrade.py
yihuang Jan 24, 2023
c6a221c
fix test
mmsqe Jan 25, 2023
2d4d98a
Update integration_tests/configs/default.jsonnet
yihuang Jan 26, 2023
a2ffc3f
Merge branch 'main' into main
tomtau Jan 26, 2023
67a024b
fix test_multiple_attestation_processing
mmsqe Jan 26, 2023
26ed55d
fix changelog
yihuang Jan 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
thomas-nguy marked this conversation as resolved.
Show resolved Hide resolved

*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