Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into kenny/ora-1813-make-th…
Browse files Browse the repository at this point in the history
…e-hard-actor-limit-permeable-by-updating-emas-of
  • Loading branch information
relyt29 committed Aug 21, 2024
2 parents d4db31c + d23be2d commit 0ff94d4
Show file tree
Hide file tree
Showing 41 changed files with 3,003 additions and 1,894 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#409](https://github.com/allora-network/allora-chain/pull/409)
* Added validations for safer data ingress
* [#398](https://github.com/allora-network/allora-chain/pull/398)
* Update forecast utiity function
* Update forecast utility function
* [#382](https://github.com/allora-network/allora-chain/pull/382)
* Automatically expire stake removals instead of requiring a 2nd tx
* [#362](https://github.com/allora-network/allora-chain/pull/362)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ With `curl -so- http://localhost:26657/status | jq .result.sync_info.catching_up

## Run a validator

You can refer to the Allora documentation for detailled instructions on [running a full node](https://docs.allora.network/devs/validators/run-full-node) and [staking a validator](https://docs.allora.network/devs/validators/stake-a-validator).
You can refer to the Allora documentation for detailed instructions on [running a full node](https://docs.allora.network/devs/validators/run-full-node) and [staking a validator](https://docs.allora.network/devs/validators/stake-a-validator).

1. Run and sync a full Allora node following [the instructions](https://docs.allora.network/devs/validators/run-full-node).

Expand All @@ -127,7 +127,7 @@ Wait until you see the output: "false"

`l1_node.sh` script generates keys, you can find created account information in `data/*.account_info`. Get the address from the file and fund, on testnets you can use faucet `https://faucet.${NETWORK}.allora.network`.

4. Stake validator (detailled instructions [here](https://docs.allora.network/devs/validators/stake-a-validator))
4. Stake validator (detailed instructions [here](https://docs.allora.network/devs/validators/stake-a-validator))

Here's an example with Values which starts with a stake of 10000000uallo.

Expand Down
2 changes: 1 addition & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (app *AlloraApp) ExportAppStateAndValidators(
func (app *AlloraApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
applyAllowedAddrs := false

// check if there is a allowed address list
// check if there is an allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}
Expand Down
7 changes: 0 additions & 7 deletions app/topics_handler.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package app

import (
"cosmossdk.io/log"

emissionskeeper "github.com/allora-network/allora-chain/x/emissions/keeper"

abci "github.com/cometbft/cometbft/abci/types"
Expand All @@ -23,11 +21,6 @@ func NewTopicsHandler(emissionsKeeper emissionskeeper.Keeper) *TopicsHandler {

func (th *TopicsHandler) PrepareProposalHandler() sdk.PrepareProposalHandler {
return func(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) {
Logger(ctx).Debug("\n ---------------- TopicsHandler ------------------- \n")
return &abci.ResponsePrepareProposal{Txs: req.Txs}, nil
}
}

func Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "topic_handler")
}
2 changes: 0 additions & 2 deletions app/upgrades/v0_3_0/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v0_3_0 //nolint:revive // var-naming: don't use an underscore in package

import (
"context"
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/allora-network/allora-chain/app/upgrades"
Expand All @@ -23,7 +22,6 @@ func CreateUpgradeHandler(
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
fmt.Printf("Running upgrade handler for %s\n", UpgradeName)
return moduleManager.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 0 additions & 2 deletions app/upgrades/v0_4_0/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v0_4_0 //nolint:revive // var-naming: don't use an underscore in package

import (
"context"
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/allora-network/allora-chain/app/upgrades"
Expand All @@ -23,7 +22,6 @@ func CreateUpgradeHandler(
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
fmt.Printf("Running upgrade handler for %s\n", UpgradeName)
return moduleManager.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 1 addition & 1 deletion math/dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (x Dec) Quo(y Dec) (Dec, error) {
return z, errors.Wrap(err, "decimal quotient error")
}

// MulExact returns a new dec with value x * y. The product must not round or
// MulExact returns a new dec with value x * y. The product must not be rounded or
// ErrUnexpectedRounding will be returned.
func (x Dec) MulExact(y Dec) (Dec, error) {
var z Dec
Expand Down
15 changes: 0 additions & 15 deletions math/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ func CalcEma(
return ret, nil
}

func CalcExpDecay(
currentRev,
decayFactor Dec,
) (Dec, error) {
oneMinusDecayFactor, err := OneDec().Sub(decayFactor)
if err != nil {
return ZeroDec(), err
}
newRev, err := oneMinusDecayFactor.Mul(currentRev)
if err != nil {
return ZeroDec(), err
}
return newRev, nil
}

// Generic function that sorts the keys of a map
// Used for deterministic ranging of maps
func GetSortedKeys[K cmp.Ordered, V any](m map[K]V) []K {
Expand Down
25 changes: 0 additions & 25 deletions math/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,6 @@ func TestCalcEmaWithNoPrior(t *testing.T) {
require.True(t, alloraMath.InDelta(expected, result, alloraMath.MustNewDecFromString("0.0001")))
}

func TestCalcExpDecaySimple(t *testing.T) {
decayFactor := alloraMath.MustNewDecFromString("0.1")
currentRev := alloraMath.MustNewDecFromString("300")

// (1 - 0.1) * 300
// 0.9 * 300 = 270
expected := alloraMath.MustNewDecFromString("270")
result, err := alloraMath.CalcExpDecay(currentRev, decayFactor)
require.NoError(t, err)
require.True(t, alloraMath.InDelta(expected, result, alloraMath.MustNewDecFromString("0.0001")))
}

func TestCalcExpDecayZeroDecayFactor(t *testing.T) {
decayFactor := alloraMath.MustNewDecFromString("0")
currentRev := alloraMath.MustNewDecFromString("300")

// (1 - 0) * 300
// 1 * 300 = 300
expected := alloraMath.MustNewDecFromString("300")

result, err := alloraMath.CalcExpDecay(currentRev, decayFactor)
require.NoError(t, err)
require.True(t, alloraMath.InDelta(expected, result, alloraMath.MustNewDecFromString("0.0001")))
}

func TestStdDev(t *testing.T) {
tests := []struct {
name string
Expand Down
3 changes: 3 additions & 0 deletions scripts/l1_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ if [ ! -f $INIT_FLAG ]; then
dasel put mempool.max_txs_bytes -t int -v 2097152 -f ${APP_HOME}/config/config.toml
dasel put mempool.size -t int -v 1000 -f ${APP_HOME}/config/config.toml

#* Enable telemetry
dasel put telemetry.enabled -t bool -v true -f ${APP_HOME}/config/app.toml

touch $INIT_FLAG
fi
echo "Node is initialized"
Expand Down
12 changes: 6 additions & 6 deletions test/invariant/invariants.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
diff --git a/x/emissions/module/abci.go b/x/emissions/module/abci.go
index 8f743b31..0511e66d 100644
index d775365..69b81e1 100644
--- a/x/emissions/module/abci.go
+++ b/x/emissions/module/abci.go
@@ -5,6 +5,7 @@ import (
"fmt"
@@ -6,6 +6,7 @@ import (
"time"

"cosmossdk.io/errors"
+ emissionskeeper "github.com/allora-network/allora-chain/x/emissions/keeper"
allorautils "github.com/allora-network/allora-chain/x/emissions/keeper/actor_utils"
"github.com/allora-network/allora-chain/x/emissions/module/rewards"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -12,6 +13,10 @@ import (
emissionstypes "github.com/allora-network/allora-chain/x/emissions/types"
@@ -17,6 +18,10 @@ func EndBlocker(ctx context.Context, am AppModule) error {
defer telemetry.ModuleMeasureSince(emissionstypes.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)

func EndBlocker(ctx context.Context, am AppModule) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
+ invariantMessage, invariantFailed := emissionskeeper.AllInvariants(am.keeper)(sdkCtx)
+ if invariantFailed {
Expand Down
Loading

0 comments on commit 0ff94d4

Please sign in to comment.