Commit Graph

71 Commits

Author SHA1 Message Date
0g-wh
e0fcd07a08 Merge branch 'dev' of github.com:0glabs/0g-chain into dev 2024-09-25 15:43:41 +00:00
0g-wh
de22587a5b fix 2024-09-25 15:31:20 +00:00
Solovyov1796
94ddf20305 fix test build break 2024-09-25 15:23:35 +00:00
0g-wh
cb4e6e006e fix review issues 2024-09-25 15:19:44 +00:00
0g-wh
822e374be6 rebase to kava cosmos 0.47 upgrade
rename

rename

tidy

clean code
2024-09-25 15:18:12 +00:00
Solovyov1796
56d337df16 rename denoms 2024-09-25 15:12:33 +00:00
Solovyov1796
85059d734e fix unit test 2024-09-25 15:12:16 +00:00
MiniFrenchBread
17fa02b554 feat: precompile 2024-09-25 15:10:47 +00:00
Solovyov1796
547b0057c7 fix unit test 2024-09-25 15:08:30 +00:00
Solovyov1796
337f1c5cc8 rename kava 2024-09-25 15:07:33 +00:00
Solovyov1796
8bc3b15c46 revise proto files 2024-09-25 15:03:21 +00:00
Solovyov1796
e8008c9a3a remove useless modules 2024-09-25 15:03:21 +00:00
Solovyov1796
28fa4b7993 rename go mod path 2024-09-25 15:00:59 +00:00
drklee3
493ce0516f
feat: Add upgrade handler, fractional balances & reserve transfer (#1966)
Add upgrade handler
Migrates from x/evmutil to x/precisebank:
- Fractional balances
- Reserve funds
  - Mints or burns coins to ensure fractional balances are fully backed.

Initialize remainder if necessary to ensure valid state.
E2E test with fixed kvtool
2024-08-21 18:01:29 -07:00
Solovyov1796
f50d847c4f fix test build break 2024-08-12 11:45:01 +08:00
Nick DeLuca
ab3cf7c994
feat!(precompile): Add registry and genesis tests (#1999)
* feat!(precompile): Add registry and genesis tests

Based on evgeniy-scherbina's work, this adds a new precompile module
which defines a contract moudule with an example noop contract that
will be will be used for implementing test functions.  In addition,
it defines a registry module that instantiates stateful precompile
contracts and associates them with an address in a global registry
defined in kava-labs/go-ethereum. See precompile/README.md for more
information.

The kava-labs/go-ethereum and kava-labs/etheremint replace statements
are updated to support these changes as well as an update to kvtool
which includes genesis state for the registry.NoopContractAddress and
initializes the contract's EthAccount with a non-zero sequence and
codehash set to keccak256(0x01), and sets the contract code to 0x01.
See tests/e2e/e2e_precompile_genesis_test.go for an overview of the
expected genesis state for an enabled precompile.

Co-authored-by: evgeniy-scherbina <evgeniy.shcherbina.es@gmail.com>

* chore: Precompile readme improvements

This fixes a typo (import -> important) and uses package terminology
instead of unclear module terminology.  This aligns best with golang
terminology were modules and packages are distinctly different and
modules are defined using go.mod.

* chore: Improve noop contract godoc

Add a more meaningful godoc where the noop contract is constructed.

* chore(e2e): Improve comments around query checks

Improve the clarity of comments around where the error is checked for
accounts and why it is not checked directly.

In addition, improve comment on why both grpc and rpc code is fetched
and where they are used.

---------

Co-authored-by: evgeniy-scherbina <evgeniy.shcherbina.es@gmail.com>
2024-08-09 09:55:31 -07:00
0g-wh
04dfd2a2e9 fix review issues 2024-08-04 13:56:43 +08:00
0g-wh
c949c06fce rebase to kava cosmos 0.47 upgrade
rename

rename

tidy

clean code
2024-08-03 15:05:14 +08:00
Solovyov1796
986172d3a7 rename denoms 2024-08-03 15:05:13 +08:00
Solovyov1796
4fabd4d011 fix unit test 2024-08-03 15:05:03 +08:00
MiniFrenchBread
b53783447b feat: precompile 2024-08-03 15:04:55 +08:00
Solovyov1796
47cee39c64 fix unit test 2024-08-03 15:04:53 +08:00
Solovyov1796
ffad9dbdd5 rename kava 2024-08-03 15:04:46 +08:00
Solovyov1796
2454c94596 revise proto files 2024-08-03 15:04:33 +08:00
Solovyov1796
454733f55b remove useless modules 2024-08-03 15:04:32 +08:00
Solovyov1796
14e1e3a7d4 rename go mod path 2024-08-03 15:03:23 +08:00
Nick DeLuca
e198eeb3b4
fix(e2e): Use docker compose V2 for kvtool and Makefile (#1990)
* chore(Makefile): Migrate to docker compose v2

Use V2 `docker compose` instead of V1 `docker-compose`

* chore(kvtool): Update to latest master commit
2024-08-02 10:45:57 -07:00
drklee3
bbfaa54ddf
chore(deps): Bump cometbft to v0.37.9-kava.1 (#1988)
This resolves ASA-2024-008. Patched in 0.37.7 but that version has a breaking change which was reverted in 0.37.8.

The replace for golang.org/x/exp prevents breaking change in slices package causing compile error with gogoproto
2024-08-02 09:27:28 -07:00
dependabot[bot]
a8df31b31a
chore(deps): bump github.com/btcsuite/btcd from 0.23.4 to 0.24.0 (#1900)
* chore(deps): bump github.com/btcsuite/btcd from 0.23.4 to 0.24.0

Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.23.4 to 0.24.0.
- [Release notes](https://github.com/btcsuite/btcd/releases)
- [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES)
- [Commits](https://github.com/btcsuite/btcd/compare/v0.23.4...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/btcsuite/btcd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: bump github.com/btcsuite/btcd in e2e-ibc

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: drklee3 <derrick@dlee.dev>
2024-07-31 12:52:55 -07:00
dependabot[bot]
6243944db6
chore(deps): bump github.com/hashicorp/go-getter from 1.7.1 to 1.7.5 (#1953)
* chore(deps): bump github.com/hashicorp/go-getter from 1.7.1 to 1.7.5

Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.1 to 1.7.5.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.1...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: bump github.com/hashicorp/go-getter from 1.7.1 to 1.7.5 in e2e-ibc

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: drklee3 <derrick@dlee.dev>
2024-07-31 10:27:46 -07:00
Evgeniy Scherbina
58d7c89f8e
Replace opendb package from kava with generic opendb repo (#1959)
* Upgrade ethermint

* Remove opendb package from kava and add custom dbOpener function

* Open metadata.db with custom opendb function
2024-07-11 09:23:31 -04:00
Robert Pirtle
2d07988994
e2e-ibc: add ERC20 convert to coin & IBC test (#1950)
* generate erc20 golang interface

* write interchain test that deploys ERC20

* enable deployed erc20 as a conversion pair

* convert erc20 to sdk coin!

* refactor: move RandomMnemonic() to util

* erc20 -> cosmos coin -> ibc e2e test

* add NewEvmSignerFromMnemonic to util

* ci: update ibc-test cache dependency list

* fix ci dependencies
2024-06-24 14:55:40 -07:00
largemouth
d66b7d2705
chore: fix some typos (#1913)
Signed-off-by: largemouth <largemouth@aliyun.com>
2024-05-16 13:27:48 -07:00
Robert Pirtle
6a7fd4c8bd
test(e2e-ibc): downgrade to ibc v7 for ibc tests (#1901)
* downgrade to ibc v7 for ibc tests

* add conformance test (does not pass consistently)

* limit number of nodes for more consistent passing

* update to upstream v7 branch of interchaintest

also, remove unnecessary go.mod replace statements

* better names for int pointers
2024-05-07 13:15:38 -07:00
Robert Pirtle
3e877aca88
test: expose evm and add query to EVM (#1892) 2024-04-29 10:13:28 -07:00
Robert Pirtle
d981070ede
test: add packet-forwarding middleware e2e test (#1883)
* setup interchaintest IBC test

* e2e test of packet forwarding middleware

* rename interchain -> e2e-ibc & add make cmd

* add CI step that runs e2e-ibc tests

* use current branch for docker image in e2e-ibc
2024-04-19 12:35:13 -07:00
Nick DeLuca
c9d900be2c
Set the CDP Block Interval to 100 during v0.26.x upgrade (#1865)
* set CDP block interval to 100 to only run interest synchronization
for risky cdps every 100 blocks instead of every block

* refactor and use constant for setting to improve clarity; update
block interval to 50 instead of 100.  This will decrease risk by
running around every 6 minutes instead of 12 mintues for current
mainnet block times.
2024-03-29 11:05:26 -07:00
Draco
ad387e6a42
Add upgrade handler for Kava v0.26.0 (#1827)
* Add upgrade handler for Kava v0.26.0

* Update tests e2e to run upgrade tests
2024-02-13 13:27:27 -05:00
Draco
550ecc8027
Change e2e kvtool config template back to master (#1829) 2024-02-12 15:02:31 -05:00
Draco
5914f1db85
Update Kava grpc client with consensus client (#1828)
* Add consensus client to kava grpc client

* Update kvtool to latest version
This version includes the v25 kava template
2024-02-12 12:49:49 -05:00
Draco
614d4e40fe
Update cosmos-sdk to v0.47.7 (#1811)
* Update cometbft, cosmos, ethermint, and ibc-go

* Replace github.com/tendermint/tendermint by github.com/cometbft/cometbft

* Replace github.com/tendermint/tm-db by github.com/cometbft/cometbft-db

* Replace gogo/protobuf with cosmos/gogoproto & simapp replacement

* Replace cosmos-sdk/simapp/helpers with cosmos-sdk/testutil/sims

* Remove no longer used simulations

* Replace ibchost with ibcexported
See https://github.com/cosmos/ibc-go/blob/v7.2.2/docs/migrations/v6-to-v7.md#ibc-module-constants

* Add new consensus params keeper

* Add consensus keeper to blockers

* Fix keeper and module issues in app.go

* Add IsSendEnabledCoins and update SetParams interface changes

* Fix protobuf build for cosmos 47 (#1800)

* fix cp errors by using -f; fix lint by only linting our proto dir;
and use proofs.proto directly from ics23 for ibc-go v7

* run proto-all; commit updated third party deps and swagger changes

* regenerate proto files

* use correct gocosmos build plugin for buf

* re-gen all protobuf files to update paths for new gocosmos plugin

* update protoc and buf to latest versions

* fix staking keeper issues in app.go

* update tally handler for gov changes

* chain id fix and flag fixes

* update deps for cometbft 47.7 upgrade

* remove all module legacy queriers

* update stakingKeeper to pointer

* Replace ModuleCdc from govv1beta1 to govcodec

* remove simulations

* abci.LastCommitInfo → abci.CommitInfo

* Remove unused code in keys.go

* simapp.MakeTestEncodingConfig -> moduletestutil.MakeTestEncodingConfi

* Fix chain id issues in tests

* Fix remaining unit test issues

* Update changelog for upgrade

* Fix e2e tests using updated kvtool

* Update protonet to v47 compatible genesis

* Bump cometbft-db to v0.9.1-kava.1

* Update kvtool

* Remove extra changelog

* Fix merged rocksdb issues

* go mod cleanup

* Bump cometbft-db to v9 and go to 1.21

* Bump rocksdb version to v8.10.0

* Update kvtool to latest version

* Update gin to v1.9.0

* Use ibctm.ModuleName in app_test

* Fallback to genesis chain id instead of client toml

* Remove all simulations

* Fix cdp migrations issue with v47

* Update dependencies to correct tags

---------

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
2024-02-06 17:54:10 -05:00
Levi Schoen
c59a491788
feat(x/cdp): update begin bloocker to run liquidations every X blocks based off params (#1818)
* (feat) update x/cdp to run every X blocks based off params (#1814)

* add new cdp module param to protonet genesis

* update cdp / cdp related tests for new module param

* update telemetry docs and setup for collecting against local node

* update kvool commit for new cdp param

(cherry picked from commit 4d62f47773)

* add tests for configurable x/cdp begin blocker interval param
add migration for default value of param

* make adjustments based off pr feedback

* fix proto back compat check
2024-02-02 13:21:11 -05:00
Nick DeLuca
2bccb6deaf
Revert "(feat) update x/cdp to run every X blocks based off params" (#1816) 2024-01-25 09:35:56 -07:00
Levi Schoen
4d62f47773
(feat) update x/cdp to run every X blocks based off params (#1814)
* add new cdp module param to protonet genesis

* update cdp / cdp related tests for new module param

* update telemetry docs and setup for collecting against local node

* update kvool commit for new cdp param
2024-01-24 17:10:07 -05:00
drklee3
3767030005
feat(cli): Add rocksdb compact command (#1804)
* Add rocksdb compact command

* Increase compaction log output to 1 min

* Use GetClient/ServerContextFromCmd

* Update cmd info

* Add doc to logColumnFamilyMetadata

* Update RocksDBCmd docs

* Add changelog entry

* Load latest options from rocksdb

* Allow application.db to be compacted

* Rename more store -> db

* Ensure compaction stats output does not run when db is closed

* Add flag for custom stat output interval, return error
2024-01-19 10:17:13 -08:00
Robert Pirtle
58621577ae
feat(cli): add shard CLI command (#1785)
* stub out shard CLI command

* prune blocks before and after desired range

* update rollback to use patched cometbft

* temp override for local patched versions

* handle pruning cometbft & block store state

* include docs & support -1 for "latest"

* update changelog

* add --only-app-state flag to match cosmos-sdk prune cmd

* give -1 magic number a name & reuse home from ctx

* refactor to only open state.db & blockstore.db once

* write rollback progress to one line

* prevent attempting rollback of future blocks

* make shard inclusive of endblock

* use tagged cosmo-sdk & cometbft versions
2024-01-05 11:25:53 -08:00
Draco
ffd306ef52
Kava gRPC Client (#1784)
* add grpc client

* add e2e tests for grpc client

* add grpc client readme

* doc update

* fix more doc issues

* remove util namespace & move grpc client to chain

* rename GrpcClient to Grpc

* add 3rd party query clients

* fix invalid url in readme

* update e2e tests to use grpc client (#1787)
2023-12-13 12:17:37 -05: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