Skip to content

Commit

Permalink
Merge branch 'wasmvm-130' into wasm-create-call
Browse files Browse the repository at this point in the history
  • Loading branch information
ylsGit authored Jul 27, 2023
2 parents 22b22d9 + f438319 commit a0065f4
Show file tree
Hide file tree
Showing 44 changed files with 2,576 additions and 614 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IGNORE_CHECK_GO=false
install_rocksdb_version:=$(ROCKSDB_VERSION)


Version=v1.7.7
Version=v1.7.9
CosmosSDK=v0.39.2
Tendermint=v0.33.9
Iavl=v0.14.3
Expand Down
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"fmt"
"github.com/okex/exchain/libs/cosmos-sdk/client/flags"
"io"
"os"
"runtime/debug"
Expand Down Expand Up @@ -958,6 +959,8 @@ func NewAccNonceHandler(ak auth.AccountKeeper) sdk.AccNonceHandler {
}

func PreRun(ctx *server.Context, cmd *cobra.Command) error {
prepareSnapshotDataIfNeed(viper.GetString(server.FlagStartFromSnapshot), viper.GetString(flags.FlagHome), ctx.Logger)

// check start flag conflicts
err := sanity.CheckStart()
if err != nil {
Expand Down
25 changes: 17 additions & 8 deletions app/app_parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ func getTxFeeHandler() sdk.GetTxFeeHandler {

// getTxFeeAndFromHandler get tx fee and from
func getTxFeeAndFromHandler(ek appante.EVMKeeper) sdk.GetTxFeeAndFromHandler {
return func(ctx sdk.Context, tx sdk.Tx) (fee sdk.Coins, isEvm bool, isE2C bool, from string, to string, err error, supportPara bool) {
return func(ctx sdk.Context, tx sdk.Tx) (fee sdk.Coins, isEvm bool, needUpdateTXCounter bool, from string, to string, err error, supportPara bool) {
if evmTx, ok := tx.(*evmtypes.MsgEthereumTx); ok {
isEvm = true
supportPara = true
if appante.IsE2CTx(ek, &ctx, evmTx) {
isE2C = true
if tmtypes.HigherThanVenus6(ctx.BlockHeight()) {
needUpdateTXCounter = true
}
// E2C will include cosmos Msg in the Payload.
// Sometimes, this Msg do not support parallel execution.
if !isParaSupportedE2CMsg(evmTx.Data.Payload) {
if !tmtypes.HigherThanVenus6(ctx.BlockHeight()) || !isParaSupportedE2CMsg(evmTx.Data.Payload) {
supportPara = false
}
}
Expand All @@ -143,11 +145,18 @@ func getTxFeeAndFromHandler(ek appante.EVMKeeper) sdk.GetTxFeeAndFromHandler {
}
} else if feeTx, ok := tx.(authante.FeeTx); ok {
fee = feeTx.GetFee()
if stdTx, ok := tx.(*auth.StdTx); ok && len(stdTx.Msgs) == 1 { // only support one message
if msg, ok := stdTx.Msgs[0].(interface{ CalFromAndToForPara() (string, string) }); ok {
from, to = msg.CalFromAndToForPara()
if tmtypes.HigherThanVenus6(ctx.BlockHeight()) {
supportPara = true
if tx.GetType() == sdk.StdTxType {
if tmtypes.HigherThanEarth(ctx.BlockHeight()) {
needUpdateTXCounter = true
}
txMsgs := tx.GetMsgs()
// only support one message
if len(txMsgs) == 1 {
if msg, ok := txMsgs[0].(interface{ CalFromAndToForPara() (string, string) }); ok {
from, to = msg.CalFromAndToForPara()
if tmtypes.HigherThanVenus6(ctx.BlockHeight()) {
supportPara = true
}
}
}
}
Expand Down
1,218 changes: 1,218 additions & 0 deletions app/app_parallel_test.go

Large diffs are not rendered by default.

31 changes: 13 additions & 18 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,30 @@ import (

ethcommon "github.com/ethereum/go-ethereum/common"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/okex/exchain/app/crypto/ethsecp256k1"
"github.com/okex/exchain/libs/cosmos-sdk/codec"
cosmossdk "github.com/okex/exchain/libs/cosmos-sdk/types"
"github.com/okex/exchain/libs/cosmos-sdk/x/auth"
authclient "github.com/okex/exchain/libs/cosmos-sdk/x/auth/client/utils"
authtypes "github.com/okex/exchain/libs/cosmos-sdk/x/auth/types"
"github.com/okex/exchain/libs/cosmos-sdk/x/upgrade"
abci "github.com/okex/exchain/libs/tendermint/abci/types"
abcitypes "github.com/okex/exchain/libs/tendermint/abci/types"
"github.com/okex/exchain/libs/tendermint/crypto"
"github.com/okex/exchain/libs/tendermint/global"
"github.com/okex/exchain/libs/tendermint/libs/log"
tendertypes "github.com/okex/exchain/libs/tendermint/types"
"github.com/okex/exchain/x/distribution/keeper"
evmtypes "github.com/okex/exchain/x/evm/types"

"github.com/okex/exchain/libs/cosmos-sdk/x/upgrade"
dbm "github.com/okex/exchain/libs/tm-db"
"github.com/okex/exchain/x/dex"
distr "github.com/okex/exchain/x/distribution"
"github.com/okex/exchain/x/distribution/keeper"
evmtypes "github.com/okex/exchain/x/evm/types"
"github.com/okex/exchain/x/farm"
"github.com/okex/exchain/x/params"

"github.com/stretchr/testify/require"

abci "github.com/okex/exchain/libs/tendermint/abci/types"
"github.com/okex/exchain/libs/tendermint/libs/log"
dbm "github.com/okex/exchain/libs/tm-db"

"github.com/okex/exchain/libs/cosmos-sdk/codec"

"github.com/okex/exchain/libs/cosmos-sdk/x/auth"
authtypes "github.com/okex/exchain/libs/cosmos-sdk/x/auth/types"
abcitypes "github.com/okex/exchain/libs/tendermint/abci/types"
"github.com/okex/exchain/libs/tendermint/crypto"
"github.com/okex/exchain/x/gov"
"github.com/okex/exchain/x/params"
)

var (
Expand Down
54 changes: 54 additions & 0 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ type OecConfig struct {
maxGasUsedPerBlock int64
// mempool.enable-pgu
enablePGU bool
// mempool.pgu-percentage-threshold
pguPercentageThreshold int64
// mempool.pgu-concurrency
pguConcurrency int
// mempool.pgu-adjustment
pguAdjustment float64
// mempool.pgu-persist
pguPersist bool
// mempool.node_key_whitelist
nodeKeyWhitelist []string
//mempool.check_tx_cost
Expand Down Expand Up @@ -141,7 +147,10 @@ const (
FlagMaxTxNumPerBlock = "mempool.max_tx_num_per_block"
FlagMaxGasUsedPerBlock = "mempool.max_gas_used_per_block"
FlagEnablePGU = "mempool.enable-pgu"
FlagPGUPercentageThreshold = "mempool.pgu-percentage-threshold"
FlagPGUConcurrency = "mempool.pgu-concurrency"
FlagPGUAdjustment = "mempool.pgu-adjustment"
FlagPGUPersist = "mempool.pgu-persist"
FlagNodeKeyWhitelist = "mempool.node_key_whitelist"
FlagMempoolCheckTxCost = "mempool.check_tx_cost"
FlagMempoolEnableDeleteMinGPTx = "mempool.enable_delete_min_gp_tx"
Expand Down Expand Up @@ -287,7 +296,10 @@ func (c *OecConfig) loadFromConfig() {
c.SetPendingPoolBlacklist(viper.GetString(FlagPendingPoolBlacklist))
c.SetMaxGasUsedPerBlock(viper.GetInt64(FlagMaxGasUsedPerBlock))
c.SetEnablePGU(viper.GetBool(FlagEnablePGU))
c.SetPGUPercentageThreshold(viper.GetInt64(FlagPGUPercentageThreshold))
c.SetPGUConcurrency(viper.GetInt(FlagPGUConcurrency))
c.SetPGUAdjustment(viper.GetFloat64(FlagPGUAdjustment))
c.SetPGUPersist(viper.GetBool(FlagPGUPersist))
c.SetGasLimitBuffer(viper.GetUint64(FlagGasLimitBuffer))

c.SetEnableDynamicGp(viper.GetBool(FlagEnableDynamicGp))
Expand Down Expand Up @@ -504,12 +516,30 @@ func (c *OecConfig) updateFromKVStr(k, v string) {
return
}
c.SetEnablePGU(r)
case FlagPGUPercentageThreshold:
r, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return
}
c.SetPGUPercentageThreshold(r)
case FlagPGUConcurrency:
r, err := strconv.Atoi(v)
if err != nil {
return
}
c.SetPGUConcurrency(r)
case FlagPGUAdjustment:
r, err := strconv.ParseFloat(v, 64)
if err != nil {
return
}
c.SetPGUAdjustment(r)
case FlagPGUPersist:
r, err := strconv.ParseBool(v)
if err != nil {
return
}
c.SetPGUPersist(r)
case FlagGasLimitBuffer:
r, err := strconv.ParseUint(v, 10, 64)
if err != nil {
Expand Down Expand Up @@ -834,6 +864,22 @@ func (c *OecConfig) SetEnablePGU(value bool) {
c.enablePGU = value
}

func (c *OecConfig) GetPGUPercentageThreshold() int64 {
return c.pguPercentageThreshold
}

func (c *OecConfig) SetPGUPercentageThreshold(value int64) {
c.pguPercentageThreshold = value
}

func (c *OecConfig) GetPGUConcurrency() int {
return c.pguConcurrency
}

func (c *OecConfig) SetPGUConcurrency(value int) {
c.pguConcurrency = value
}

func (c *OecConfig) GetPGUAdjustment() float64 {
return c.pguAdjustment
}
Expand All @@ -842,6 +888,14 @@ func (c *OecConfig) SetPGUAdjustment(value float64) {
c.pguAdjustment = value
}

func (c *OecConfig) GetPGUPersist() bool {
return c.pguPersist
}

func (c *OecConfig) SetPGUPersist(value bool) {
c.pguPersist = value
}

func (c *OecConfig) GetGasLimitBuffer() uint64 {
return c.gasLimitBuffer
}
Expand Down
Loading

0 comments on commit a0065f4

Please sign in to comment.