diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..99886e6e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contributing + + +Thank you for considering to contribute to this project. KYVE is an L1 based +on Cosmos SDK and CometBFT. We mostly follow their principles and design +architectures. + +## Overview + +- The latest state of development is on `main`. +- `main` must always pass `make all ENV=mainnet`. +- Releases can be found in `/release/*`. +- Everything must be covered by tests. We have a very extensive test-suite + and use triple-A testing (Arrange, Act, Assert). + +## Creating a Pull Request + +- Check out the latest state from main and always keep the PR in sync with main. +- Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification). +- Only one feature per pull request. +- Write an entry for the Changelog. +- Write tests covering 100% of your modified code. +- The command `make all ENV=mainnet` must pass. + +## Coding Guidelines + +- Write readable and maintainable code. `Premature Optimization Is the Root of All Evil`. + Concentrate on clean interfaces first and only optimize for performance if it is needed. +- The keeper directory is structured the following: + - `getters_*`-files only interact with the KV-Store. All methods always succeed + and do not return errors. This is the only place where methods are allowed to + write to the KV-Store. Also, all aggregation variables are updated here. + - `logic_*`-files handle complex tasks and are encouraged to emit events and + call the getters functions. + - `msg_server_*`-files are the entry point for message handling. This file + should be very clean to read and outsource most of the part to the logic files. + One should immediately understand the flow by just reading the function names + which are called while handling the message. + +## Chain Upgrade + +If a major chain upgrade is planned, the additional checks must be done: +- Check if the AnteHandler (app/ante.go:L45) is still up-to-date. +- Check ABCI++ Proposal Handler extensions +- Carefully read the upgrade guides for CosmosSDK and IBC as well as CometBFT +- Get in contact with block explorer maintainers and notify them about upcoming changes. +- Test if Ledger is still working +- Update the [docs](https://docs.kyve.network). + +## Legal + +You agree that your contribution is licenced under the MIT Licence and all +ownership is handed over the authors named in [LICENSE](https://github.com/KYVENetwork/chain/blob/main/LICENSE). diff --git a/Makefile b/Makefile index 3b47d59f..ac105cf8 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,9 @@ release: ensure_environment ensure_version CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build $(BUILD_FLAGS) -o release/kyved_$(ENV)_"$$os"_"$$arch" ./cmd/kyved; \ touch -a -m -t $(BUILD_TIME) release/kyved_$(ENV)_"$$os"_"$$arch"; \ sha256sum release/kyved_$(ENV)_"$$os"_"$$arch" >> release/release_$(ENV)_checksum; \ - tar -C release -cf release/kyved_$(ENV)_"$$os"_"$$arch".tar kyved_$(ENV)_"$$os"_"$$arch"; \ + mv release/kyved_$(ENV)_"$$os"_"$$arch" release/kyved; \ + tar -C release -cf release/kyved_$(ENV)_"$$os"_"$$arch".tar kyved; \ + mv release/kyved release/kyved_$(ENV)_"$$os"_"$$arch"; \ touch -a -m -t $(BUILD_TIME) release/kyved_$(ENV)_"$$os"_"$$arch".tar; \ gzip release/kyved_$(ENV)_"$$os"_"$$arch".tar; \ sha256sum release/kyved_$(ENV)_"$$os"_"$$arch".tar.gz >> release/release_$(ENV)_checksum; \ diff --git a/go.mod b/go.mod index 76a019d2..0655627d 100644 --- a/go.mod +++ b/go.mod @@ -375,6 +375,8 @@ replace ( github.com/cometbft/cometbft => github.com/KYVENetwork/cometbft v0.38.7-kyve-rpc-fix-rc0 // use kyve flavored cosmos/cosmos-sdk github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.50.7-kyve-rc0 + // replace to prevent "failed to prune store, version does not exist error" + github.com/cosmos/iavl v1.1.2 => github.com/cosmos/iavl v1.2.0 // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 diff --git a/go.sum b/go.sum index 297d5df3..8067ae36 100644 --- a/go.sum +++ b/go.sum @@ -419,8 +419,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= -github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= -github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= +github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= +github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= github.com/cosmos/ibc-go/v8 v8.3.1 h1:cUNWvTCftKQIcpbf2y/jVzo2OY3g4GVFw6tTC/pQ+tA= diff --git a/go.work.sum b/go.work.sum index 4c21659d..3f4760d4 100644 --- a/go.work.sum +++ b/go.work.sum @@ -510,6 +510,8 @@ github.com/cometbft/cometbft v0.38.2/go.mod h1:PIi48BpzwlHqtV3mzwPyQgOyOnU94BNBi github.com/cometbft/cometbft v0.38.5/go.mod h1:0tqKin+KQs8zDwzYD8rPHzSBIDNPuB4NrwwGDNb/hUg= github.com/cometbft/cometbft v0.38.6/go.mod h1:8rSPxzUJYquCN8uuBgbUHOMg2KAwvr7CyUw+6ukO4nw= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= +github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= +github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= @@ -538,11 +540,12 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960Bvc github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/iavl v1.1.1/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= -github.com/cosmos/ibc-go/v8 v8.3.1 h1:cUNWvTCftKQIcpbf2y/jVzo2OY3g4GVFw6tTC/pQ+tA= -github.com/cosmos/ibc-go/v8 v8.3.1/go.mod h1:izwHZvn9lKrBn8xWj0aXWut6HKcwHMPD3uyuvOJoPSA= +github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= +github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= diff --git a/x/query/keeper/grpc_account_assets.go b/x/query/keeper/grpc_account_assets.go index 36e0e7ab..064cf24d 100644 --- a/x/query/keeper/grpc_account_assets.go +++ b/x/query/keeper/grpc_account_assets.go @@ -56,7 +56,7 @@ func (k Keeper) AccountAssets(goCtx context.Context, req *types.QueryAccountAsse staker := string(delegatorIterator.Key()[0:43]) response.ProtocolDelegation += k.delegationKeeper.GetDelegationAmountOfDelegator(ctx, staker, req.Address) - response.ProtocolRewards.Add(k.delegationKeeper.GetOutstandingRewards(ctx, staker, req.Address)...) + response.ProtocolRewards = response.ProtocolRewards.Add(k.delegationKeeper.GetOutstandingRewards(ctx, staker, req.Address)...) } // ======================================================