Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
Co-authored-by: Maximilian Breithecker <[email protected]>
Co-authored-by: Troy Kessler <[email protected]>
  • Loading branch information
3 people committed Feb 9, 2023
0 parents commit f8574c9
Show file tree
Hide file tree
Showing 482 changed files with 116,935 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
Guiding Principles:
Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.
Types of changes (Stanzas):
"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"Client Breaking" for breaking Protobuf, gRPC and REST routes used by end-users.
Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

## Unreleased

### Features

- Unbonding time for unstaking from a pool. Protocol node runners have to keep their node running during the unbonding.
- Unbonding time for undelegating from a staker in a pool. The unbonding is performed immediately but the delegator has
to wait until the tokens are transferred back.

- Switch to our custom fork of the Cosmos SDK. This includes the following:
- Stakers and delegators in the KYVE protocol can now participate in governance.
- Proposals can now be expedited, in the case of any emergency actions that need to be taken.
- Different proposals can have different voting periods, depending on the proposal type.

### Improvements

- Bump [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) to [`v0.45.5`](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.5). See [CHANGELOG](https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/CHANGELOG.md#v0455---2022-06-09) for more details.
- Bump [IBC](https://github.com/cosmos/ibc-go) to [`v3.1.0`](https://github.com/cosmos/ibc-go/releases/tag/v3.1.0). See [CHANGELOG](https://github.com/cosmos/ibc-go/blob/v3.1.0/CHANGELOG.md#v310---2022-04-16) for more details.

### Client Breaking Changes

- Switch vote type in `MsgVoteProposal` from `uint64` to `enum`.
- Events from the `x/registry` module are now fully typed.

## [v0.4.0](https://github.com/KYVENetwork/chain/releases/tag/v0.4.0) - 2022-06-7

### Features

- Implemented scheduled upgrades for pool versions
- Implemented `abstain` vote besides `valid` and `invalid`. Validators who don't vote 5 times in a row at all get removed with a timeout slash

### Client Breaking Changes

- The arg `vote` on `MsgVoteProposal` changed from `bool` to `uint64`. 0 = valid, 1 = invalid, 2 = abstain
- The arg `versions` on `MsgCreatePoolProposal` changed to `version`
- The arg `binaries` got added to `MsgCreatePoolProposal`

### Improvements

- Check the quorum of the bundle proposal on chain to prevent unjustified slashes
- Don't drop bundle proposals if one funder can't afford the funding cost, instead remove all of them and proceed
- If a validator submits a `NO_DATA_BUNDLE` the will just skip the upload instead of proposing an empty bundle
- Added query `QueryFunder`
- Added query `QueryStaker`
- Added query `QueryDelegator`

### Bug Fixes

### Deprecated

- Deprecated `versions` on `kyve.registry.v1beta1.Pool`
33 changes: 33 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The KYVE Chain

###### v0.5.3

The chain nodes are the backbone of KYVE. The chain layer is a completely sovereign
[Proof of Stake](https://en.wikipedia.org/wiki/Proof_of_stake) blockchain build with
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) using the [Ignite CLI](https://ignt.com/cli). This blockchain is run
by independent nodes we call _Chain Nodes_ since they're running on the chain level. The native currency of the KYVE
chain is [$KYVE](https://docs.kyve.network/basics/kyve.html), it secures the chain and allows chain nodes to stake and
other users to delegate into them.

---

## Building from source

To build from source, the [Ignite CLI](https://ignt.com/cli) is required.

```sh
ignite chain build --release --release.prefix kyve
```

The output can be found in `./release`.

If you need to build for different architectures, use the `-t` flag, e.g. `-t linux:amd64,linux:arm64`.

## Running a chain node

Full documentation for setting up a chain node are provided [here](https://docs.kyve.network/getting-started/chain-node.html).


### Emergency_1295379
On block #1295379 the chain halts and an emergency upgrade is required.
This upgrade is not handled by cosmovisor. To manually perform the upgrade visit [Emergency_1295379.md](emergency_1295379.md)
53 changes: 53 additions & 0 deletions .github/emergency_1295379.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Emergency_1295379

**This guide assumes you are running the chain using cosmosvisor as explained [here](https://docs.kyve.network/getting-started/chain-node.html).**

On block #1295379 an error occurred in the end_block_logic which caused the chain to halt.
To recover from this error an emergency fix is required.
To apply the emergency fix the following commands need to be executed.

Stop the current chain binary. If you are running using the system-daemon, do
```shell
sudo systemctl stop kyved
```

Move the patch-binary manually and prepare cosmovisor.
```shell
mkdir -p ~/.kyve/cosmovisor/upgrades/emergency_1295379/bin
cd ~/.kyve/cosmovisor/upgrades/emergency_1295379
echo '{"name":"emergency_1295381","info":""}' > upgrade-info.json
cd bin
wget https://github.com/KYVENetwork/chain/releases/download/v0.5.3/chain_linux_amd64.tar.gz
tar -xvzf chain_linux_amd64.tar.gz
```
Check that the sha256 sum is correct:
```
echo "1d93f530e438da9459b79c67a3ea7423aad7b0e814154eb310685500fdb8a758 chain_linux_amd64.tar.gz" | sha256sum -c
```

If there are issues with the disk-space, disable the backup creation of cosmovisor.
Add
```sh
# This line is optional
Environment="UNSAFE_SKIP_BACKUP=true"
```
to the other environment variables in `/etc/systemd/system/kyved.service` and reload the service:
```shell
sudo systemctl daemon-reload
```
Remember to remove this line once it's processed if you want to keep the backup option enabled.

Then start cosmovisor:
```shell
sudo systemctl start kyved
```
Watch the log with
```shell
sudo journalctl -u kyved -f
```
and see if the upgrade passes successfully (i.e. the chain does not crash).

We will wait until `5th June 2022 - 12:00 UTC` until we start the validators again, to give everybody time to perform the upgrade.



16 changes: 16 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defaults:
actions:
backport:
# By default, all backport PRs are assigned to the original author.
assignees:
- "{{ author }}"

pull_request_rules:
- name: backport patches to v1.0.x branch
conditions:
- base=main
- label=backport/v1.0.x
actions:
backport:
branches:
- release/v1.0.x
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: push

jobs:
buf:
runs-on: ubuntu-latest
steps:
# Run `git checkout`
- uses: actions/checkout@v3
# Install `buf`
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
# Lint Protobuf files
- uses: bufbuild/buf-lint-action@v1
with:
buf_token: ${{ secrets.BUF_TOKEN }}

# TODO(@john): Figure out why linting passes locally but not here.
# golangci:
# runs-on: ubuntu-latest
# steps:
# # Run `git checkout`
# - uses: actions/checkout@v3
# # Install `go`
# - uses: actions/setup-go@v3
# # Lint Go files
# - uses: golangci/golangci-lint-action@v3
# with:
# args: --timeout=10m
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea
.vscode
node_modules
release
.DS_Store
/scripts/
test/.env
chain

build
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# CHANGELOG

## v0.7.0_beta7

- refactor: refactored custom keys by renaming `height` to `index` and adding both properties `from_key` and `to_key` to bundle proposal
- refactor: renamed `current_height` to `current_index` and `current_value` to `current_summary` on pool
- refactor: removed `from_height` and `to_height` from bundle proposal and instead added `from_index` and `bundle_size` to indicate more clearly the data range of the bundle
- refactor: renamed `bundle_hash` to `data_hash` on bundle proposal to make it clear the raw compressed data as it lies on the storage provider is hashed
- refactor: renamed `byte_size` to `data_size` on bundle proposal
- refactor: refactored bundle value by renaming `to_value` to `bundle_summary` and allowing protocol nodes to submit an entire bundle summary on-chain instead of just a single value
- feat: added and implemented event `EventPointIncreased`
- feat: added and implemented event `EventPointsReset`
- fix: implemented unused event `EventSlash`
- fix: throw error now if staker joins with a valaddress that is already used by another staker in the same pool

## v0.7.0_beta8
- refactor: added `ar://` to every arweave tx for pool logos
- feat: pool config is now stored externally on arweave of ipfs
- feat: `storageProviderId` and `compressionId` were introduced to pools to enable dynamic storage provider and compression switching
- Refactor Events:
- Emit ClaimedUploaderRole-event
- EventDelegate: `node` -> `staker`
- EventUndelegate: `node` -> `staker`
- EventRedelegate: `from_node` -> `from_staker`, `to_node` -> `to_staker`
- EventWithdrawRewards: `from_node` -> `staker`
- EventCreateStaker: `address` -> `staker`
- EventUpdateMetadata: `address` -> `staker`
- EventSlash: `address` -> `staker`
- EventUpdateCommission: `address` -> `staker`
- Emit `LeavePoolEvent` if staker gets kicked out of pool
18 changes: 18 additions & 0 deletions CodeStructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Code Structure

### Getters
`getters` belong to the keeper directory. Getter files are prefixed with
`getters_`. All methods there always succeed. In the worst case nothing happens.
These methods never throw an error. This is the only place where methods are allowed
to write to the KV-Store. Also, all aggregation variables are updated here.


### Logic-Files
These files are prefixed with `logic_` and handle complex tasks.
They are allowed and encouraged to emit events and call the getters functions.
All logic happens here.


### Msg-Server
Handle transactions on a high level. As much logic as possible should be forwarded
to the logic files. This file should always be easy to read.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2023 BCP Innovations UG (haftungsbeschränkt)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit f8574c9

Please sign in to comment.