Skip to content

Commit ea9f684

Browse files
authored
Merge pull request #1197 from onetechnical/onetechnical/beta2.0.15
Algorand BetaNet 2.0.15
2 parents a6fdbad + 6595b84 commit ea9f684

File tree

16 files changed

+364
-30
lines changed

16 files changed

+364
-30
lines changed

buildnumber.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14
1+
15

config/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ type Local struct {
288288
// EnableBlockService enables the block serving service. The functionality of this depends on NetAddress, which must also be provided.
289289
// This functionality is required for the catchup.
290290
EnableBlockService bool
291+
292+
// EnableGossipBlockService enables the block serving service over the gossip network. The functionality of this depends on NetAddress, which must also be provided.
293+
// This functionality is required for the relays to perform catchup from nodes.
294+
EnableGossipBlockService bool
291295
}
292296

293297
// Filenames of config files within the configdir (e.g. ~/.algorand)

config/config_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func TestConfigMigrateFromDisk(t *testing.T) {
314314
func TestConfigInvariant(t *testing.T) {
315315
a := require.New(t)
316316

317-
a.Equal(uint32(7), configVersion, "If you bump Config Version, please update this test (and consider if you should be adding more)")
317+
a.Equal(uint32(8), configVersion, "If you bump Config Version, please update this test (and consider if you should be adding more)")
318318

319319
ourPath, err := os.Getwd()
320320
a.NoError(err)
@@ -359,6 +359,11 @@ func TestConfigInvariant(t *testing.T) {
359359
err = codecs.LoadObjectFromFile(filepath.Join(configsPath, "config-v7.json"), &c7)
360360
a.NoError(err)
361361
a.Equal(defaultLocalV7, c7)
362+
363+
c8 := Local{}
364+
err = codecs.LoadObjectFromFile(filepath.Join(configsPath, "config-v8.json"), &c8)
365+
a.NoError(err)
366+
a.Equal(defaultLocalV8, c8)
362367
}
363368

364369
func TestConfigLatestVersion(t *testing.T) {

config/local_defaults.go

+71-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"time"
2222
)
2323

24-
var defaultLocal = defaultLocalV7
24+
var defaultLocal = defaultLocalV8
2525

26-
const configVersion = uint32(7)
26+
const configVersion = uint32(8)
2727

2828
// !!! WARNING !!!
2929
//
@@ -39,6 +39,66 @@ const configVersion = uint32(7)
3939
//
4040
// !!! WARNING !!!
4141

42+
var defaultLocalV8 = Local{
43+
// DO NOT MODIFY VALUES - New values may be added carefully - See WARNING at top of file
44+
Version: 8,
45+
Archival: false,
46+
BaseLoggerDebugLevel: 4,
47+
BroadcastConnectionsLimit: -1,
48+
AnnounceParticipationKey: true,
49+
PriorityPeers: map[string]bool{},
50+
CadaverSizeTarget: 1073741824,
51+
CatchupFailurePeerRefreshRate: 10,
52+
CatchupParallelBlocks: 16,
53+
ConnectionsRateLimitingCount: 60,
54+
ConnectionsRateLimitingWindowSeconds: 1,
55+
DeadlockDetection: 0,
56+
DNSBootstrapID: "<network>.algorand.network",
57+
EnableAgreementReporting: false,
58+
EnableAgreementTimeMetrics: false,
59+
EnableIncomingMessageFilter: false,
60+
EnableMetricReporting: false,
61+
EnableOutgoingNetworkMessageFiltering: true,
62+
EnableRequestLogger: false,
63+
EnableTopAccountsReporting: false,
64+
EndpointAddress: "127.0.0.1:0",
65+
GossipFanout: 4,
66+
IncomingConnectionsLimit: 10000,
67+
IncomingMessageFilterBucketCount: 5,
68+
IncomingMessageFilterBucketSize: 512,
69+
LogArchiveName: "node.archive.log",
70+
LogArchiveMaxAge: "",
71+
LogSizeLimit: 1073741824,
72+
MaxConnectionsPerIP: 30,
73+
NetAddress: "",
74+
NodeExporterListenAddress: ":9100",
75+
NodeExporterPath: "./node_exporter",
76+
OutgoingMessageFilterBucketCount: 3,
77+
OutgoingMessageFilterBucketSize: 128,
78+
ReconnectTime: 1 * time.Minute,
79+
ReservedFDs: 256,
80+
RestReadTimeoutSeconds: 15,
81+
RestWriteTimeoutSeconds: 120,
82+
RunHosted: false,
83+
SuggestedFeeBlockHistory: 3,
84+
SuggestedFeeSlidingWindowSize: 50,
85+
TelemetryToLog: true,
86+
TxPoolExponentialIncreaseFactor: 2,
87+
TxPoolSize: 15000,
88+
TxSyncIntervalSeconds: 60,
89+
TxSyncTimeoutSeconds: 30,
90+
TxSyncServeResponseSize: 1000000,
91+
PeerConnectionsUpdateInterval: 3600,
92+
DNSSecurityFlags: 0x01,
93+
EnablePingHandler: true,
94+
CatchpointInterval: 10000,
95+
CatchpointFileHistoryLength: 365,
96+
EnableLedgerService: false,
97+
EnableBlockService: false,
98+
EnableGossipBlockService: true, // added in V8
99+
// DO NOT MODIFY VALUES - New values may be added carefully - See WARNING at top of file
100+
}
101+
42102
var defaultLocalV7 = Local{
43103
// DO NOT MODIFY VALUES - New values may be added carefully - See WARNING at top of file
44104
Version: 7,
@@ -497,6 +557,15 @@ func migrate(cfg Local) (newCfg Local, err error) {
497557
newCfg.Version = 7
498558
}
499559

560+
// Migrate 7 -> 8
561+
if newCfg.Version == 7 {
562+
if newCfg.EnableGossipBlockService == defaultLocalV7.EnableGossipBlockService {
563+
newCfg.EnableGossipBlockService = defaultLocalV8.EnableGossipBlockService
564+
}
565+
566+
newCfg.Version = 8
567+
}
568+
500569
if newCfg.Version != configVersion {
501570
err = fmt.Errorf("failed to migrate config version %d (stuck at %d) to latest %d", cfg.Version, newCfg.Version, configVersion)
502571
}
+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
// Copyright (C) 2019-2020 Algorand, Inc.
2+
// This file is part of go-algorand
3+
//
4+
// go-algorand is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as
6+
// published by the Free Software Foundation, either version 3 of the
7+
// License, or (at your option) any later version.
8+
//
9+
// go-algorand is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public License
15+
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.
16+
package server
17+
18+
import (
19+
"net/http"
20+
"testing"
21+
22+
"github.com/labstack/echo/v4"
23+
"github.com/stretchr/testify/assert"
24+
"github.com/stretchr/testify/suite"
25+
26+
"github.com/algorand/go-algorand/daemon/algod/api/server/lib"
27+
"github.com/algorand/go-algorand/daemon/algod/api/server/v1/routes"
28+
)
29+
30+
type TestSuite struct {
31+
suite.Suite
32+
calls int
33+
e *echo.Echo
34+
}
35+
36+
func (s *TestSuite) SetupSuite() {
37+
s.e = echo.New()
38+
handler := func(context lib.ReqContext, context2 echo.Context) {
39+
s.calls++
40+
}
41+
// Make a deep copy of the routes array with dummy handlers that log a call.
42+
v1RoutesCopy := make([]lib.Route, len(routes.V1Routes))
43+
for _, route := range routes.V1Routes {
44+
v1RoutesCopy = append(v1RoutesCopy, lib.Route{
45+
Name: route.Name,
46+
Method: route.Method,
47+
Path: route.Path,
48+
HandlerFunc: handler,
49+
})
50+
}
51+
// Registering v1 routes
52+
registerHandlers(s.e, apiV1Tag, v1RoutesCopy, lib.ReqContext{})
53+
}
54+
func (s *TestSuite) SetupTest() {
55+
s.calls = 0
56+
}
57+
func (s *TestSuite) TestBaselineRoute() {
58+
ctx := s.e.NewContext(nil, nil)
59+
s.e.Router().Find(http.MethodGet, "/v0/this/is/no/endpoint", ctx)
60+
assert.Equal(s.T(), echo.ErrNotFound, ctx.Handler()(ctx))
61+
assert.Equal(s.T(), 0, s.calls)
62+
}
63+
func (s *TestSuite) TestAccountPendingTransaction() {
64+
ctx := s.e.NewContext(nil, nil)
65+
s.e.Router().Find(http.MethodGet, "/v1/account/address-param/transactions/pending", ctx)
66+
assert.Equal(s.T(), "/v1/account/:addr/transactions/pending", ctx.Path())
67+
assert.Equal(s.T(), "address-param", ctx.Param("addr"))
68+
69+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
70+
callsBefore := s.calls
71+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
72+
assert.Equal(s.T(), callsBefore+1, s.calls)
73+
}
74+
func (s *TestSuite) TestWaitAfterBlock() {
75+
ctx := s.e.NewContext(nil, nil)
76+
s.e.Router().Find(http.MethodGet, "/v1/status/wait-for-block-after/123456", ctx)
77+
assert.Equal(s.T(), "/v1/status/wait-for-block-after/:round", ctx.Path())
78+
assert.Equal(s.T(), "123456", ctx.Param("round"))
79+
80+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
81+
callsBefore := s.calls
82+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
83+
assert.Equal(s.T(), callsBefore+1, s.calls)
84+
}
85+
func (s *TestSuite) TestAccountInformation() {
86+
ctx := s.e.NewContext(nil, nil)
87+
s.e.Router().Find(http.MethodGet, "/v1/account/ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA", ctx)
88+
assert.Equal(s.T(), "/v1/account/:addr", ctx.Path())
89+
assert.Equal(s.T(), "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA", ctx.Param("addr"))
90+
91+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
92+
callsBefore := s.calls
93+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
94+
assert.Equal(s.T(), callsBefore+1, s.calls)
95+
}
96+
func (s *TestSuite) TestTransactionInformation() {
97+
ctx := s.e.NewContext(nil, nil)
98+
addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA"
99+
txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA"
100+
s.e.Router().Find(http.MethodGet, "/v1/account/"+addr+"/transaction/"+txid, ctx)
101+
assert.Equal(s.T(), "/v1/account/:addr/transaction/:txid", ctx.Path())
102+
assert.Equal(s.T(), addr, ctx.Param("addr"))
103+
assert.Equal(s.T(), txid, ctx.Param("txid"))
104+
105+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
106+
callsBefore := s.calls
107+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
108+
assert.Equal(s.T(), callsBefore+1, s.calls)
109+
}
110+
func (s *TestSuite) TestAccountTransaction() {
111+
ctx := s.e.NewContext(nil, nil)
112+
addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA"
113+
s.e.Router().Find(http.MethodGet, "/v1/account/"+addr+"/transactions", ctx)
114+
assert.Equal(s.T(), "/v1/account/:addr/transactions", ctx.Path())
115+
assert.Equal(s.T(), addr, ctx.Param("addr"))
116+
117+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
118+
callsBefore := s.calls
119+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
120+
assert.Equal(s.T(), callsBefore+1, s.calls)
121+
}
122+
func (s *TestSuite) TestBlock() {
123+
ctx := s.e.NewContext(nil, nil)
124+
s.e.Router().Find(http.MethodGet, "/v1/block/123456", ctx)
125+
assert.Equal(s.T(), "/v1/block/:round", ctx.Path())
126+
assert.Equal(s.T(), "123456", ctx.Param("round"))
127+
128+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
129+
callsBefore := s.calls
130+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
131+
assert.Equal(s.T(), callsBefore+1, s.calls)
132+
}
133+
func (s *TestSuite) TestPendingTransactionID() {
134+
ctx := s.e.NewContext(nil, nil)
135+
txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA"
136+
s.e.Router().Find(http.MethodGet, "/v1/transactions/pending/"+txid, ctx)
137+
assert.Equal(s.T(), "/v1/transactions/pending/:txid", ctx.Path())
138+
assert.Equal(s.T(), txid, ctx.Param("txid"))
139+
140+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
141+
callsBefore := s.calls
142+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
143+
assert.Equal(s.T(), callsBefore+1, s.calls)
144+
}
145+
func (s *TestSuite) TestPendingTransactionInformationByAddress() {
146+
ctx := s.e.NewContext(nil, nil)
147+
addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA"
148+
s.e.Router().Find(http.MethodGet, "/v1/account/"+addr+"/transactions/pending", ctx)
149+
assert.Equal(s.T(), "/v1/account/:addr/transactions/pending", ctx.Path())
150+
assert.Equal(s.T(), addr, ctx.Param("addr"))
151+
152+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
153+
callsBefore := s.calls
154+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
155+
assert.Equal(s.T(), callsBefore+1, s.calls)
156+
}
157+
func (s *TestSuite) TestGetAsset() {
158+
ctx := s.e.NewContext(nil, nil)
159+
s.e.Router().Find(http.MethodGet, "/v1/asset/123456", ctx)
160+
assert.Equal(s.T(), "/v1/asset/:index", ctx.Path())
161+
assert.Equal(s.T(), "123456", ctx.Param("index"))
162+
163+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
164+
callsBefore := s.calls
165+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
166+
assert.Equal(s.T(), callsBefore+1, s.calls)
167+
}
168+
func (s *TestSuite) TestGetTransactionByID() {
169+
ctx := s.e.NewContext(nil, nil)
170+
txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA"
171+
s.e.Router().Find(http.MethodGet, "/v1/transaction/"+txid, ctx)
172+
assert.Equal(s.T(), "/v1/transaction/:txid", ctx.Path())
173+
assert.Equal(s.T(), txid, ctx.Param("txid"))
174+
175+
// Ensure that a handler in the route array was called by checking that the 'calls' variable is incremented.
176+
callsBefore := s.calls
177+
assert.Equal(s.T(), nil, ctx.Handler()(ctx))
178+
assert.Equal(s.T(), callsBefore+1, s.calls)
179+
}
180+
func TestTestSuite(t *testing.T) {
181+
suite.Run(t, new(TestSuite))
182+
}

daemon/algod/api/server/v1/routes/routes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var V1Routes = lib.Routes{
113113
lib.Route{
114114
Name: "pending-transaction-information-by-address",
115115
Method: "GET",
116-
Path: "/account/{addr}/transactions/pending",
116+
Path: "/account/:addr/transactions/pending",
117117
HandlerFunc: handlers.GetPendingTransactionsByAddress,
118118
},
119119

installer/config.json.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": 7,
2+
"Version": 8,
33
"AnnounceParticipationKey": true,
44
"Archival": false,
55
"BaseLoggerDebugLevel": 4,
@@ -14,6 +14,7 @@
1414
"DisableOutgoingConnectionThrottling": false,
1515
"DeadlockDetection": 0,
1616
"DNSBootstrapID": "<network>.algorand.network",
17+
"EnableGossipBlockService": true,
1718
"EnableIncomingMessageFilter": false,
1819
"EnableMetricReporting": false,
1920
"EnableOutgoingNetworkMessageFiltering": true,

netdeploy/network.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,13 @@ func (n Network) GetPeerAddresses(binDir string) []string {
307307
for _, relayDir := range n.cfg.RelayDirs {
308308
nc := nodecontrol.MakeNodeController(binDir, n.getNodeFullPath(relayDir))
309309
relayAddress, err := nc.GetListeningAddress()
310-
if err == nil {
311-
peerAddresses = append(peerAddresses, relayAddress)
310+
if err != nil {
311+
continue
312312
}
313+
if strings.HasPrefix(relayAddress, "http://") {
314+
relayAddress = relayAddress[7:]
315+
}
316+
peerAddresses = append(peerAddresses, relayAddress)
313317
}
314318
return peerAddresses
315319
}
@@ -336,7 +340,6 @@ func (n Network) StartNode(binDir, nodeDir string, redirectOutput bool) (err err
336340
controller := nodecontrol.MakeNodeController(binDir, nodeDir)
337341
peers := n.GetPeerAddresses(binDir)
338342
peerAddresses := strings.Join(peers, ";")
339-
340343
_, err = controller.StartAlgod(nodecontrol.AlgodStartArgs{
341344
PeerAddress: peerAddresses,
342345
RedirectOutput: redirectOutput,

0 commit comments

Comments
 (0)