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

V6.0.0 release #1907

Closed
wants to merge 15 commits into from
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog
## v6.0.0
sei-chain
<<<<<<< HEAD
* [#1905](https://github.com/sei-protocol/sei-chain/pull/1905) Use limited wasm gas meter
=======
* https://github.com/sei-protocol/sei-chain/pull/1890/files?
>>>>>>> 7215c653 (bump tm, seidb)
* [#1889](https://github.com/sei-protocol/sei-chain/pull/1889) Fix amino registry for custom modules
* [#1888](https://github.com/sei-protocol/sei-chain/pull/1888) Set EIP-1559 default values
* [#1884](https://github.com/sei-protocol/sei-chain/pull/1884) Update gas tip cap param range
* [#1878](https://github.com/sei-protocol/sei-chain/pull/1878) Add endpoint to estimate gas after simulating calls

sei-cosmos
* [#538](https://github.com/sei-protocol/sei-cosmos/pull/538) Token allowlist feature

sei-tendermint
<<<<<<< HEAD
* [#247](https://github.com/sei-protocol/sei-tendermint/pull/247) Fix handshake and dial timeout
=======
>>>>>>> 7215c653 (bump tm, seidb)
* [#245](https://github.com/sei-protocol/sei-tendermint/pull/245) Exclude unconditional peers when connection limit checking
* [#244](https://github.com/sei-protocol/sei-tendermint/pull/244) Add new config to speed up block sync

sei-db
* [#75](https://github.com/sei-protocol/sei-db/pull/75) Online archive node migration


## v5.9.0
sei-chain
* [#1867](https://github.com/sei-protocol/sei-chain/pull/1867) Add synthetic events in separate sei endpoints
Expand All @@ -38,7 +65,8 @@ sei-chain
* [#1844](https://github.com/sei-protocol/sei-chain/pull/1844) Allowlist for token extensions

sei-iavl
*[#41](https://github.com/sei-protocol/sei-iavl/pull/41) Fix tree versions causing slow restart and OOM
* [#41](https://github.com/sei-protocol/sei-iavl/pull/41) Fix tree versions causing slow restart and OOM

## v5.8.0
sei-chain
* [#1840](https://github.com/sei-protocol/sei-chain/pull/1840) Add migration for new params
Expand Down
7 changes: 6 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ type App struct {

genesisImportConfig genesistypes.GenesisImportConfig

stateStore seidb.StateStore
receiptStore seidb.StateStore
}

Expand Down Expand Up @@ -396,7 +397,7 @@ func New(
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

bAppOptions := SetupSeiDB(logger, homePath, appOpts, baseAppOptions)
bAppOptions, stateStore := SetupSeiDB(logger, homePath, appOpts, baseAppOptions)

bApp := baseapp.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), tmConfig, appOpts, bAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
Expand Down Expand Up @@ -429,6 +430,7 @@ func New(
versionInfo: version.NewInfo(),
metricCounter: &map[string]float32{},
encodingConfig: encodingConfig,
stateStore: stateStore,
}

for _, option := range appOptions {
Expand Down Expand Up @@ -1064,6 +1066,9 @@ func (app *App) Name() string { return app.BaseApp.Name() }
// GetBaseApp returns the base app of the application
func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp }

// GetStateStore returns the state store of the application
func (app App) GetStateStore() seidb.StateStore { return app.stateStore }

// BeginBlocker application updates every begin block
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
metrics.GaugeSeidVersionAndCommit(app.versionInfo.Version, app.versionInfo.GitCommit)
Expand Down
27 changes: 14 additions & 13 deletions app/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,28 @@ func (app *App) AddCosmosEventsToEVMReceiptIfApplicable(ctx sdk.Context, tx sdk.
return
}
logs := []*ethtypes.Log{}
wasmGasLimit := app.EvmKeeper.GetDeliverTxHookWasmGasLimit(ctx)
queryCtx := ctx.WithGasMeter(sdk.NewGasMeterWithMultiplier(ctx, wasmGasLimit))
// Note: txs with a very large number of WASM events may run out of gas due to
// additional gas consumption from EVM receipt generation and event translation
wasmToEvmEventGasLimit := app.EvmKeeper.GetDeliverTxHookWasmGasLimit(ctx.WithGasMeter(sdk.NewInfiniteGasMeter(1, 1)))
wasmToEvmEventCtx := ctx.WithGasMeter(sdk.NewGasMeterWithMultiplier(ctx, wasmToEvmEventGasLimit))
for _, wasmEvent := range wasmEvents {
contractAddr, found := GetAttributeValue(wasmEvent, wasmtypes.AttributeKeyContractAddr)
if !found {
continue
}
// check if there is a ERC20 pointer to contractAddr
pointerAddr, _, exists := app.EvmKeeper.GetERC20CW20Pointer(queryCtx, contractAddr)
pointerAddr, _, exists := app.EvmKeeper.GetERC20CW20Pointer(wasmToEvmEventCtx, contractAddr)
if exists {
log, eligible := app.translateCW20Event(queryCtx, wasmEvent, pointerAddr, contractAddr)
log, eligible := app.translateCW20Event(wasmToEvmEventCtx, wasmEvent, pointerAddr, contractAddr)
if eligible {
log.Index = uint(len(logs))
logs = append(logs, log)
}
continue
}
// check if there is a ERC721 pointer to contract Addr
pointerAddr, _, exists = app.EvmKeeper.GetERC721CW721Pointer(queryCtx, contractAddr)
pointerAddr, _, exists = app.EvmKeeper.GetERC721CW721Pointer(wasmToEvmEventCtx, contractAddr)
if exists {
log, eligible := app.translateCW721Event(queryCtx, wasmEvent, pointerAddr, contractAddr)
log, eligible := app.translateCW721Event(wasmToEvmEventCtx, wasmEvent, pointerAddr, contractAddr)
if eligible {
log.Index = uint(len(logs))
logs = append(logs, log)
Expand All @@ -75,14 +76,14 @@ func (app *App) AddCosmosEventsToEVMReceiptIfApplicable(ctx sdk.Context, tx sdk.
txHash = common.HexToHash(response.EvmTxInfo.TxHash)
}
var bloom ethtypes.Bloom
if r, err := app.EvmKeeper.GetTransientReceipt(ctx, txHash); err == nil && r != nil {
if r, err := app.EvmKeeper.GetTransientReceipt(wasmToEvmEventCtx, txHash); err == nil && r != nil {
r.Logs = append(r.Logs, utils.Map(logs, evmkeeper.ConvertSyntheticEthLog)...)
for i, l := range r.Logs {
l.Index = uint32(i)
}
bloom = ethtypes.CreateBloom(ethtypes.Receipts{&ethtypes.Receipt{Logs: evmkeeper.GetLogsForTx(r)}})
r.LogsBloom = bloom[:]
_ = app.EvmKeeper.SetTransientReceipt(ctx, txHash, r)
_ = app.EvmKeeper.SetTransientReceipt(wasmToEvmEventCtx, txHash, r)
} else {
bloom = ethtypes.CreateBloom(ethtypes.Receipts{&ethtypes.Receipt{Logs: logs}})
receipt := &evmtypes.Receipt{
Expand All @@ -98,14 +99,14 @@ func (app *App) AddCosmosEventsToEVMReceiptIfApplicable(ctx sdk.Context, tx sdk.
sigTx, ok := tx.(authsigning.SigVerifiableTx)
if ok && len(sigTx.GetSigners()) > 0 {
// use the first signer as the `from`
receipt.From = app.EvmKeeper.GetEVMAddressOrDefault(ctx, sigTx.GetSigners()[0]).Hex()
receipt.From = app.EvmKeeper.GetEVMAddressOrDefault(wasmToEvmEventCtx, sigTx.GetSigners()[0]).Hex()
}
_ = app.EvmKeeper.SetTransientReceipt(ctx, txHash, receipt)
_ = app.EvmKeeper.SetTransientReceipt(wasmToEvmEventCtx, txHash, receipt)
}
if d, found := app.EvmKeeper.GetEVMTxDeferredInfo(ctx); found {
app.EvmKeeper.AppendToEvmTxDeferredInfo(ctx, bloom, txHash, d.Surplus)
app.EvmKeeper.AppendToEvmTxDeferredInfo(wasmToEvmEventCtx, bloom, txHash, d.Surplus)
} else {
app.EvmKeeper.AppendToEvmTxDeferredInfo(ctx, bloom, txHash, sdk.ZeroInt())
app.EvmKeeper.AppendToEvmTxDeferredInfo(wasmToEvmEventCtx, bloom, txHash, sdk.ZeroInt())
}
}

Expand Down
18 changes: 14 additions & 4 deletions app/seidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/storev2/rootmulti"
"github.com/sei-protocol/sei-db/config"
seidb "github.com/sei-protocol/sei-db/ss/types"
"github.com/spf13/cast"
"github.com/tendermint/tendermint/libs/log"
)
Expand All @@ -33,18 +34,20 @@ const (

// Other configs
FlagSnapshotInterval = "state-sync.snapshot-interval"
FlagMigrateIAVL = "migrate-iavl"
FlagMigrateHeight = "migrate-height"
)

func SetupSeiDB(
logger log.Logger,
homePath string,
appOpts servertypes.AppOptions,
baseAppOptions []func(*baseapp.BaseApp),
) []func(*baseapp.BaseApp) {
) ([]func(*baseapp.BaseApp), seidb.StateStore) {
scEnabled := cast.ToBool(appOpts.Get(FlagSCEnable))
if !scEnabled {
logger.Info("SeiDB is disabled, falling back to IAVL")
return baseAppOptions
return baseAppOptions, nil
}
logger.Info("SeiDB SC is enabled, running node with StoreV2 commit store")
scConfig := parseSCConfigs(appOpts)
Expand All @@ -56,14 +59,21 @@ func SetupSeiDB(

// cms must be overridden before the other options, because they may use the cms,
// make sure the cms aren't be overridden by the other options later on.
cms := rootmulti.NewStore(homePath, logger, scConfig, ssConfig)
cms := rootmulti.NewStore(homePath, logger, scConfig, ssConfig, cast.ToBool(appOpts.Get("migrate-iavl")))
migrationEnabled := cast.ToBool(appOpts.Get(FlagMigrateIAVL))
migrationHeight := cast.ToInt64(appOpts.Get(FlagMigrateHeight))
baseAppOptions = append([]func(*baseapp.BaseApp){
func(baseApp *baseapp.BaseApp) {
if migrationEnabled {
originalCMS := baseApp.CommitMultiStore()
baseApp.SetQueryMultiStore(originalCMS)
baseApp.SetMigrationHeight(migrationHeight)
}
baseApp.SetCMS(cms)
},
}, baseAppOptions...)

return baseAppOptions
return baseAppOptions, cms.GetStateStore()
}

func parseSCConfigs(appOpts servertypes.AppOptions) config.StateCommitConfig {
Expand Down
40 changes: 40 additions & 0 deletions app/test_state_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ type InMemoryStateStore struct {
earliestVersion int64
}

func (s *InMemoryStateStore) GetLatestMigratedKey() ([]byte, error) {
// TODO: Add get call here
return nil, nil
}

func (s *InMemoryStateStore) SetLatestMigratedKey(key []byte) error {
// TODO: Add set call here
return nil
}

func (s *InMemoryStateStore) GetLatestMigratedModule() (string, error) {
// TODO: Add get call here
return "", nil
}

func (s *InMemoryStateStore) SetLatestMigratedModule(module string) error {
// TODO: Add set call here
return nil
}

func NewInMemoryStateStore() *InMemoryStateStore {
return &InMemoryStateStore{
data: make(map[string]map[int64]map[string][]byte),
Expand Down Expand Up @@ -244,6 +264,26 @@ func (s *InMemoryStateStore) RawImport(ch <-chan types.RawSnapshotNode) error {
return nil
}

func (s *InMemoryStateStore) SetLatestMigratedModule(module string) error {
// TODO: Add set call here
return nil
}

func (s *InMemoryStateStore) GetLatestMigratedModule() (string, error) {
// TODO: Add get call here
return "", nil
}

func (s *InMemoryStateStore) SetLatestMigratedKey(key []byte) error {
// TODO: Add set call here
return nil
}

func (s *InMemoryStateStore) GetLatestMigratedKey() ([]byte, error) {
// TODO: Add get call here
return nil, nil
}

func (s *InMemoryStateStore) Prune(version int64) error {
s.mu.Lock()
defer s.mu.Unlock()
Expand Down
1 change: 1 addition & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var upgradesList = []string{
"v5.7.5",
"v5.8.0",
"v5.9.0",
"v6.0.0",
}

// if there is an override list, use that instead, for integration tests
Expand Down
20 changes: 19 additions & 1 deletion cmd/seid/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/sei-protocol/sei-chain/app/params"
"github.com/sei-protocol/sei-chain/evmrpc"
"github.com/sei-protocol/sei-chain/tools"
"github.com/sei-protocol/sei-chain/tools/migration/ss"
"github.com/sei-protocol/sei-chain/x/evm/blocktest"
"github.com/sei-protocol/sei-chain/x/evm/querier"
"github.com/sei-protocol/sei-chain/x/evm/replay"
Expand Down Expand Up @@ -220,6 +221,8 @@ func txCommand() *cobra.Command {

func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
startCmd.Flags().Bool("migrate-iavl", false, "Run migration of IAVL data store to SeiDB State Store")
startCmd.Flags().Int64("migrate-height", 0, "Height at which to start the migration")
}

// newApp creates a new Cosmos SDK app
Expand Down Expand Up @@ -266,7 +269,7 @@ func newApp(
// This makes it such that the wasm VM gas converts to sdk gas at a 6.66x rate vs that of the previous multiplier
wasmGasRegisterConfig.GasMultiplier = 21_000_000

return app.New(
app := app.New(
logger,
db,
traceStore,
Expand Down Expand Up @@ -302,6 +305,21 @@ func newApp(
baseapp.SetSnapshotDirectory(cast.ToString(appOpts.Get(server.FlagStateSyncSnapshotDir))),
baseapp.SetOccEnabled(cast.ToBool(appOpts.Get(baseapp.FlagOccEnabled))),
)

// Start migration if --migrate flag is set
if cast.ToBool(appOpts.Get("migrate-iavl")) {
go func() {
homeDir := cast.ToString(appOpts.Get(flags.FlagHome))
stateStore := app.GetStateStore()
migrationHeight := cast.ToInt64(appOpts.Get("migrate-height"))
migrator := ss.NewMigrator(homeDir, db, stateStore)
if err := migrator.Migrate(migrationHeight, homeDir); err != nil {
panic(err)
}
}()
}

return app
}

// appExport creates a new simapp (optionally at a given height)
Expand Down
Loading