diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ae75f4..4325ec6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,9 @@ - Handle ignored error from TotalBondedTokens in pickReferenceDenom [#230](https://github.com/KiiChain/kiichain/issues/230) - Handle error in pickReferenceDenom instead of panic to prevent consensus failure [#203](https://github.com/KiiChain/kiichain/issues/203) -- Disable EVM mempool due to bug on public nodes broadcast +- Fixed EVM mempool public nodes broadcast bug +- Fixed Ledger failure on linux nano +- Fixed ledger usage of default chain ID - Remove references to time.Now() on release schedule validation - Fix Oracle precompile ParseGetTwapsArgs missing validation for lookbackPeriod [#204](https://github.com/KiiChain/kiichain/issues/204) - Remove unsafe math.Sqrt usage in oracle ballot standard deviation calculation diff --git a/app/app.go b/app/app.go index e3ef8f9f..356495fa 100644 --- a/app/app.go +++ b/app/app.go @@ -273,12 +273,9 @@ func NewKiichainApp( maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)) app.setAnteHandler(app.txConfig, maxGasWanted, appOpts) - // set the EVM priority nonce mempool - // Mempool is currently disabled due to a bug in EVM mempool on public nodes - // It will be enabled again once the bug is fixed on EVM - // if evmtypes.GetChainConfig() != nil { - // app.SetupEVMMempool(appOpts, logger) - // } + if evmtypes.GetChainConfig() != nil { + app.configureEVMMempool(appOpts, logger) + } if manager := app.SnapshotManager(); manager != nil { err = manager.RegisterExtensions(wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper)) diff --git a/app/evm_mempool.go b/app/evm_mempool.go index 44db0d83..6902038b 100644 --- a/app/evm_mempool.go +++ b/app/evm_mempool.go @@ -13,7 +13,7 @@ import ( ) // configureEVMMempool sets up the EVM mempool and related handlers using viper configuration. -func (app *KiichainApp) configureEVMMempool(appOpts servertypes.AppOptions, logger log.Logger) { //nolint:unused +func (app *KiichainApp) configureEVMMempool(appOpts servertypes.AppOptions, logger log.Logger) { if evmtypes.GetChainConfig() == nil { logger.Debug("evm chain config is not set, skipping mempool configuration") return @@ -33,7 +33,6 @@ func (app *KiichainApp) configureEVMMempool(appOpts servertypes.AppOptions, logg app.EVMKeeper, app.FeeMarketKeeper, app.txConfig, - app.clientCtx, mempoolConfig, cosmosPoolMaxTx, ) @@ -53,7 +52,7 @@ func (app *KiichainApp) configureEVMMempool(appOpts servertypes.AppOptions, logg // createMempoolConfig creates a new EVMMempoolConfig with the default configuration // and overrides it with values from appOpts if they exist and are non-zero. -func (app *KiichainApp) createMempoolConfig(appOpts servertypes.AppOptions, logger log.Logger) *evmmempool.EVMMempoolConfig { //nolint:unused +func (app *KiichainApp) createMempoolConfig(appOpts servertypes.AppOptions, logger log.Logger) *evmmempool.EVMMempoolConfig { return &evmmempool.EVMMempoolConfig{ AnteHandler: app.GetAnteHandler(), LegacyPoolConfig: evmconfig.GetLegacyPoolConfig(appOpts, logger), diff --git a/contrib/local_node.sh b/contrib/local_node.sh index ea4d380b..8eb467cd 100755 --- a/contrib/local_node.sh +++ b/contrib/local_node.sh @@ -135,11 +135,13 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML" sed -i '' 's/enabled = false/enabled = true/g' "$APP_TOML" sed -i '' 's/enable = false/enable = true/g' "$APP_TOML" + sed -i '' 's/max-txs = -1/max-txs = 0/g' "$APP_TOML" else sed -i 's/prometheus = false/prometheus = true/' "$CONFIG" sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML" sed -i 's/enabled = false/enabled = true/g' "$APP_TOML" sed -i 's/enable = false/enable = true/g' "$APP_TOML" + sed -i 's/max-txs = -1/max-txs = 0/g' "$APP_TOML" fi # Change proposal periods to pass within a reasonable time for local testing diff --git a/go.mod b/go.mod index ac864eac..9ce0f1ff 100644 --- a/go.mod +++ b/go.mod @@ -311,7 +311,7 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Use our fork w/ fee abstraction possibility - github.com/cosmos/evm => github.com/KiiChain/evm v0.5.1-fork.2 + github.com/cosmos/evm => github.com/KiiChain/evm v0.5.1-fork.3 // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 diff --git a/go.sum b/go.sum index 8a607b49..2df96253 100644 --- a/go.sum +++ b/go.sum @@ -705,8 +705,8 @@ github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXY github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM= -github.com/KiiChain/evm v0.5.1-fork.2 h1:RdhSOFe6eXVnDxf3s1v1HR7z74w+kgHqhttOm4Vy0cc= -github.com/KiiChain/evm v0.5.1-fork.2/go.mod h1:AiKOtGMt539qICNH2Kdy+iw9yK3rlcU6MWet3+g8sWs= +github.com/KiiChain/evm v0.5.1-fork.3 h1:zGdwtaCsaj7O5/DXAZ5NK74ZDVhUzmotoUwW9mQOQKc= +github.com/KiiChain/evm v0.5.1-fork.3/go.mod h1:AiKOtGMt539qICNH2Kdy+iw9yK3rlcU6MWet3+g8sWs= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= diff --git a/tests/e2e/e2e_evm_test.go b/tests/e2e/e2e_evm_test.go index 71e783f2..7b1a9132 100644 --- a/tests/e2e/e2e_evm_test.go +++ b/tests/e2e/e2e_evm_test.go @@ -9,6 +9,7 @@ import ( "math/big" "net/http" "strings" + "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -103,53 +104,52 @@ func (s *IntegrationTestSuite) testEVM(jsonRPC string) { }) } -// Disabled until EVM mempool is enabled again -// // testMempoolEVM Tests EVM's mempool -// func (s *IntegrationTestSuite) testMempoolEVM(jsonRPC string) { -// var err error +// testMempoolEVM Tests EVM's mempool +func (s *IntegrationTestSuite) testMempoolEVM(jsonRPC string) { + var err error -// // Get a funded EVM account and check balance transactions -// evmAccount := s.chainA.evmAccount + // Get a funded EVM account and check balance transactions + evmAccount := s.chainA.evmAccount -// // Setup client -// client, err := ethclient.Dial(jsonRPC) -// s.Require().NoError(err) + // Setup client + client, err := ethclient.Dial(jsonRPC) + s.Require().NoError(err) -// // Get the nonce (transaction count) -// nonce, err := client.PendingNonceAt(context.Background(), evmAccount.address) -// s.Require().NoError(err) + // Get the nonce (transaction count) + nonce, err := client.PendingNonceAt(context.Background(), evmAccount.address) + s.Require().NoError(err) -// // Setup send amt -// amount := big.NewInt(1000000) + // Setup send amt + amount := big.NewInt(1000000) -// // Test Mempool -// s.Run("Testing out of order nonce", func() { -// // Send 3 Txs with nonce -// // Nonce +0 -// tx, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce) -// s.Require().NoError(err) + // Test Mempool + s.Run("Testing out of order nonce", func() { + // Send 3 Txs with nonce + // Nonce +0 + tx, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce) + s.Require().NoError(err) -// // Nonce +2 -// tx2, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce+2) -// s.Require().NoError(err) + // Nonce +2 + tx2, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce+2) + s.Require().NoError(err) -// // Wait to make sure it is in the correct ordering -// time.Sleep(time.Millisecond * 500) + // Wait to make sure it is in the correct ordering + time.Sleep(time.Millisecond * 500) -// // Nonce +1 -// tx3, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce+1) -// s.Require().NoError(err) + // Nonce +1 + tx3, err := EVMSendWithNonce(client, evmAccount.key, evmAccount.address, s.chainB.evmAccount.address, amount, nil, nonce+1) + s.Require().NoError(err) -// // Wait for successful first tx -// s.waitForTransaction(client, tx, evmAccount.address) + // Wait for successful first tx + s.waitForTransaction(client, tx, evmAccount.address) -// // Wait for successful third tx -// s.waitForTransaction(client, tx3, evmAccount.address) + // Wait for successful third tx + s.waitForTransaction(client, tx3, evmAccount.address) -// // Wait for successful second tx -// s.waitForTransaction(client, tx2, evmAccount.address) -// }) -// } + // Wait for successful second tx + s.waitForTransaction(client, tx2, evmAccount.address) + }) +} // waitForTransaction waits until transaction is mined, requiring its success and checks reason in case of failure func (s *IntegrationTestSuite) waitForTransaction(client *ethclient.Client, tx *geth.Transaction, sender common.Address) *geth.Receipt { diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 8b0b7331..4e4cef09 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -561,6 +561,7 @@ func (s *IntegrationTestSuite) initValidatorConfigs(c *chain) { appConfig.API.Address = "tcp://0.0.0.0:1317" appConfig.MinGasPrices = fmt.Sprintf("%s%s", minGasPrice, akiiDenom) appConfig.GRPC.Address = "0.0.0.0:9090" + appConfig.Mempool.MaxTxs = 0 // Setup EVM related evmConfig := evmconfig.DefaultConfig() diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index ed4b1a02..a794c0c3 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -163,8 +163,7 @@ func (s *IntegrationTestSuite) TestEVM() { jsonRPC := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("8545/tcp")) s.testEVMQueries(jsonRPC) s.testEVM(jsonRPC) - // Disabled until mempool bug is fixed - // s.testMempoolEVM(jsonRPC) + s.testMempoolEVM(jsonRPC) } // TestERC20 runs the ERC20 tests. It is skipped if the variable is set