Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-merge go-algorand 3.1.3-beta #3230

Merged
merged 23 commits into from
Nov 18, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0b99cf8
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service Oct 5, 2021
83740b4
Increase machine size to large and use consistent parallelism for cir…
egieseke Oct 8, 2021
1e87c71
Move deploy from TravisCI to CircleCI (#3075)
algojack Oct 14, 2021
abd31a2
Merge pull request #2995 from Algo-devops-service/relbeta3.1.0
algojohnlee Oct 14, 2021
98d25e2
Fixing CircleCI deploy for Betanet and Stablenet (#3077)
algojack Oct 15, 2021
fd82cd9
Merge branch 'rel/beta' into relbeta3.1.0
algojohnlee Oct 15, 2021
a4cfa1f
Merge pull request #3079 from Algo-devops-service/relbeta3.1.0
algojohnlee Oct 15, 2021
d286fd2
Fix missing TX registration (#3080)
tsachiherman Oct 16, 2021
9d0cedb
Bumping buildnumber.dat to 1 for 3.1.1
algojack Oct 18, 2021
dbd0ec9
Merge pull request #3090 from algorand/rel/beta-3.1.1
algojohnlee Oct 18, 2021
facfb03
txnsync: implement missing bridge between txnsync and classic transac…
tsachiherman Oct 20, 2021
2eb56bb
Bump build number
onetechnical Oct 20, 2021
53cf013
Merge pull request #3103 from algorand/rel/beta-3.1.2
algojohnlee Oct 20, 2021
ff71d92
txnsync: fix potential race during TestBasicCatchpointCatchup (#3033)
tsachiherman Oct 11, 2021
83031f6
network: add initial support for latency tracking (#3028)
tsachiherman Oct 19, 2021
f65e269
Add err to solicitedAsyncTxHandler.loop log message (#3123)
cce Oct 21, 2021
5fc9a5e
update the websocket library. (#3131)
tsachiherman Oct 22, 2021
05673ad
Improve Bandwidth Estimation in Txnsync (#3096)
Oct 24, 2021
cc801ba
txnsync: delete-able incoming message queue (#3126)
tsachiherman Oct 25, 2021
b79856f
catchup: ignore benign evaluator failures (#3135)
tsachiherman Oct 25, 2021
615fee2
Bump buildnumber.dat
onetechnical Oct 25, 2021
378816d
Merge pull request #3139 from algorand/rel/beta-3.1.3
algojohnlee Oct 26, 2021
c0d7822
Merge branch 'rel/beta'
onetechnical Nov 18, 2021
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
Prev Previous commit
Next Next commit
Fix missing TX registration (#3080)
## Summary

When a 2.1 (i.e. no txsync) client connects to a 3.0 relay (i.e. txsync), the relay needs to request the client to keep sending it a TX messages - otherwise, these transactions would not get propagated.

The 2.1 and 3.0 above are network protocol versions, not a algod release version.

## Test Plan

e2e test added.
tsachiherman authored and algojack committed Oct 18, 2021
commit d286fd2a721857ca6791fae3efc7ad08dfb86b81
2 changes: 2 additions & 0 deletions data/txHandler.go
Original file line number Diff line number Diff line change
@@ -502,6 +502,7 @@ func (handler *solicitedAsyncTxHandler) HandleTransactionGroups(networkPeer inte

func (handler *solicitedAsyncTxHandler) Start() {
if handler.stopCtxFunc == nil {
handler.txHandler.Start()
var ctx context.Context
ctx, handler.stopCtxFunc = context.WithCancel(context.Background())
handler.stopped.Add(1)
@@ -514,6 +515,7 @@ func (handler *solicitedAsyncTxHandler) Stop() {
handler.stopCtxFunc()
handler.stopped.Wait()
handler.stopCtxFunc = nil
handler.txHandler.Stop()
}
}

16 changes: 15 additions & 1 deletion network/wsNetwork.go
Original file line number Diff line number Diff line change
@@ -1144,7 +1144,21 @@ func (wn *WebsocketNetwork) ServeHTTP(response http.ResponseWriter, request *htt

// We are careful to encode this prior to starting the server to avoid needing 'messagesOfInterestMu' here.
if wn.messagesOfInterestEnc != nil {
err = peer.Unicast(wn.ctx, wn.messagesOfInterestEnc, protocol.MsgOfInterestTag, nil)
msg := wn.messagesOfInterestEnc
// for older peers, we want to include also the "TX" message, for backward compatibility.
// this statement could be safely removed once we've fully migrated.
if peer.version == "2.1" {
wn.messagesOfInterestMu.Lock()
txSendMsgTags := make(map[protocol.Tag]bool)
for tag := range wn.messagesOfInterest {
txSendMsgTags[tag] = true
}
wn.messagesOfInterestMu.Unlock()
txSendMsgTags[protocol.TxnTag] = true
msg = MarshallMessageOfInterestMap(txSendMsgTags)
}
err = peer.Unicast(wn.ctx, msg, protocol.MsgOfInterestTag, nil)

if err != nil {
wn.log.Infof("ws send msgOfInterest: %v", err)
}
51 changes: 50 additions & 1 deletion test/e2e-go/features/transactions/sendReceive_test.go
Original file line number Diff line number Diff line change
@@ -17,12 +17,14 @@
package transactions

import (
"fmt"
"math/rand"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/config"
v1 "github.com/algorand/go-algorand/daemon/algod/api/spec/v1"
"github.com/algorand/go-algorand/test/framework/fixtures"
"github.com/algorand/go-algorand/test/partitiontest"
@@ -66,11 +68,16 @@ func TestDevModeAccountsCanSendMoney(t *testing.T) {

func testAccountsCanSendMoney(t *testing.T, templatePath string, numberOfSends int) {
t.Parallel()
a := require.New(fixtures.SynchronizedTest(t))

var fixture fixtures.RestClientFixture
fixture.Setup(t, templatePath)
defer fixture.Shutdown()
testAccountsCanSendMoneyFixture(t, &fixture, numberOfSends)
}

func testAccountsCanSendMoneyFixture(t *testing.T, fixture *fixtures.RestClientFixture, numberOfSends int) {
a := require.New(fixtures.SynchronizedTest(t))

c := fixture.LibGoalClient

pingClient := fixture.LibGoalClient
@@ -159,3 +166,45 @@ func testAccountsCanSendMoney(t *testing.T, templatePath string, numberOfSends i
a.True(expectedPingBalance <= pingBalance, "ping balance is different than expected.")
a.True(expectedPongBalance <= pongBalance, "pong balance is different than expected.")
}

// this test checks that two accounts' balances stay up to date
// as they send each other money many times
func TestAccountsCanSendMoneyAcrossTxSync(t *testing.T) {
partitiontest.PartitionTest(t)
defer fixtures.ShutdownSynchronizedTest(t)

numberOfSends := 3
a := require.New(fixtures.SynchronizedTest(t))

networkProtocolVersions := []string{"3.0", "2.1"}

testMoneySending := func(t *testing.T, primaryNodeVersionIdx, nodeVersionIdx int) {
t.Run(fmt.Sprintf("%s->%s", networkProtocolVersions[primaryNodeVersionIdx], networkProtocolVersions[nodeVersionIdx]),
func(t *testing.T) {
t.Parallel()
var fixture fixtures.RestClientFixture
fixture.SetupNoStart(t, filepath.Join("nettemplates", "TwoNodes50Each.json"))
defer fixture.Shutdown()

cfg, err := config.LoadConfigFromDisk(fixture.PrimaryDataDir())
a.NoError(err)
cfg.NetworkProtocolVersion = networkProtocolVersions[primaryNodeVersionIdx]
cfg.SaveToDisk(fixture.PrimaryDataDir())

cfg, err = config.LoadConfigFromDisk(fixture.NodeDataDirs()[0])
a.NoError(err)
cfg.NetworkProtocolVersion = networkProtocolVersions[primaryNodeVersionIdx]
cfg.SaveToDisk(fixture.NodeDataDirs()[0])

fixture.Start()
testAccountsCanSendMoneyFixture(t, &fixture, numberOfSends)
})
}

// test to see that we can communicate correctly regardless of the network protocol version.
for primaryNodeVersionIdx := 0; primaryNodeVersionIdx < 2; primaryNodeVersionIdx++ {
for nodeVersionIdx := 0; nodeVersionIdx < 2; nodeVersionIdx++ {
testMoneySending(t, primaryNodeVersionIdx, nodeVersionIdx)
}
}
}