Skip to content

Commit

Permalink
[ORA-1407] Turn back on Checking that Validators and Reputers get pai…
Browse files Browse the repository at this point in the history
…d inflationary tokens (#285)

Someone had just casually turned off the tests, no big deal

This PR relies on allora-network/networks#3 -
the initial token distribution at genesis MUST follow the distribution
laid out in the whitepaper, otherwise N_Circ in the e_i calculation
becomes infinitesimally small relative to our 1e27 token supply and so
the network just refuses to make any inflation
  • Loading branch information
relyt29 authored May 22, 2024
1 parent 1659eca commit 5ee01aa
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 103 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/integration.stale

This file was deleted.

2 changes: 0 additions & 2 deletions integration/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package integration_test
import (
"bufio"
"errors"
"fmt"
"os"
"strings"

Expand Down Expand Up @@ -91,7 +90,6 @@ func CheckValidatorBalancesIncreaseOnNewBlock(m TestMetadata) {
vba := balanceAfter.Rewards.Rewards.AmountOf(params.BaseCoinUnit)
vbb := balancesBefore[addr].Rewards.Rewards.AmountOf(params.BaseCoinUnit)

fmt.Println(addr, vba, vbb)
if vba.GT(vbb) {
balanceIncreased = true
break
Expand Down
5 changes: 2 additions & 3 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ func TestExternalTestSuite(t *testing.T) {
GetParams(m)
t.Log(">>> Test Topic Creation <<<")
CreateTopic(m)
// TODO Uncomment as we stand up devnet
// t.Log(">>> Test Distribution Checks <<<")
// DistributionChecks(m)
t.Log(">>> Test Distribution Checks <<<")
DistributionChecks(m)
t.Log(">>> Test Actor Registration <<<")
RegistrationChecks(m)
t.Log(">>> Test Update Params <<<")
Expand Down
Empty file modified integration/local_testnet_l1.sh
100644 → 100755
Empty file.
61 changes: 0 additions & 61 deletions integration/postinit.sh

This file was deleted.

2 changes: 1 addition & 1 deletion integration/update_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func UpdateParamsChecks(m TestMetadata) {
Epsilon: input,
},
}
txResp, err = m.n.Client.BroadcastTx(m.ctx, m.n.BobAcc, updateParamRequest)
_, err = m.n.Client.BroadcastTx(m.ctx, m.n.BobAcc, updateParamRequest)
require.Error(m.t, err)
// Check that error is due to Bob not being a whitelist admin
require.Contains(m.t, err.Error(), "not whitelist admin")
Expand Down
19 changes: 9 additions & 10 deletions integration/worker_inference_and_forecast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

alloraMath "github.com/allora-network/allora-chain/math"
"github.com/allora-network/allora-chain/x/emissions/types"
emissionstypes "github.com/allora-network/allora-chain/x/emissions/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/stretchr/testify/require"
)
Expand All @@ -18,17 +17,17 @@ const defaultEpochLength = 10
const approximateBlockLengthSeconds = 5
const minWaitingNumberofEpochs = 3

func getNonZeroTopicEpochLastRan(ctx context.Context, query emissionstypes.QueryClient, topicID uint64, maxRetries int) (*emissionstypes.Topic, error) {
func getNonZeroTopicEpochLastRan(ctx context.Context, query types.QueryClient, topicID uint64, maxRetries int) (*types.Topic, error) {
sleepingTimeBlocks := defaultEpochLength
// Retry loop for a maximum of 5 times
for retries := 0; retries < maxRetries; retries++ {
topicResponse, err := query.GetTopic(ctx, &emissionstypes.QueryTopicRequest{TopicId: topicID})
topicResponse, err := query.GetTopic(ctx, &types.QueryTopicRequest{TopicId: topicID})
if err == nil {
storedTopic := topicResponse.Topic
if storedTopic.EpochLastEnded != 0 {
sleepingTimeSeconds := time.Duration(minWaitingNumberofEpochs*storedTopic.EpochLength*approximateBlockLengthSeconds) * time.Second
fmt.Println(time.Now(), " Topic found, sleeping...", sleepingTimeSeconds)
time.Sleep(sleepingTimeSeconds)
sleepingTime := time.Duration(minWaitingNumberofEpochs*storedTopic.EpochLength*approximateBlockLengthSeconds) * time.Second
fmt.Println(time.Now(), " Topic found, sleeping...", sleepingTime)
time.Sleep(sleepingTime)
fmt.Println(time.Now(), " Slept.")
return topicResponse.Topic, nil
}
Expand All @@ -47,7 +46,7 @@ func getNonZeroTopicEpochLastRan(ctx context.Context, query emissionstypes.Query
func InsertSingleWorkerBulk(m TestMetadata, topic *types.Topic, blockHeight int64) {
// Nonce: calculate from EpochLastRan + EpochLength
topicId := topic.Id
nonce := emissionstypes.Nonce{BlockHeight: blockHeight}
nonce := types.Nonce{BlockHeight: blockHeight}
// Define inferer address as Bob's address
InfererAddress1 := m.n.BobAddr

Expand Down Expand Up @@ -101,7 +100,7 @@ func InsertSingleWorkerBulk(m TestMetadata, topic *types.Topic, blockHeight int6
// Latest inference
latestInference, err := m.n.QueryEmissions.GetWorkerLatestInferenceByTopicId(
m.ctx,
&emissionstypes.QueryWorkerLatestInferenceRequest{
&types.QueryWorkerLatestInferenceRequest{
TopicId: 1,
WorkerAddress: InfererAddress1,
},
Expand All @@ -115,7 +114,7 @@ func InsertSingleWorkerBulk(m TestMetadata, topic *types.Topic, blockHeight int6

// Worker Bob inserts bulk inference and forecast
func InsertWorkerBulk(m TestMetadata, topic *types.Topic) (int64, int64) {
topicResponse, err := m.n.QueryEmissions.GetTopic(m.ctx, &emissionstypes.QueryTopicRequest{TopicId: topic.Id})
topicResponse, err := m.n.QueryEmissions.GetTopic(m.ctx, &types.QueryTopicRequest{TopicId: topic.Id})
require.NoError(m.t, err)
freshTopic := topicResponse.Topic

Expand Down Expand Up @@ -222,7 +221,7 @@ func InsertReputerBulk(m TestMetadata, topic *types.Topic, BlockHeightCurrent, B
require.NoError(m.t, err)

result, err := m.n.QueryEmissions.GetNetworkLossBundleAtBlock(m.ctx,
&emissionstypes.QueryNetworkLossBundleAtBlockRequest{
&types.QueryNetworkLossBundleAtBlockRequest{
TopicId: topicId,
BlockHeight: BlockHeightCurrent,
},
Expand Down

0 comments on commit 5ee01aa

Please sign in to comment.