Commit Graph

31 Commits

Author SHA1 Message Date
MiniFrenchBread
0709f2e129 feat: precompile 2024-05-10 02:54:47 +08:00
Solovyov1796
18b6199c1d fix unit test 2024-05-05 15:00:03 +08:00
Solovyov1796
5d11dcab48 rename kava 2024-05-01 13:53:58 +08:00
Solovyov1796
c2af9df57f revise proto files 2024-05-01 11:56:00 +08:00
Solovyov1796
55dee00b2c remove useless modules 2024-05-01 11:46:33 +08:00
Solovyov1796
916f251143 rename go mod path 2024-05-01 11:17:24 +08:00
drklee3
802f1c8112
Add upgrade handler and upgrade e2e tests (#1739)
- Add upgrade handler for mainnet, testnet, and e2e test
- Set validator minimum commission to 5%
- Initialize `x/community` parameters
- Add `banktypes.MsgSend` authz grant for `x/kavadist` for gov proposals
- Set `x/gov` Quorum param to 20%
- Set `x/incentive` earn rewards param for bkava to 600K KAVA per year
2023-11-01 17:22:38 -07:00
drklee3
6998196461
x/community events and e2e test improvements (#1766)
* Initial e2e setup

* Fix inflation disable tests

* Add upgrade handler

* Add param tests for after upgrade

* Replace deprecated grpc creds

* Remove upgrade for e2e test

* Update upgrade handler to set x/community params

* Remove params check in upgrade

* Update tests for switchover time and params check

* wip inflation

* Add attribute to disable inflation event

* Add before/after switchover mint and dist checks

* Add missing attribute to disable inflation test check

* Check mint events are 0

* Check total supply doesn't change

* Check inflation and events before switchover

* Check staking reward payouts from x/community

* move events funcs to util

* Add keyring to chain, fetch keys from kvtool and test withdrawal

* Remove duplicate KavaHomePath

* Update subtest names to specify before/after switchover

Co-authored-by: Draco <draco@dracoli.com>

* Use blocktime for InflationStop event DisableTime

* Test 5 blocks for staking rewards payout

* Remove logging and unused lines

* Check val claimed balance with queried

* Enable and update consolidation tests

* Update test for modified EventTypeInflationStop time attr

* Test x/distribution community tax

* Fix test names

* Update e2e tests for better live network test support (#1749)

* Update e2e tests to support mirrornet

* Skip claim rewards on live network, require no errors for existing tests

* Update readme with upgrade height

* Update .env example with usdt contract address

* Restore .env file to original local e2e

* Log community params when set

* Make AttributeKeyInflationDisableTime more precise

* Add mainnet and testnet community params (#1753)

* Re-enable ibc tests

* Remove duplicate types.EventTypeInflationStop emit

* feat: set validator minimum commissions to at least 5% in upgrade handler (#1761)

* Update validator min commission in upgrade

* Add min commission upgrade test

* Update changelog

* Set validator MaxRate, call BeforeValidatorModified hook

* Check max commission and update time in tests

* Update e2e test for max rate

* Test val update time

* Use SdkBlock instead of Block

* Remove upgrade related handlers and tests

Preserve any module and test util changes

* Update e2e x/community params proposal test to work without upgrade handler

---------

Co-authored-by: Draco <draco@dracoli.com>
2023-10-31 16:37:40 -07:00
drklee3
395b69ac2f
feat(community): add MsgUpdateParams for governance (#1745)
* Add authority, MsgUpdateParams

* Add e2e test for x/community UpdateParamsMsg proposal

* Ensure new params are different

* Add errors and update codec

* Update changelog

* Use single reused govAuthorityAddr

* Add unit tests for authority and msg

* Validate authority address

* Update proto comment

* Check for ErrInvalidSigner in invalid authority error
2023-10-11 10:22:25 -07:00
Nick DeLuca
102cc0fff3
Community Pool Staking Rewards Implementation & Improvements (#1742)
* add new field upgrade_time_set_staking_rewards_per_second with intention
of integrating into the disable inflation logic to set an initial
staking reward time

* when the disable inflation upgrade time occurs, set the staking rewards
per second to the value specified by the new
upgrade_time_set_staking_rewards_per_second.  This will allow a decoupled
implementation between the ugprade switching logic, and the core
functionality of paying staking rewards from the pool

* add staking rewards state to community keeper and community module
genesis that is required to calculate and track staking reward payouts
accross blocks

* add implementation of staking reward payouts

* remove unused error

* touch up tests and add a test case that fully tests behavior when pool
is drained

* add function comments

* refactor and pull out main calculation to private pure function with
no dependence on keeper

* zero out default parameters -- these are too chain specific to have
useful defaults

* small touch ups on comments, test cases

* use correct Int from sdkmath, not old sdk types; update protonet genesis
for new parmater

* fix copy pasta comment

* use bond denom from staking keeper instead of referncing ukava directly

* add staking reward state for valid genesis

* update kvtool genesis for new params and rewards state
2023-10-03 08:41:54 -07:00
Ruaridh
bc260d8091
feat(community): add switchover param (#1704)
* add community params type

* add get/set params methods

* add community genesis state type

* add community init/export genesis

* add querier methods for params

* add query cli cmd

* update changelog

* update protonet genesis

* Add `RewardsPerSecond` param to `x/community` module (#1707)

* Add RewardsPerSecond param to community

* Update rewards per second param to int

* Add rewards_per_second to protonet genesis

* Use default rewards per second of 744191

* Include value if negative in Validate error

* Rename RewardsPerSecond param to StakingRewardsPerSecond

* Add changelog entry

* Add param migration, update consensus version to 2

* Update proto docs

* Update staking_rewards_per_second param name in protonet genesis (#1730)

* Update godoc

Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>

* add genesis state tests

* document what 0 upgrade time means

* update kvtool to include new params

---------

Co-authored-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
2023-09-22 09:05:12 -07:00
Robert Pirtle
839dc80205
test(e2e): update kvtool & e2e tests (#1659)
* add Cdp querier to Chain

* verify funded account has sufficient balance

* return error for nonzero status codes

* update e2e test for eip712 signing

complex eip712 workflow now uses x/cdp instead of x/earn vault

* update to master kvtool

* reset e2e env variables
2023-08-02 14:52:48 -07:00
Robert Pirtle
5cfa33f638
test(e2e): lower cost to run on live networks (#1646)
* add cost summary to e2e test suite runs

* lower cost of test

* refactor initial funding to use new BankSend()

* reduce gas used for initial funding

* return all sdk funds on shutdown

* enable refunds when running against live network

* save more cosmos coins! require less total overall

* track erc20s on Chain

* refactor erc20 funding with new TransferErc20()

* return all registered erc20 balance

* lower erc20 e2e test values

* withdraw earn position & convert back to erc20

* lower gas fees in e2e tests

* fix env variable typo

* add readme note about how to run on live network

* log total spend required for e2e tests
2023-06-29 22:30:02 -07:00
Robert Pirtle
7cff7bec23
test(e2e): support running against live networks (#1630)
* add NodeRunner impl for connecting to live network

* refactor out node runner setups

* remove hardcoded denom for DeployedErc20

* further specify restrictions on DeployedErc20

* don't override .env funded account mnemonic

* lower amounts for convert to coin e2e tests

* lower fund values used by e2e tests

* add doc comments for all e2e functions & types
2023-06-26 15:03:51 -07:00
Robert Pirtle
1a223bdce2
test(e2e): refactor NodeRunner in prep for live networks (#1627)
* add KavaNodeRunner comments

* update kvtool

* refactor pingEvm()

* refactor pingKava()

* refactor EvmRpcPort -> EvmRpcUrl

* refactor ChainDetails (g)rpcPort -> (g)rpcUrl

* fixup chain details

* extract kvtool options to separate config

* refactor waitForChainStart()

* pull out KavaNodeRunner into kvtool file

* rename runner to KvtoolRunner

* rename runner.Config to KvtoolRunnerConfig

* prefix hardcoded chain details with "kvtool"
2023-06-20 09:29:25 -07:00
Robert Pirtle
141e8ac450
test(e2e): add Committee & Upgrade query clients (#1618)
Also:
- updates kvtool
- adds helper comment to upgrade e2e file
- adjusts e2e account funding logging
- [testnets] enable eip712 signing of cosmos coin msgs
- [testnets] enable cosmos coin conversion for HARD
2023-06-06 14:51:42 -07:00
Robert Pirtle
c90c7a8647
test(e2e): test more complex cosmos assert conversion (#1616)
* ensure users can mint() or burn() erc20s

* refactor test setup

* refactor GetErc20Balance for arbitrary erc20 contracts

* move GetErc20Balance() to Chain

* test complex erc20 operations & convert

* undo changes to e2e env
2023-06-06 09:40:17 -07:00
Robert Pirtle
a1f1f0d957
test(e2e): add tests for cosmos coin conversion (#1612)
* add e2e test for cosmos coin conversion

* add e2e test for eip712 signing of converts

* update kvtool
2023-06-05 13:22:23 -07:00
Robert Pirtle
8c1c29a03a
feat: add CommunityPoolLendWithdrawalPermission (#1562)
* feat: add CommunityPoolLendWithdrawalPermission

* update kvtool to master branch

* register with PubProposal legacy amino codec

* register missing legacy amino codec PubProposal
2023-04-18 12:31:43 -07:00
Robert Pirtle
3366b3b3e3
feat: e2e test eip712 signing & erc20 interactions (#1535)
* add helpers & tests for erc20 eth_call query & transfer

* make encoding config public

* add evm client & raw evm signer to account

* test eip712 signing and broadcast

* update for cosmos v46

* update kvtool

* temporarily disable ibc tests & skip shutdown

* disable all but eip712 test and massively simplify

* add EIP712 tx builder & setup basic MsgSend test

* reenable all tests

* add eip712 test that deposits erc20 into earn

* update kvtool to master branch
2023-04-06 10:51:13 -07:00
drklee3
3375484f79
Update deprecated Cosmos methods (#1530)
* Use cosmossdk.io/errors for deprecated error methods

* Update error registration with cosmossdk.io/errors

* Use cosmossdk.io/math for deprecated sdk.Int alias

* Fix modified proto file

* Update sdk.Int usage in swap hooks

* Update e2e test deprecated method usage
2023-04-05 16:21:59 -07:00
Robert Pirtle
c73217ef8d
update kvtool & reenable ibc tests (#1531) 2023-04-05 09:27:32 -07:00
Robert Pirtle
646e376698
fix e2e test in CI pipeline (#1528)
* update docker image to go 1.19

* update kvtool

* add .tool-versions for automagic go version usage

* update prtotonet genesis with missing params

* update kvtool (fixes evm port exposure)

* fix changed error message for insufficient fee

* add error message on failed contract deployment

* update kvtool (set consensus_params.block.max_gas)

* temporarily disable ibc e2e tests

* update kvtool to master
2023-04-04 14:22:18 -07:00
drklee3
f757d7ab15
feat: upgrade to Cosmos v0.46 (#1477)
* Update cosmos-sdk to v0.45.10-kava

* Add RegisterNodeService to app

* Update cosmos proto files

* Update cosmos proto files

* Use tagged v0.45.10-kava-v0.19-0.21 cosmos version

* update x/auth/legacy to x/auth/migrations

* Delete rest packages and registration

* Remove rest from proposal handlers

* Remove legacy types referencing removed sdk types

* Remove legacy tx broadcast handler

* Update incentive staking hooks to return error

* Remove grpc replace directive, use new grpc version

* Fix storetypes import

* Update tally_handler with updated gov types

* Delete legacy types

* Use new gov default config

* Update RegisterTendermintService params

Signed-off-by: drklee3 <derrick@dlee.dev>

* Replace sdk.StoreKey with storetypes.StoreKey

* Replace sdk.Int#ToDec with sdk.NewDecFromInt

* Replace sdk.NewUintFromBigInt with sdkmath.NewUintFromBigInt

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update most intances of govtypes to govv1beta1

* Unpack coin slice for Coins#Sub and Coins#SafeSub

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update committee gov codec registration

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update migrate utils period_vesting Coins#Sub

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Coin#Sub in community proposal handler

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Coin#Sub, FundModuleAccount/FundAccount in banktestutil

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update community, earn, kavadist proposal gov registration

* Update evm cli client EthSecp256k1Type check

* AccAddressFromHex to AccAddressFromHexUnsafe

* Add mint DefaultInflationCalculationFn to earn test

* Update use of removed staking.NewHandler

* Rename FlagIAVLFastNode -> FlagDisableIAVLFastNode

* cmd: Update new snapshot app option

Signed-off-by: drklee3 <derrick@dlee.dev>

* cmd: Add tendermint default config, use cosmos rpc status command

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ethermint import path

github.com/tharsis/ethermint -> github.com/evmos/ethermint

* Upgrade ibc-go to v6

* Update proto dependencies

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Tally handler test with new gov types

* Update helpers.GenTx -> helpers.GenSignedMockTx

* Update evmkeeper.NewKeeper params

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ante authz, tests

* Add feemarket transient key, pass subspaces to evm/feemarket keepers

* Update new ante decorators

* Add new addModuleInitFlags to server commands

* Pass codec to keyring.New in genaccounts

* Pass codec to client keys add

* Add SendCoins to evmutil bank_keeper

* Use github.com/cosmos/iavl@v0.19.5

* Add ante HandlerOptions

* Add unimplemented SendCoins to evmutil bank keeper

Ethermint x/evm does not use this method

* Update init-new-chain script to disable post-london blocks

* Modify test genesis states to append 1 validator

* Update tally handler test to use string values

* Prevent querying balance for empty sdk.AccAddress in auction bidding test

* Set default bond denom to ukava

* Remove overwritten bank genesis total supply in committee proposal test

Signed-off-by: drklee3 <derrick@dlee.dev>

* Use ukava for testing staked balance

* Disable minting in community proposal handler test

Previously stake denom is used, which resulted in 0 minted coins

* Update hard APYToSPY test expected value

Increased iterations in sdk.ApproxRoot, updated closer to real value

* Fix NewDecCoinsFromCoins bug in incentive collectDerivativeStakingRewards

* Allow bkava earn incentive test values to match within small margin for rounding

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update invalid denom in issuance message coin validation

Colons are now valid in denoms

Signed-off-by: drklee3 <derrick@dlee.dev>

* Remove genesis validator in incentive delegation tests

* Update pricefeed market test for invalid denom

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update incentive delegator rewards test without genesis validator

Signed-off-by: drklee3 <derrick@dlee.dev>

* Add validator to export test

* Clear bank state in minting tests

Signed-off-by: drklee3 <derrick@dlee.dev>

* Remove validator for no stake tally test

Signed-off-by: drklee3 <derrick@dlee.dev>

* Clear incentive state before InitGenesis in incentive genesis export test

* Update swagger

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ethermint version to match replaced version

* Remove legacy swagger

* Add NewEthEmitEventDecorator

* Remove redundant func for AddModuleInitFlags

* Remove unused addBankBalanceForAddress func

* Add SetIAVLLazyLoading option to app cmd

* Use legacy.RegisterAminoMsg for committee msg concrete registration

* Remove unnecessary Amino field

* Add evm_util bankkeeper SendCoins comment

* Update test method ResetBankState to DeleteGenesisValidatorCoins to be more clear

* Validate incentive params.RewardsPerSecond to be non-zero

* Validate swap pools to disallow colons in token denoms

* Register all legacy amino types on gov modulecdc

* Remove redundant Comittee interface registration

* Pin goleveldb to v1.0.1-0.20210819022825-2ae1ddf74ef7

Causes failed to load state at height errors

* Update ethermint to new pinned version with minGasPrices parse error fix

* Update cosmos fork dependcy commit to include reverted account constructor patch

* Update Cosmos v0.46.11 and cometbft v0.34.27

* Bump minimum go version to 1.19

* Update tendermint proto

* Update internal testnet genesis

* Move NewCanTransferDecorator before NewEthGasConsumeDecorator

* Add hard borrow store tests (#1514)

* add store tests for Borrow type

* refactor Deposit tests to match

* Fix old bep3 tests (#1515)

* Update Ethermint to 1b17445 to fix duplicate proto registration

* Add custom status command to use snake_case and stdout

* Add SetInflation helper

* Reduce ambiguity with evm CanSignEthTx error

* Remove init genesis validator claim in test

* Add disabled evmante.NewMinGasPriceDecorator with x/feemarket note

* chore: use tagged versions for Cosmos and Ethermint forks

* update kvtool & increase wait for ibc transfer test

---------

Signed-off-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
Co-authored-by: Robert Pirtle <astropirtle@gmail.com>
2023-04-03 20:08:45 -04:00
Robert Pirtle
735d44ba32
support initialization of evm state in e2e tests (#1524)
* check receipt status for failed txs from evm

* make EvmSigner's Auth public

* setup evm state initialization for e2e

* add a dummy Greeter contract, deployed on start
* move WaitForEvmTxReceipt to from account to util
* add tests for interacting with the contract
* add ContractAddrs map to Chain
2023-04-03 09:58:45 -07:00
Robert Pirtle
6a1438fbe9
add evm min fee e2e tests (#1521)
* parse min gas price from app.toml

* test eth_gasPrice returns min fee

* use naming best practices for custom errors

* add test that evm respects min gas price

* update kvtool

* increase ibc test wait time & update kvtool
2023-03-31 10:30:37 -07:00
Robert Pirtle
0156b0e645
support chian upgrades in e2e tests (#1513)
* update kvtool

* add env vars for e2e automated upgrades

* run kvtool with upgrade flags when enabled

* add e2e test placeholder for upgrade handler tests

* allow override of kvtool's kava.configTemplate

* use the correct image tag when running e2e tests

* update kvtool

* always docker-build when running make test-e2e

* refactor skip shutdown to always skip shutdown

* add CtxAtHeight grpc helper

* add Community & Earn queriers

* expose UpgradeHeight in suite

* document e2e chain upgrades

* add reference to example branch
2023-03-28 15:32:36 -07:00
Robert Pirtle
dbd7d632fa
document e2e test suite (#1489)
* add ChainId & StakingDenom to Chain

* document E2E_SKIP_SHUTDOWN env variable

* add update-kvtool make command

* document e2e test suite

* misc updates for clarity
2023-03-17 11:30:23 -07:00
Robert Pirtle
37b1b5fa5e
Add IBC chain to E2E test suite (#1486)
* add kvtool as a subrepo

* use kvtool instead of hardcoded configurations

* encapsulate chain port numbers

* refactor query clients

* include ibc in test suite

* track & create accounts per chain

* setup test suite env & toggle for IBC tests

* support different denoms on different chains

* add E2E_SKIP_SHUTDOWN flag

* test ibc transfer of funds!

* include submodules in necessary github checkout action

* update readme w/ details about e2e git submodules
2023-03-07 14:37:45 -08:00
Robert Pirtle
f051ea3a49
Add EVM signer to e2e test SigningAccounts (#1482)
* rename cosmos-sdk specific signers

* add evm_signer util

* add utilities for converting between addresses

* rename signers

* dont include e2e tests in docker image

* add evmsigner to e2e SigningAccount

* add new whale account that is an EthAccount

* use ethsecp256k1 for e2e SigningAccounts

* wait for evm tx to be committed to block

also add example evm tx tests! 🎉

* check remainined balance is expected

* check balance via evm
2023-03-01 17:05:53 -08:00
Robert Pirtle
ff5b0e814e
add initial E2E testing setup (#1475)
* setup e2e test that starts kava chain

* refactor into a testify suite

* setup ethClient

* add example test checking chain id

* cleanup

* refactor & support funded accounts with txs

* ignore e2e tests in CI & consolidate makefiles

* remove circular go.mod dependency

vendors `signing` and `grpc` packages from `kava-labs/go-tools` to
refrain from a circular dep and fix pulled in dep versions

* add min fee for evm side

* prune nothing in e2e node
2023-02-22 15:40:56 -08:00