Skip to content

Commit b7930a5

Browse files
committed
Merge remote-tracking branch 'origin/master' into s1bigdb
2 parents 229fc6d + 23890a8 commit b7930a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2254
-2296
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Algorand takes the security of the platform and of its users very seriously. We
44

55
If you believe that you have found a security vulnerability you may disclose it here:
66

7-
https://www.algorand.com/resources/blog/security
7+
https://immunefi.com/bounty/algorand/

cmd/algoh/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package main
1919
import (
2020
"context"
2121

22-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
22+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
2323
)
2424

2525
// Client is a minimal interface for the RestClient
2626
type Client interface {
27-
Status() (generatedV2.NodeStatusResponse, error)
27+
Status() (model.NodeStatusResponse, error)
2828
RawBlock(round uint64) ([]byte, error)
2929
GetGoRoutines(ctx context.Context) (string, error)
3030
HealthCheck() error

cmd/algoh/mockClient.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222

23-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
23+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
2424
"github.com/algorand/go-algorand/data/basics"
2525
"github.com/algorand/go-algorand/data/bookkeeping"
2626
"github.com/algorand/go-algorand/protocol"
@@ -31,10 +31,10 @@ import (
3131
// Helpers to initialize mockClient //
3232
//////////////////////////////////////
3333

34-
func makeNodeStatuses(blocks ...uint64) (ret []generatedV2.NodeStatusResponse) {
35-
ret = make([]generatedV2.NodeStatusResponse, 0, len(blocks))
34+
func makeNodeStatuses(blocks ...uint64) (ret []model.NodeStatusResponse) {
35+
ret = make([]model.NodeStatusResponse, 0, len(blocks))
3636
for _, block := range blocks {
37-
ret = append(ret, generatedV2.NodeStatusResponse{LastRound: block})
37+
ret = append(ret, model.NodeStatusResponse{LastRound: block})
3838
}
3939
return ret
4040
}
@@ -55,12 +55,12 @@ type mockClient struct {
5555
GetGoRoutinesCalls int
5656
HealthCheckCalls int
5757
error []error
58-
status []generatedV2.NodeStatusResponse
58+
status []model.NodeStatusResponse
5959
routine []string
6060
block map[uint64]rpcs.EncodedBlockCert
6161
}
6262

63-
func makeMockClient(error []error, status []generatedV2.NodeStatusResponse, block map[uint64]rpcs.EncodedBlockCert, routine []string) mockClient {
63+
func makeMockClient(error []error, status []model.NodeStatusResponse, block map[uint64]rpcs.EncodedBlockCert, routine []string) mockClient {
6464
return mockClient{
6565
BlockCalls: make(map[uint64]int),
6666
error: error,
@@ -82,7 +82,7 @@ func (c *mockClient) nextError() (e error) {
8282
return
8383
}
8484

85-
func (c *mockClient) Status() (s generatedV2.NodeStatusResponse, e error) {
85+
func (c *mockClient) Status() (s model.NodeStatusResponse, e error) {
8686
c.StatusCalls++
8787
s = c.status[0]
8888
// Repeat last status...

cmd/goal/account.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/algorand/go-algorand/config"
3232
"github.com/algorand/go-algorand/crypto"
3333
"github.com/algorand/go-algorand/crypto/passphrase"
34-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
34+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
3535
algodAcct "github.com/algorand/go-algorand/data/account"
3636
"github.com/algorand/go-algorand/data/basics"
3737
"github.com/algorand/go-algorand/data/transactions"
@@ -528,37 +528,37 @@ var infoCmd = &cobra.Command{
528528
},
529529
}
530530

531-
func printAccountInfo(client libgoal.Client, address string, onlyShowAssetIds bool, account generatedV2.Account) bool {
532-
var createdAssets []generatedV2.Asset
531+
func printAccountInfo(client libgoal.Client, address string, onlyShowAssetIds bool, account model.Account) bool {
532+
var createdAssets []model.Asset
533533
if account.CreatedAssets != nil {
534-
createdAssets = make([]generatedV2.Asset, len(*account.CreatedAssets))
534+
createdAssets = make([]model.Asset, len(*account.CreatedAssets))
535535
copy(createdAssets, *account.CreatedAssets)
536536
sort.Slice(createdAssets, func(i, j int) bool {
537537
return createdAssets[i].Index < createdAssets[j].Index
538538
})
539539
}
540540

541-
var heldAssets []generatedV2.AssetHolding
541+
var heldAssets []model.AssetHolding
542542
if account.Assets != nil {
543-
heldAssets = make([]generatedV2.AssetHolding, len(*account.Assets))
543+
heldAssets = make([]model.AssetHolding, len(*account.Assets))
544544
copy(heldAssets, *account.Assets)
545545
sort.Slice(heldAssets, func(i, j int) bool {
546546
return heldAssets[i].AssetID < heldAssets[j].AssetID
547547
})
548548
}
549549

550-
var createdApps []generatedV2.Application
550+
var createdApps []model.Application
551551
if account.CreatedApps != nil {
552-
createdApps = make([]generatedV2.Application, len(*account.CreatedApps))
552+
createdApps = make([]model.Application, len(*account.CreatedApps))
553553
copy(createdApps, *account.CreatedApps)
554554
sort.Slice(createdApps, func(i, j int) bool {
555555
return createdApps[i].Id < createdApps[j].Id
556556
})
557557
}
558558

559-
var optedInApps []generatedV2.ApplicationLocalState
559+
var optedInApps []model.ApplicationLocalState
560560
if account.AppsLocalState != nil {
561-
optedInApps = make([]generatedV2.ApplicationLocalState, len(*account.AppsLocalState))
561+
optedInApps = make([]model.ApplicationLocalState, len(*account.AppsLocalState))
562562
copy(optedInApps, *account.AppsLocalState)
563563
sort.Slice(optedInApps, func(i, j int) bool {
564564
return optedInApps[i].Id < optedInApps[j].Id
@@ -1039,7 +1039,7 @@ func renewPartKeysInDir(dataDir string, lastValidRound uint64, fee uint64, lease
10391039
if err != nil {
10401040
return fmt.Errorf(errorRequestFail, err)
10411041
}
1042-
renewAccounts := make(map[string]generatedV2.ParticipationKey)
1042+
renewAccounts := make(map[string]model.ParticipationKey)
10431043
for _, part := range parts {
10441044
if existing, has := renewAccounts[part.Address]; has {
10451045
if existing.Key.VoteFirstValid >= part.Key.VoteLastValid {

cmd/goal/accountsList.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"path/filepath"
2525
"strings"
2626

27-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
27+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
2828
"github.com/algorand/go-algorand/data/basics"
2929
"github.com/algorand/go-algorand/libgoal"
3030
)
@@ -204,7 +204,7 @@ func (accountList *AccountsList) loadList() {
204204
}
205205
}
206206

207-
func (accountList *AccountsList) outputAccount(addr string, acctInfo generatedV2.Account, multisigInfo *libgoal.MultisigInfo) {
207+
func (accountList *AccountsList) outputAccount(addr string, acctInfo model.Account, multisigInfo *libgoal.MultisigInfo) {
208208
if acctInfo.Address == "" {
209209
fmt.Printf("[n/a]\t%s\t%s\t[n/a] microAlgos", accountList.getNameByAddress(addr), addr)
210210
} else {

cmd/goal/clerk.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
"github.com/algorand/go-algorand/config"
3131
"github.com/algorand/go-algorand/crypto"
32-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
32+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
3333
"github.com/algorand/go-algorand/data/basics"
3434
"github.com/algorand/go-algorand/data/bookkeeping"
3535
"github.com/algorand/go-algorand/data/transactions"
@@ -155,18 +155,18 @@ var clerkCmd = &cobra.Command{
155155
},
156156
}
157157

158-
func waitForCommit(client libgoal.Client, txid string, transactionLastValidRound uint64) (txn generatedV2.PendingTransactionResponse, err error) {
158+
func waitForCommit(client libgoal.Client, txid string, transactionLastValidRound uint64) (txn model.PendingTransactionResponse, err error) {
159159
// Get current round information
160160
stat, err := client.Status()
161161
if err != nil {
162-
return generatedV2.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
162+
return model.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
163163
}
164164

165165
for {
166166
// Check if we know about the transaction yet
167167
txn, err = client.PendingTransactionInformation(txid)
168168
if err != nil {
169-
return generatedV2.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
169+
return model.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
170170
}
171171

172172
if txn.ConfirmedRound != nil && *txn.ConfirmedRound > 0 {
@@ -175,21 +175,21 @@ func waitForCommit(client libgoal.Client, txid string, transactionLastValidRound
175175
}
176176

177177
if txn.PoolError != "" {
178-
return generatedV2.PendingTransactionResponse{}, fmt.Errorf(txPoolError, txid, txn.PoolError)
178+
return model.PendingTransactionResponse{}, fmt.Errorf(txPoolError, txid, txn.PoolError)
179179
}
180180

181181
// check if we've already committed to the block number equals to the transaction's last valid round.
182182
// if this is the case, the transaction would not be included in the blockchain, and we can exit right
183183
// here.
184184
if transactionLastValidRound > 0 && stat.LastRound >= transactionLastValidRound {
185-
return generatedV2.PendingTransactionResponse{}, fmt.Errorf(errorTransactionExpired, txid)
185+
return model.PendingTransactionResponse{}, fmt.Errorf(errorTransactionExpired, txid)
186186
}
187187

188188
reportInfof(infoTxPending, txid, stat.LastRound)
189189
// WaitForRound waits until round "stat.LastRound+1" is committed
190190
stat, err = client.WaitForRound(stat.LastRound)
191191
if err != nil {
192-
return generatedV2.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
192+
return model.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
193193
}
194194
}
195195
return
@@ -1203,7 +1203,7 @@ var dryrunRemoteCmd = &cobra.Command{
12031203
return
12041204
}
12051205

1206-
stackToString := func(stack []generatedV2.TealValue) string {
1206+
stackToString := func(stack []model.TealValue) string {
12071207
result := make([]string, len(stack))
12081208
for i, sv := range stack {
12091209
if sv.Type == uint64(basics.TealBytesType) {
@@ -1217,7 +1217,7 @@ var dryrunRemoteCmd = &cobra.Command{
12171217
if len(resp.Txns) > 0 {
12181218
for i, txnResult := range resp.Txns {
12191219
var msgs []string
1220-
var trace []generatedV2.DryrunState
1220+
var trace []model.DryrunState
12211221
if txnResult.AppCallMessages != nil && len(*txnResult.AppCallMessages) > 0 {
12221222
msgs = *txnResult.AppCallMessages
12231223
if txnResult.AppCallTrace != nil {

cmd/goal/node.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ import (
3333

3434
"github.com/spf13/cobra"
3535

36-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
37-
3836
"github.com/algorand/go-algorand/config"
37+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
3938
"github.com/algorand/go-algorand/ledger/ledgercore"
4039
"github.com/algorand/go-algorand/libgoal"
4140
"github.com/algorand/go-algorand/network"
@@ -437,7 +436,7 @@ func getStatus(dataDir string) {
437436
}
438437
}
439438

440-
func makeStatusString(stat generatedV2.NodeStatusResponse) string {
439+
func makeStatusString(stat model.NodeStatusResponse) string {
441440
lastRoundTime := fmt.Sprintf("%.1fs", time.Duration(stat.TimeSinceLastRound).Seconds())
442441
catchupTime := fmt.Sprintf("%.1fs", time.Duration(stat.CatchupTime).Seconds())
443442
var statusString string

cmd/loadgenerator/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/algorand/go-algorand/crypto"
3232
"github.com/algorand/go-algorand/crypto/passphrase"
3333
"github.com/algorand/go-algorand/daemon/algod/api/client"
34-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
34+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
3535
"github.com/algorand/go-algorand/daemon/algod/api/spec/common"
3636
algodAcct "github.com/algorand/go-algorand/data/account"
3737
"github.com/algorand/go-algorand/data/basics"
@@ -191,7 +191,7 @@ func spendLoop(cfg config, privateKey []*crypto.SignatureSecrets, publicKey []ba
191191
return nil
192192
}
193193

194-
func waitForRound(restClient client.RestClient, cfg config, spendingRound bool) (nodeStatus generatedV2.NodeStatusResponse) {
194+
func waitForRound(restClient client.RestClient, cfg config, spendingRound bool) (nodeStatus model.NodeStatusResponse) {
195195
var err error
196196
for {
197197
nodeStatus, err = restClient.Status()
@@ -225,7 +225,7 @@ func waitForRound(restClient client.RestClient, cfg config, spendingRound bool)
225225

226226
const transactionBlockSize = 800
227227

228-
func generateTransactions(restClient client.RestClient, cfg config, privateKeys []*crypto.SignatureSecrets, publicKeys []basics.Address, nodeStatus generatedV2.NodeStatusResponse) (queueFull bool) {
228+
func generateTransactions(restClient client.RestClient, cfg config, privateKeys []*crypto.SignatureSecrets, publicKeys []basics.Address, nodeStatus model.NodeStatusResponse) (queueFull bool) {
229229
start := time.Now()
230230
var err error
231231
var vers common.Version

cmd/tealdbg/dryrunRequest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/algorand/go-algorand/protocol"
2424

2525
v2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2"
26-
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
26+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
2727
)
2828

2929
// ddrFromParams converts serialized DryrunRequest to v2.DryrunRequest
@@ -32,7 +32,7 @@ func ddrFromParams(dp *DebugParams) (ddr v2.DryrunRequest, err error) {
3232
return
3333
}
3434

35-
var gdr generatedV2.DryrunRequest
35+
var gdr model.DryrunRequest
3636
err1 := protocol.DecodeJSON(dp.DdrBlob, &gdr)
3737
if err1 == nil {
3838
ddr, err = v2.DryrunRequestFromGenerated(&gdr)
@@ -47,7 +47,7 @@ func ddrFromParams(dp *DebugParams) (ddr v2.DryrunRequest, err error) {
4747
return
4848
}
4949

50-
func convertAccounts(accounts []generatedV2.Account) (records []basics.BalanceRecord, err error) {
50+
func convertAccounts(accounts []model.Account) (records []basics.BalanceRecord, err error) {
5151
for _, a := range accounts {
5252
var addr basics.Address
5353
addr, err = basics.UnmarshalChecksumAddress(a.Address)

cmd/tealdbg/localLedger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/algorand/go-algorand/config"
2727
"github.com/algorand/go-algorand/crypto"
2828
v2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2"
29-
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
29+
"github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/model"
3030
"github.com/algorand/go-algorand/data/basics"
3131
"github.com/algorand/go-algorand/data/bookkeeping"
3232
"github.com/algorand/go-algorand/data/transactions"
@@ -42,7 +42,7 @@ type AccountIndexerResponse struct {
4242
//
4343
// Definition:
4444
// data/basics/userBalance.go : AccountData
45-
Account generated.Account `json:"account"`
45+
Account model.Account `json:"account"`
4646

4747
// Round at which the results were computed.
4848
CurrentRound uint64 `json:"current-round"`
@@ -52,7 +52,7 @@ type AccountIndexerResponse struct {
5252
type ApplicationIndexerResponse struct {
5353

5454
// Application index and its parameters
55-
Application generated.Application `json:"application,omitempty"`
55+
Application model.Application `json:"application,omitempty"`
5656

5757
// Round at which the results were computed.
5858
CurrentRound uint64 `json:"current-round"`

0 commit comments

Comments
 (0)