Skip to content

Commit

Permalink
Release v0.5.0 (#593)
Browse files Browse the repository at this point in the history
## Summary

1. Implement a fix for incomplete migration of topic fields from the
v0.4.0 upgrade.
2. Add additional RPC endpoint to allow for recalculating the inflation
rate / target emission rate more often than once per month.
3. Update to use rewardable topics as active topics instead of using
them separately.
4. Other miscellaneous minor fixes

## Link(s) to Ticket(s) or Issue(s) resolved by this PR

See
[Changelog.md](https://github.com/allora-network/allora-chain/blob/release-v0.5.0/CHANGELOG.md)

---------

Signed-off-by: web3-nodeops <[email protected]>
Signed-off-by: Tobi Okedeji <[email protected]>
Signed-off-by: Fernando Campos <[email protected]>
Signed-off-by: Guilherme Brandão <[email protected]>
Signed-off-by: omahs <[email protected]>
Signed-off-by: R <[email protected]>
Signed-off-by: Oleksandr <[email protected]>
Signed-off-by: Diego C <[email protected]>
Co-authored-by: web3-nodeops <[email protected]>
Co-authored-by: Guilherme Brandão <[email protected]>
Co-authored-by: Kenny P <[email protected]>
Co-authored-by: Diego C <[email protected]>
Co-authored-by: Tobi Okedeji <[email protected]>
Co-authored-by: RedBird96 <[email protected]>
Co-authored-by: fernandofcampos <[email protected]>
Co-authored-by: Elias Rad <[email protected]>
Co-authored-by: Kenny <[email protected]>
Co-authored-by: michael <[email protected]>
Co-authored-by: Guilherme Brandão <[email protected]>
Co-authored-by: omahs <[email protected]>
Co-authored-by: R <[email protected]>
Co-authored-by: Oleksandr <[email protected]>
  • Loading branch information
15 people authored Sep 19, 2024
1 parent be9dd1e commit c1585f9
Show file tree
Hide file tree
Showing 221 changed files with 145,993 additions and 10,128 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_push_upgrader_docker_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ on:
allorad_current_version:
description: 'Current version of allorad'
required: true
default: 'v0.3.0'
default: 'v0.4.0'
allorad_upgrade_version:
description: 'Upgrade version of allorad'
required: true
default: 'v0.4.0'
default: 'v0.5.0'

concurrency:
group: ${{ github.ref }}
Expand Down
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ linters-settings:
- ["ID", "RPC", "IDS", "JSON"] # AllowList
- [] # DenyList
- - upperCaseConst: true
gosec:
config:
G101:
pattern: "(?i)passwd|pass|password|pwd|secret|private_key|token|pw|apiKey|bearer|cred|mneumonic|seed|seedphrase|entropy"
ignore_entropy: false
# Maximum allowed entropy of the string.
entropy_threshold: "80.0"
# Maximum allowed value of entropy/string length.
# Is taken into account if entropy >= entropy_threshold/2.
per_char_threshold: "3.0"
# Calculate entropy for first N chars of the string.
truncate: "32"

issues:
exclude-rules:
- linters:
Expand Down
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,28 @@
],
"cSpell.words": [
"actorutils",
"authtypes",
"autocli",
"Bech",
"cosmossdk",
"cosmostestutil",
"Delegators",
"emissionstestutil",
"errorsmod",
"gomock",
"Inferer",
"inferers",
"moduletestutil",
"msgserver",
"oldtypes",
"protobuf",
"quantile",
"Quantiles",
"reputers",
"sdkerrors",
"storetypes",
"stretchr",
"testutil",
"Wrapf"
],
}
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## v0.5.0

### Summary

1. Implement a fix for incomplete migration of topic fields from the v0.4.0 upgrade.
2. Add additional RPC endpoint to allow for recalculating
the inflation rate / target emission rate more often than once per month.
3. Update to use rewardable topics as active topics instead of using them separately.
4. Other miscellaneous minor fixes

### Added

