diff --git a/.github/workflows/integration.stale b/.github/workflows/integration.stale deleted file mode 100644 index e68f4a8a7..000000000 --- a/.github/workflows/integration.stale +++ /dev/null @@ -1,26 +0,0 @@ -name: Integration - -on: [pull_request] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.22 - - - name: Make - run: make install - - - name: Init - run: make init - - - name: PostInit - run: bash ./integration/postinit.sh - - - name: IntegrationTest - run: INTEGRATION=TRUE /usr/bin/go test -timeout 10m -run ^TestExternalTestSuite$ github.com/allora-network/allora-chain/integration -v diff --git a/integration/distribution_test.go b/integration/distribution_test.go index 9b7d75100..627e482da 100644 --- a/integration/distribution_test.go +++ b/integration/distribution_test.go @@ -3,7 +3,6 @@ package integration_test import ( "bufio" "errors" - "fmt" "os" "strings" @@ -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 diff --git a/integration/integration_test.go b/integration/integration_test.go index 1f92b0c94..2be30186d 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -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 <<<") diff --git a/integration/local_testnet_l1.sh b/integration/local_testnet_l1.sh old mode 100644 new mode 100755 diff --git a/integration/postinit.sh b/integration/postinit.sh deleted file mode 100755 index 17b0a8a18..000000000 --- a/integration/postinit.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -set -e - -GENESIS=$HOME/.allorad/config/genesis.json -# this script expects to be ran AFTER `scripts/init.sh` -if ! test -f $GENESIS; then - echo "Must run scripts/init.sh first." - exit 1 -fi - -APP_TOML=$HOME/.allorad/config/app.toml -ALLORAD_BIN=$(which allorad) - -ALICE_ADDRESS=$($ALLORAD_BIN keys show alice | head -n 1 | cut -f 2 -d ":" | tr -d " ") -if [[ ${#ALICE_ADDRESS} -ne 43 ]] || [[ $ALICE_ADDRESS != allo* ]]; then - echo "Alice address not found" - exit 1 -fi - -BOB_ADDRESS=$($ALLORAD_BIN keys show bob | head -n 1 | cut -f 2 -d ":" | tr -d " ") -if [[ ${#BOB_ADDRESS} -ne 43 ]] || [[ $BOB_ADDRESS != allo* ]]; then - echo "Bob address not found" - exit 1 -fi - -VALIDATOR_ADDRESS=$(cat $GENESIS | grep "validator_address" | cut -f 2 -d ":" | tr -d " " | tr -d "\"" | tr -d ",") -if [[ ${#VALIDATOR_ADDRESS} -ne 50 ]] || [[ $VALIDATOR_ADDRESS != allovaloper* ]]; then - echo "Validator address not found in genesis file" - exit 1 -fi - -echo "Putting alice and bob in the whitelisted core team list" -GENESIS_TOTAL_LINES=$(wc -l $GENESIS | cut -f 1 -d " ") -CORE_TEAM_LINE_NUM=$(grep -n "core_team_addresses" $GENESIS | cut -f 1 -d ":") -cat $GENESIS | head -n $CORE_TEAM_LINE_NUM > $GENESIS.tmp -echo " \"$ALICE_ADDRESS\"," >> $GENESIS.tmp -echo " \"$BOB_ADDRESS\"," >> $GENESIS.tmp -CONTINUE_LINE_NUM=$(($GENESIS_TOTAL_LINES-$CORE_TEAM_LINE_NUM+1)) -tail -n $CONTINUE_LINE_NUM $GENESIS >> $GENESIS.tmp -mv $GENESIS.tmp $GENESIS - -# Not currently necessary, but keeping this code here for future reference in case ever needed -# echo "Turning on localhost GRPC-Gateway REST HTTP Server" -# APP_TOML_TOTAL_LINES=$(wc -l $APP_TOML | cut -f 1 -d " ") -# APP_TOML_GRPC_GATEWAY_LINE_NUM=$(grep -n "# Enable defines if the API server should be enabled." $APP_TOML | cut -f 1 -d ":") -# cat $APP_TOML | head -n $APP_TOML_GRPC_GATEWAY_LINE_NUM > $APP_TOML.tmp -# echo "enable = true" >> $APP_TOML.tmp -# echo "" >> $APP_TOML.tmp -# echo "# Swagger defines if swagger documentation should automatically be registered." >> $APP_TOML.tmp -# echo "swagger = true" >> $APP_TOML.tmp -# CONTINUE_LINE_NUM=$(($APP_TOML_TOTAL_LINES-$APP_TOML_GRPC_GATEWAY_LINE_NUM-4)) -# tail -n $CONTINUE_LINE_NUM $APP_TOML >> $APP_TOML.tmp -# mv $APP_TOML.tmp $APP_TOML - -echo "Setting Integration Test Mode to true" -INTEGRATION="TRUE" - -echo "Starting allorad daemon and sleep for 3 seconds to let it start" -$ALLORAD_BIN start & disown; -sleep 3 diff --git a/integration/update_params_test.go b/integration/update_params_test.go index 191ac7d8b..4e3926d4f 100644 --- a/integration/update_params_test.go +++ b/integration/update_params_test.go @@ -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") diff --git a/integration/worker_inference_and_forecast_test.go b/integration/worker_inference_and_forecast_test.go index 1afa0f6b8..ce997a4af 100644 --- a/integration/worker_inference_and_forecast_test.go +++ b/integration/worker_inference_and_forecast_test.go @@ -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" ) @@ -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 } @@ -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 @@ -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, }, @@ -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 @@ -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, },