Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions test/e2e-go/upgrades/application_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,43 @@ int 1
round, err = client.CurrentRound()
a.NoError(err)

successfullBroadcastCount := 0
_, err = client.BroadcastTransaction(signedTxn)
a.Error(err)
a.Contains(err.Error(), "application transaction not supported")
if err != nil {
a.Contains(err.Error(), "application transaction not supported")
} else {
// if we had no error it must mean that we've upgraded already. Verify that.
curStatus, err := client.Status()
a.NoError(err)
require.NotEqual(t, consensusTestUnupgradedProtocol, protocol.ConsensusVersion(curStatus.LastVersion))
successfullBroadcastCount++
}

curStatus, err := client.Status()
a.NoError(err)
initialStatus := curStatus

startLoopTime := time.Now()

// wait until the network upgrade : this can take a while.
for curStatus.LastVersion == initialStatus.LastVersion {
for protocol.ConsensusVersion(curStatus.LastVersion) == consensusTestUnupgradedProtocol {
curStatus, err = client.Status()
a.NoError(err)

a.Less(int64(time.Now().Sub(startLoopTime)), int64(3*time.Minute))
time.Sleep(time.Duration(smallLambdaMs) * time.Millisecond)
round = curStatus.LastRound
}

round = curStatus.LastRound

// make a change to the node field to ensure we're not broadcasting the same transaction as we tried before.
tx.Note = []byte{1, 2, 3}
signedTxn, err = client.SignTransactionWithWallet(wh, nil, tx)
a.NoError(err)

// now, that we have upgraded to the new protocol which supports applications, try again.
_, err = client.BroadcastTransaction(signedTxn)
a.NoError(err)
successfullBroadcastCount++

curStatus, err = client.Status()
a.NoError(err)
Expand All @@ -192,7 +206,7 @@ int 1
// check creator's balance record for the app entry and the state changes
ad, err = client.AccountData(creator)
a.NoError(err)
a.Equal(1, len(ad.AppParams))
a.Equal(successfullBroadcastCount, len(ad.AppParams))
var appIdx basics.AppIndex
var params basics.AppParams
for i, p := range ad.AppParams {
Expand All @@ -209,7 +223,7 @@ int 1
a.True(ok)
a.Equal(uint64(1), value.Uint)

a.Equal(1, len(ad.AppLocalStates))
a.Equal(successfullBroadcastCount, len(ad.AppLocalStates))
state, ok := ad.AppLocalStates[appIdx]
a.True(ok)
a.Equal(schema, state.Schema)
Expand All @@ -235,7 +249,7 @@ int 1
// check creator's balance record for the app entry and the state changes
ad, err = client.AccountData(creator)
a.NoError(err)
a.Equal(1, len(ad.AppParams))
a.Equal(successfullBroadcastCount, len(ad.AppParams))
params, ok = ad.AppParams[appIdx]
a.True(ok)
a.Equal(approvalOps.Program, params.ApprovalProgram)
Expand All @@ -247,7 +261,7 @@ int 1
a.True(ok)
a.Equal(uint64(2), value.Uint)

a.Equal(1, len(ad.AppLocalStates))
a.Equal(successfullBroadcastCount, len(ad.AppLocalStates))
state, ok = ad.AppLocalStates[appIdx]
a.True(ok)
a.Equal(schema, state.Schema)
Expand All @@ -256,7 +270,7 @@ int 1
a.True(ok)
a.Equal(uint64(1), value.Uint)

a.Equal(uint64(2), ad.TotalAppSchema.NumUint)
a.Equal(uint64(2*successfullBroadcastCount), ad.TotalAppSchema.NumUint)

// check user's balance record for the app entry and the state changes
ad, err = client.AccountData(user)
Expand Down