Commit Graph

1538 Commits

Author SHA1 Message Date
Evgeniy Scherbina
27d63f157c
ci: dispatch run-rosetta-tests event to rosetta-kava (#2007) 2024-08-15 12:00:24 -04:00
Robert Pirtle
7aede3390d
ci: add semantic pull request title linting (#2006)
enforces following conventional commit standard in all PR titles
2024-08-14 10:22:46 -07:00
Robert Pirtle
49f7be8486
docs: update latest mainnet kava version (#2005) 2024-08-13 12:49:12 -07:00
Nick DeLuca
fbce24abef
chore(precisebank): Add queries to swagger (#2004)
This adds the precisebank protobuf generated swagger documentation to
the swagger combine configuration in order to be rendered in the
swagger.yaml file.
2024-08-13 12:32:18 -07:00
Nick DeLuca
7e50ce8142
chore: Add ethermint to swagger (#2002)
This adds the upstream ethermint swagger file to the proto-deps and adds
the swagger combine config to include it in the kava generated swagger.

Run `make proto-all` to update.
2024-08-13 07:34:59 -07: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
cuiweiyuan
33932e8ad6
chore: fix some function names (#1998)
Signed-off-by: cuiweiyuan <cuiweiyuan@aliyun.com.>
2024-08-08 06:38:35 -07:00
Nick DeLuca
ab10ce628c
chore(lint): Disable funlen for test functions (#1993)
This adds a regular expression that matches `func Test...` or
`func (suite *Suite) Test...` style functions and disables the length
check. An example from e2e tests that failed lint:

`func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization()`
2024-08-07 13:25:18 -07:00
sesheffield
edf2935f31
chore(prs): add codeowners (#1995) 2024-08-07 15:50:24 -04:00
Nick DeLuca
a4583be44b
fix(docker): Ignore local build and lint cache (#1994)
These should not be replicated to docker contexts as they are local to
the build host.  In addition, the golangci-lint currently doesn't assume
the host user nor add other group read permissions when writing files,
so this causes permission errors when other docker processes attempt to
copy the files.
2024-08-07 11:20:17 -07:00
sesheffield
3c4d91a443
chore(linter): enable gosec on golangci linter and reformat config file (#1983)
add in gosec to the golangci.yml config file and reorder the linters-settings to be in alphabetical order
2024-08-07 12:24:27 -04:00
Nick DeLuca
774e2efce8
chore(lint): Update local make lint to match CI (#1991)
* chore(lint): Update local make lint to match CI

This updates the `make lint` behavior to match the command being
run in CI.

In addition, we refactor the make lint command to use docker in order to
to ease cross platform install, use a local build cache that integrates
with make clean, use the same version file, and encapsulate the logic in
its own make include.

We also remove the old lint logic as to not introduce a duplicate target
and avoid confusion from a difference in behavior.

While solutions like act for running github actions locally work, it is
not as straightfoward, is slower, and uses the local git repository
instead of a clone (though I am not sure how the checkout step works
within act).

* fix(lint): Use shared timeout with .golangci.yml

Instead of using a local and different timeout in the lint makefile
target we can rely on golangci to load this configuration from
.golangci.yml instead and share this setting with CI.

* fix(lint): Fix golangci-lint cache mount path

This uses the correct cache dir default of ~/.cache enabling use
of cache between lint calls.

* fix(lint): Fix lint caching

This includes a couple fixes - 1) It adds support for full caching of go
mod and go build, speeding up the lint process quite a bit.  And 2) does
not mix lint cache with make clean files -- the docker container creates
root owned files that cause make clean to error and we choose not to
require make clean to run with higher permissions.  The cache must be
deleted manually.
2024-08-05 10:13:17 -07:00
Nick DeLuca
272f82ec99
chore(lint): Enable localmodule for import linter (#1989)
We use three sections through-out the codebase -- standard, default, and
localmodule.  This change updates the linter to enforce this pattern as
files are added or modified.
2024-08-02 12:08:38 -07: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]
4e66a56208
chore(deps-dev): bump undici from 5.22.1 to 5.28.4 in /contracts (#1925)
Bumps [undici](https://github.com/nodejs/undici) from 5.22.1 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.22.1...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-31 17:24:20 -07:00
dependabot[bot]
9c629ad113
chore(deps-dev): bump braces from 3.0.2 to 3.0.3 in /contracts (#1941)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-31 17:17:25 -07:00
sesheffield
b0d737d354
chore(linter): update Golang linter configuration (#1977)
* update golinter + add go sec

* add golangci.yml
Co-authored-by: @faddat jacobgadikian@gmail.com

* update

* update

* fix release version

* remove sec, update from pr comments, cleanup golangci.yml to not break on master

* remove @faddat, not valid codeowner

* remove unnecessary make command

* remove incorrectly named golangci.yml file

* add --new-from-rev

* use master instead of main

* remove extra echo

* set the exports properly

* add setup go to work with act

* add some docs to golangci linter

* test new-from-rev

* enable more linters, but app.go back

* verify issues-exit-code being gone

* put it back

* enable more linters

* remove exclusions
2024-07-31 16:23:44 -04: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
sesheffield
7f339d20ca
fix(insolvency) kava lend insolvency check bug implementation (#1982)
* add additional tests that attempt to borrow funds from the insolvent market(should fail), and attempt to borrow funds from the not insolvent market (it will fail, but shouldn't). The not insolvent market should continue to processs borrows

* remove unused code

* make tests less specific for string contains

* add new get total reserves for denoms functionality

* start utilizing GetTotalReservesForDenoms in ValidateBorrow

* update tests for Borrow to not fail when borrowing from an insolvent market

* use get total reseves in GetTotalReservesForDenoms for reusability

* refactor GetTotalReservesForDenoms to GetTotalReservesByCoinDenoms for more clarity

* change the structure for new and old tests and add more verbosity for other tests

* remove print

* remove unneeded code

* add paren

* adjust structure again after initial PR

* remove duplicate test case with invalid test name, and update to use error contains in places where it was validating if true for strings contains

* no need for keeper method
2024-07-30 13:08:48 -04:00
sesheffield
916ec6d30c
test(insolvency): add tests for Kava lend insolvency check (#1981)
* add additional tests that attempt to borrow funds from the insolvent market(should fail), and attempt to borrow funds from the not insolvent market (it will fail, but shouldn't). The not insolvent market should continue to processs borrows

* remove unused code

* make tests less specific for string contains

* change the structure for new and old tests and add more verbosity for other tests

* remove print

* remove unneeded code

* add paren

* remove duplicate test case with invalid test name, and update to use error contains in places where it was validating if true for strings contains

---------

Co-authored-by: Sam Sheffield <sam.sheffield@kavalabs.io>
2024-07-29 20:51:08 -04:00
Nick DeLuca
b4c04656ab
docs(x/precisebank): Add spec for logic (#1969) 2024-07-29 09:42:17 -07:00
drklee3
837e57ec2e
docs(x/evmutil): Remove akava and evmbankkeeper from spec (#1968) 2024-07-26 14:01:53 -07:00
drklee3
5f802fcfbd
feat(x/precisebank): Emit coin_spent and coin_received events (#1978) 2024-07-26 13:05:49 -07:00
riyueguang
f229afce1a
chore: fix some comments (#1980)
Signed-off-by: riyueguang <rustruby@outlook.com>
2024-07-26 12:38:06 -07:00
drklee3
608f70b20a
feat: Add gRPC query for remainder and account fractional balance (#1971) 2024-07-25 13:36:36 -07:00
Evgeniy Scherbina
74f76d125c
Upgrade opendb (#1972) 2024-07-19 15:44:34 -04:00
drklee3
3853e276a6
feat(x/precisebank): Add query service with TotalFractionalBalances (#1970)
Add query service to precisebank, mostly for e2e test purposes in #1966
Also fix client grpc codec
2024-07-19 10:24:23 -07:00
Evgeniy Scherbina
7aef2f09e9
Upgrade ethermint and opendb (#1965) 2024-07-15 17:45:49 -04: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
drklee3
d2d661276e
feat: Use x/precisebank for x/evm keeper (#1960)
Replace x/evmutil EvmBankKeeper usage for x/evm
2024-07-10 14:20:12 -07:00
drklee3
9de9de671e
feat(x/precisebank): Display 0 reserve balance to module consumers (#1958)
Module reserve represents fractional balances, so it should be hidden to consumers to not have a misleading total balance that doubles the fractional balances. This modifies GetBalance() and SpendableCoin() to always return zero coins when fetching the reserve address balance for fractional amounts.
2024-07-10 11:14:17 -07:00
drklee3
ce6aac3a72
refactor(x/precisebank): Replace FractionalAmount wrapper with func (#1961)
Removal of unnecessary wrapper type, along with using conversionFactor-1 instead of maxFractionalAmount
2024-07-09 15:33:31 -07:00
drklee3
23ce7d8169
feat(x/precisebank): Return full balances in GetBalance(), add SpendableCoin method (#1957)
Change GetBalance() to return full balances instead of spendable to align behavior with x/bank. Add SpendableCoin() method with support of akava for use in x/evm.
2024-06-28 18:06:48 -07:00
drklee3
60a8073574
feat(x/precisebank): Emit events for send/mint/burn (#1955)
Emits the **total** akava amount for both ukava and akava send/mint/burns. If both akava,ukava are sent (not possible via x/evm nor cosmos messages but still an edge case), then the sum is emitted. No other denoms are emitted by x/precisebank as they will be emitted by the underlying x/bank
2024-06-27 19:40:17 -07: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
Paul Downing
6a9eda8634
bump deploy version for internal-testnet (#1952) 2024-06-24 11:33:37 -06:00
Paul Downing
4788c064bf
ci: add native wbtc to internal-testnet evm params proposal (#1951)
* add native wbtc to internal-testnet evm params proposal

* Update seed-internal-testnet.sh

remove leading whitespace
2024-06-24 11:12:18 -06:00
drklee3
1743cf5275
fix(x/precisebank): Ensure exact reserve balance on integer carry when minting (#1932)
Fix reserve minting an extra coin when the recipient module both carries fractional over to integer balance AND remainder is insufficient. Adjusts fractional carry to simply send from reserve, instead of doing an additional mint. Add invariant to ensure reserve matches exactly with fractional balances + remainder, failing on both insufficient and excess funds.
2024-06-20 15:20:13 -07:00
rustco
9aef8e4971
chore: fix mismatched method comments (#1949)
Signed-off-by: rustco <ruster@111.com>
2024-06-20 15:09:21 -07:00
drklee3
38230d35e3
feat(x/precisebank): Implement BurnCoins (#1934)
Implement & test BurnCoins method
2024-06-20 15:02:23 -07:00
Paul Downing
af5eea690b
update internal-testnet verison to latest commit (#1948) 2024-06-18 13:57:22 -06:00
Paul Downing
1c1db357f5
update internal testnet wbtc contract config (#1947) 2024-06-18 13:33:33 -06:00
drklee3
409841c79c
feat(x/precisebank): Implement SendCoins (#1923)
Implements methods SendCoins, SendCoinsFromModuleToAccount, SendCoinsFromAccountToModule
2024-06-17 10:53:41 -07:00
Robert Pirtle
4c3f6533a0 ci: bump internal testnet version 2024-06-14 14:04:38 -07:00
Robert Pirtle
e1bd6ffa2f
ci: prefer checkout action to manual pull (#1945)
for internal testnet deployment, record the desired deployment version
as an action variable that can be used by the checkout action instead of
using manual pull & checkout commands
2024-06-14 13:15:45 -07:00
Paul Downing
5b0e7c8c58
bump internal testnet version (#1944) 2024-06-13 18:58:59 -06:00
Paul Downing
8d85c1ae1e
Update genesis.json (#1943)
* Update genesis.json

* align native wbtc naming conventions

* fitx testnet native wbtc naming in genesis

* alphabetically order denoms for internal-testnet genesis
2024-06-13 17:54:39 -06:00
todaymoon
80f2370d68
chore: make function comments match function names (#1935)
Signed-off-by: todaymoon <csgcgl@foxmail.com>
2024-06-13 12:35:22 -07:00