From 897ca38ec0ba64b770da0bb833f3f05198028cf9 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 6 Dec 2024 14:19:56 +0800 Subject: [PATCH] test(systemtests): fix query block-results in TestStakeUnstake for v2 (#22782) (cherry picked from commit 3a2a0ac66671bad596251e5c1d04c23a44561ced) # Conflicts: # server/v2/testdata/app.toml --- server/v2/testdata/app.toml | 44 +++++++++++++++++++++++++++++++ tests/systemtests/staking_test.go | 6 ++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 server/v2/testdata/app.toml diff --git a/server/v2/testdata/app.toml b/server/v2/testdata/app.toml new file mode 100644 index 000000000000..be2f82566692 --- /dev/null +++ b/server/v2/testdata/app.toml @@ -0,0 +1,44 @@ +[grpc] +# Enable defines if the gRPC server should be enabled. +enable = false +# Address defines the gRPC server address to bind to. +address = 'localhost:9090' +# MaxRecvMsgSize defines the max message size in bytes the server can receive. +# The default value is 10MB. +max-recv-msg-size = 10485760 +# MaxSendMsgSize defines the max message size in bytes the server can send. +# The default value is math.MaxInt32. +max-send-msg-size = 2147483647 + +[mock-server-1] +# Mock field +mock_field = 'default' +# Mock field two +mock_field_two = 1 + +[server] +# minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = '0stake' + +[store] +# The type of database for application and snapshots databases. +app-db-backend = 'goleveldb' + +[store.options] +# State storage database type. Currently we support: "pebble" and "rocksdb" +ss-type = 'pebble' +# State commitment database type. Currently we support: "iavl" and "iavl-v2" +sc-type = 'iavl' + +# Pruning options for state commitment +[store.options.sc-pruning-option] +# Number of recent heights to keep on disk. +keep-recent = 2 +# Height interval at which pruned heights are removed from disk. +interval = 100 + +[store.options.iavl-config] +# CacheSize set the size of the iavl tree cache. +cache-size = 100000 +# If true, the tree will work like no fast storage and always not upgrade fast storage. +skip-fast-storage-upgrade = true diff --git a/tests/systemtests/staking_test.go b/tests/systemtests/staking_test.go index ba734d6e8d90..b1b3829a9d1f 100644 --- a/tests/systemtests/staking_test.go +++ b/tests/systemtests/staking_test.go @@ -42,7 +42,11 @@ func TestStakeUnstake(t *testing.T) { assert.Equal(t, int64(8999999), cli.QueryBalance(account1Addr, "stake")) // check validator has been updated - rsp = cli.CustomQuery("q", "block-results", gjson.Get(rsp, "height").String()) + if systest.IsV2() { + rsp = cli.CustomQuery("q", "comet", "block-results", gjson.Get(rsp, "height").String()) + } else { + rsp = cli.CustomQuery("q", "block-results", gjson.Get(rsp, "height").String()) + } validatorUpdates := gjson.Get(rsp, "validator_updates").Array() assert.NotEmpty(t, validatorUpdates) vpk := gjson.Get(validatorUpdates[0].String(), "pub_key_bytes").String()