* [#584](https://github.com/allora-network/allora-chain/pull/584) Allow admins to force target emission recalculation on params update and via dedicated mint RPC endpoint
* [#592](https://github.com/allora-network/allora-chain/pull/592) Update to use rewardable topics as active topics and rename `PickChurnableActiveTopics` to `UpdateNoncesOfActiveTopics`
* [#602](https://github.com/allora-network/allora-chain/pull/602) Refactor: Fix query server proto v4 (refactors [#592](https://github.com/allora-network/allora-chain/pull/592))
* [#607](https://github.com/allora-network/allora-chain/pull/607) Add events for building research monitoring suite

### Fixed

* [#582](https://github.com/allora-network/allora-chain/pull/582) Additional topic fields validation
* [#587](https://github.com/allora-network/allora-chain/pull/587) Update Migration Tests to include NaN Initial Regrets Test
* [#590](https://github.com/allora-network/allora-chain/pull/590) Clear NaN in maps by deleting all map values during migration
* [#595](https://github.com/allora-network/allora-chain/pull/592) Emit inference and forecast score events in case of 1 actor
* [#596](https://github.com/allora-network/allora-chain/pull/596) EMA protection against NaN values
* [#598](https://github.com/allora-network/allora-chain/pull/598) Math Operations on NaNs Should Return Errors
* [#604](https://github.com/allora-network/allora-chain/pull/604) Migration: clean additional stores. Ensure record pruning on reward failure. Autocli fix of multi-reputer-stake function.

### Security

* [#588](https://github.com/allora-network/allora-chain/pull/588) Add String Max Length Module Parameter, Enforce Max String Length on Creation of New Topics
* [#610](https://github.com/allora-network/allora-chain/pull/610) Ensure that BlockHeight of scores is consistently set to be a topic epoch nonce. Also simplify the condition for idempotent payload submission.

## v0.4.0

### Summary
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.cosmovisor
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ ADD https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor/${COSMOVIS
RUN tar -xvf /tmp/cosmovisor.tar.gz -C /usr/local/bin/ && \
chmod +x /usr/local/bin/cosmovisor

ARG ALLORAD_CURRENT_VERSION="v0.3.0"
ARG ALLORAD_UPGRADE_VERSION="v0.4.0"
ARG ALLORAD_CURRENT_VERSION="v0.4.0"
ARG ALLORAD_UPGRADE_VERSION="v0.5.0"

RUN mkdir -p ${INITIAL_COSMOVISOR_DIR}/genesis/bin && \
curl -Lo ${INITIAL_COSMOVISOR_DIR}/genesis/bin/allorad https://github.com/allora-network/allora-chain/releases/download/${ALLORAD_CURRENT_VERSION}/allorad_linux_amd64 && \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.22-bookworm AS builder

ENV GO111MODULE=on
ENV GOMODCACHE=/gocache
ENV BASELINE_VERSION_TAG=v0.3.0
ENV BASELINE_VERSION_TAG=v0.4.0
ENV GIT_STASH_MESSAGE="Docker build"

ADD . /src
Expand Down Expand Up @@ -31,7 +31,7 @@ RUN --mount=type=cache,target=/gocache \
--mount=type=cache,target=/root/.cache/go-build \
make build-local-edits

RUN cp build/allorad /go/bin/allorad-v0.4.0
RUN cp build/allorad /go/bin/allorad-v0.5.0

#==============================================================

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
![Go!](https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white)
![Apache License](https://img.shields.io/badge/Apache%20License-D22128?style=for-the-badge&logo=Apache&logoColor=white)

The Allora Network is a state-of-the-art protocol that uses decentralized AI and machine learning (ML) to build, extract, and deploy predictions among its participants. It offers actors who wish to use AI predictions a formalized way to obtain the output of state-of-the-art ML models on-chain and to pay the operators of AI/ML nodes who create these predictions. That way, Allora bridges the information gap between data owners, data processors, AI/ML predictors, market analysts, and the end-users or consumers who have the means to execute on these insights.
The [Allora Network](https://www.allora.network/) is a state-of-the-art protocol that uses decentralized AI and machine learning (ML) to build, extract, and deploy predictions among its participants. It offers actors who wish to use AI predictions a formalized way to obtain the output of state-of-the-art ML models on-chain and to pay the operators of AI/ML nodes who create these predictions. That way, Allora bridges the information gap between data owners, data processors, AI/ML predictors, market analysts, and the end-users or consumers who have the means to execute on these insights.

The AI/ML agents within the Allora Network use their data and algorithms to broadcast their predictions across a peer-to-peer network, and they ingest these predictions to assess the predictions from all other agents. The network consensus mechanism combines these predictions and assessments, and distributes rewards to the agents according to the quality of their predictions and assessments. This carefully designed incentive mechanism enables Allora to continually learn and improve, adjusting to the market as it evolves.

Expand Down Expand Up @@ -135,7 +135,7 @@ All the following command needs to be executed inside the validator container.
Run `docker compose exec validator0 bash` to get shell of the validator.

You can change `--moniker=...` with a human readable name you choose for your validator.
and `--from=` - is the account name in the keyring, you can list all availble keys with `allorad --home=$APP_HOME keys --keyring-backend=test list`
and `--from=` - is the account name in the keyring, you can list all available keys with `allorad --home=$APP_HOME keys --keyring-backend=test list`

Create stake info file:
```bash
Expand Down
5 changes: 4 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ import (
"github.com/allora-network/allora-chain/app/upgrades"
"github.com/allora-network/allora-chain/app/upgrades/v0_3_0"
"github.com/allora-network/allora-chain/app/upgrades/v0_4_0"
"github.com/allora-network/allora-chain/app/upgrades/v0_5_0"
)

var upgradeHandlers = []upgrades.Upgrade{
v0_3_0.Upgrade,
v0_4_0.Upgrade,
v0_5_0.Upgrade,
// Add more upgrade handlers here
// ...
}

func (app *AlloraApp) setupUpgradeHandlers() {
for _, handler := range upgradeHandlers {
app.UpgradeKeeper.SetUpgradeHandler(handler.UpgradeName, handler.CreateUpgradeHandler(app.ModuleManager, app.Configurator()))
app.UpgradeKeeper.SetUpgradeHandler(handler.UpgradeName,
handler.CreateUpgradeHandler(app.ModuleManager, app.Configurator()))
}
}
27 changes: 27 additions & 0 deletions app/upgrades/v0_5_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package v0_5_0 //nolint:revive // var-naming: don't use an underscore in package name

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/allora-network/allora-chain/app/upgrades"
"github.com/cosmos/cosmos-sdk/types/module"
)

const (
UpgradeName = "v0.5.0"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
}

func CreateUpgradeHandler(
moduleManager *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return moduleManager.RunMigrations(ctx, configurator, vm)
}
}
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
services:
node:
container_name: sample_validator
image: "alloranetwork/allora-chain:v0.4.0-upgrader" # docker image without cosmovisor. use vx.x.x-upgrader for upgrade image
image: "alloranetwork/allora-chain:v0.5.0-docker-upgrade" # docker image without cosmovisor. use vx.x.x-docker-upgrade for upgrade image
environment:
- NETWORK=allora-testnet-1
- MONIKER=sample_validator
- APP_HOME=/data
- HOME=/data
# - STATE_SYNC_RPC1=https://allora-rpc.testnet-1.testnet.allora.network:443
# - STATE_SYNC_RPC2=https://allora-rpc.testnet-1.testnet.allora.network:443
# - STATE_SYNC_RPC1=https://allora-rpc.testnet.allora.network:443
# - STATE_SYNC_RPC2=https://allora-rpc.testnet.allora.network:443
- UPGRADE=true # set this to true for chain upgrade runs
volumes:
- ./data:/data
Expand Down
69 changes: 69 additions & 0 deletions math/collections_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package math_test

import (
"testing"

sdkmath "cosmossdk.io/math"
alloraMath "github.com/allora-network/allora-chain/math"
"github.com/stretchr/testify/require"
)

func TestLegacyDecEncoding(t *testing.T) {
legacyDec := sdkmath.LegacyMustNewDecFromStr("1.25")

encoded, err := alloraMath.LegacyDecValue.Encode(legacyDec)
require.NoError(t, err)
require.Equal(t, []byte("1250000000000000000"), encoded)

decoded, err := alloraMath.LegacyDecValue.Decode(encoded)
require.NoError(t, err)

require.Equal(t, legacyDec, decoded)
}

func TestLegacyDecEncodingJSON(t *testing.T) {
legacyDec := sdkmath.LegacyMustNewDecFromStr("1.25")

encoded, err := alloraMath.LegacyDecValue.EncodeJSON(legacyDec)
require.NoError(t, err)
require.Equal(t, []byte("\"1.250000000000000000\""), encoded)
decoded, err := alloraMath.LegacyDecValue.DecodeJSON(encoded)
require.NoError(t, err)

require.Equal(t, legacyDec, decoded)
}

func TestLegacyDecEncodingStringify(t *testing.T) {
legacyDec := sdkmath.LegacyMustNewDecFromStr("1.25")
result := alloraMath.LegacyDecValue.Stringify(legacyDec)
require.Equal(t, "1.250000000000000000", result)
}

func TestLegacyDecEncodingValueType(t *testing.T) {
require.Equal(t, "math.LegacyDec", alloraMath.LegacyDecValue.ValueType())
}

func TestDecEncoding(t *testing.T) {
dec := alloraMath.MustNewDecFromString("1.25")

encoded, err := alloraMath.DecValue.Encode(dec)
require.NoError(t, err)
require.Equal(t, []byte("1.25"), encoded)
}

func TestDecEncodingJSON(t *testing.T) {
dec := alloraMath.MustNewDecFromString("1.25")
encoded, err := alloraMath.DecValue.EncodeJSON(dec)
require.NoError(t, err)
require.Equal(t, []byte("\"1.25\""), encoded)
}

func TestDecEncodingStringify(t *testing.T) {
dec := alloraMath.MustNewDecFromString("1.25")
result := alloraMath.DecValue.Stringify(dec)
require.Equal(t, "1.25", result)
}

func TestDecEncodingValueType(t *testing.T) {
require.Equal(t, "AlloraDec", alloraMath.DecValue.ValueType())
}
Loading

0 comments on commit c1585f9

Please sign in to comment.