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

go-algorand 3.17.0-beta Release PR #5601

Merged
merged 21 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fa0b354
tests: fix coder tester for TxType bound (#5536)
algorandskiy Jul 11, 2023
80d0226
catchup: Catchup variable reuse (#5551)
Eric-Warehime Jul 12, 2023
aeef625
Algod: Simulate endpoint stack-change exposure (#5440)
ahangsu Jul 12, 2023
8db3d7a
CICD: Update ubuntu circleci image and orbs (#5564)
algobarb Jul 13, 2023
d316914
perf tests: use metrics for memory usage charts (#5565)
algorandskiy Jul 13, 2023
279605a
docs: Fix broken markdown in follower documentation. (#5585)
winder Jul 20, 2023
be237d6
Algod: Simulate endpoint scratch-change exposure (#5563)
ahangsu Jul 20, 2023
bc9f126
tools: let catchpointdump to calculate and print data hashes (#5584)
algorandskiy Jul 20, 2023
0e0b26d
ledger: use single SP verification hash/data query for catchpoint tra…
cce Jul 20, 2023
17d4ebf
goal: support simulate scratch in exec trace (#5589)
ahangsu Jul 20, 2023
548399e
CircleCI: Update macos xcode versions (#5590)
algobarb Jul 20, 2023
1a46ceb
cli: clarify program source flag description (#5571)
kehiy Jul 21, 2023
4a5095e
chore: use string builder instead of string concatenation in catchup …
kehiy Jul 21, 2023
fbfbea1
build: remove sqlite from release configurations (#5562)
cce Jul 21, 2023
b4f6b1f
tools: Reorganize block generator scripts. (#5582)
winder Jul 21, 2023
0c6a328
catchpoint: use read connection for data retrieval for spver hash cal…
cce Jul 21, 2023
197bfb6
ledger: move MakeCatchpointReader back to the Reader interface (#5583)
icorderi Jul 21, 2023
8f4f71b
Merge branch 'rel/beta' into onetechnical/relbeta-remerge
onetechnical Jul 24, 2023
2258edd
Remove buildnumber.dat and genesistimestamp.dat files
onetechnical Jul 24, 2023
1d1fe0f
Merge pull request #5600 from onetechnical/onetechnical/relbeta-remerge
algojohnlee Jul 24, 2023
fbdcd05
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service Jul 24, 2023
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
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@ executors:
resource_class: arm.large
mac_amd64_medium:
macos:
xcode: 13.2.1
resource_class: medium
xcode: 14.2.0
resource_class: macos.x86.medium.gen2
environment:
HOMEBREW_NO_AUTO_UPDATE: "true"
mac_amd64_large:
macos:
xcode: 13.2.1
resource_class: large
xcode: 14.2.0
# Since they removed the large class for amd64, we will use medium here too.
resource_class: macos.x86.medium.gen2
environment:
HOMEBREW_NO_AUTO_UPDATE: "true"
mac_arm64: &executor-mac-arm64
machine: true
resource_class: algorand/macstadium-m1-macos11
resource_class: algorand/macstadium-m1
environment:
HOMEBREW_NO_AUTO_UPDATE: "true"
# these are required b/c jobs explicitly assign sizes to the executors
Expand Down
6 changes: 1 addition & 5 deletions catchup/catchpointService.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
// noPeersAvailableSleepInterval is the sleep interval that the node would wait if no peers are available to download the next block from.
// this delay is intended to ensure to give the network package some time to download the list of relays.
noPeersAvailableSleepInterval = 50 * time.Millisecond

// checkLedgerDownloadRetries is the number of times the catchpoint service will attempt to HEAD request the
// ledger from peers when `Start`ing catchpoint catchup
checkLedgerDownloadRetries = 10
)

// CatchpointCatchupNodeServices defines the external node support needed
Expand Down Expand Up @@ -826,7 +822,7 @@
}
peerSelector := makePeerSelector(cs.net, []peerClass{{initialRank: peerRankInitialFirstPriority, peerClass: network.PeersPhonebookRelays}})
ledgerFetcher := makeLedgerFetcher(cs.net, cs.ledgerAccessor, cs.log, cs, cs.config)
for i := 0; i < checkLedgerDownloadRetries; i++ {
for i := 0; i < cs.config.CatchupLedgerDownloadRetryAttempts; i++ {

Check warning on line 825 in catchup/catchpointService.go

View check run for this annotation

Codecov / codecov/patch

catchup/catchpointService.go#L825

Added line #L825 was not covered by tests
psp, peerError := peerSelector.getNextPeer()
if peerError != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions catchup/catchpointService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/ledger"
"github.com/algorand/go-algorand/ledger/ledgercore"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)
Expand Down Expand Up @@ -76,6 +77,11 @@ func (m *catchpointCatchupAccessorMock) Ledger() (l ledger.CatchupAccessorClient
return m.l
}

// GetVerifyData returns the balances hash, spver hash and totals used by VerifyCatchpoint
func (m *catchpointCatchupAccessorMock) GetVerifyData(ctx context.Context) (balancesHash crypto.Digest, spverHash crypto.Digest, totals ledgercore.AccountTotals, err error) {
return crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
}

// TestCatchpointServicePeerRank ensures CatchpointService does not crash when a block fetched
// from the local ledger and not from network when ranking a peer
func TestCatchpointServicePeerRank(t *testing.T) {
Expand Down
25 changes: 14 additions & 11 deletions catchup/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"context"
"errors"
"fmt"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -744,17 +745,19 @@
if cert.Round == fetchedCert.Round &&
cert.Proposal.BlockDigest != fetchedCert.Proposal.BlockDigest &&
fetchedCert.Authenticate(*block, s.ledger, verifier) == nil {
s := "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
s += "!!!!!!!!!! FORK DETECTED !!!!!!!!!!!\n"
s += "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
s += "fetchRound called with a cert authenticating block with hash %v.\n"
s += "We fetched a valid cert authenticating a different block, %v. This indicates a fork.\n\n"
s += "Cert from our agreement service:\n%#v\n\n"
s += "Cert from the fetcher:\n%#v\n\n"
s += "Block from the fetcher:\n%#v\n\n"
s += "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
s += "!!!!!!!!!! FORK DETECTED !!!!!!!!!!!\n"
s += "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
var builder strings.Builder
builder.WriteString("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
builder.WriteString("!!!!!!!!!! FORK DETECTED !!!!!!!!!!!\n")
builder.WriteString("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
builder.WriteString("fetchRound called with a cert authenticating block with hash %v.\n")
builder.WriteString("We fetched a valid cert authenticating a different block, %v. This indicates a fork.\n\n")
builder.WriteString("Cert from our agreement service:\n%#v\n\n")
builder.WriteString("Cert from the fetcher:\n%#v\n\n")
builder.WriteString("Block from the fetcher:\n%#v\n\n")
builder.WriteString("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
builder.WriteString("!!!!!!!!!! FORK DETECTED !!!!!!!!!!!\n")
builder.WriteString("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
s := builder.String()

Check warning on line 760 in catchup/service.go

View check run for this annotation

Codecov / codecov/patch

catchup/service.go#L748-L760

Added lines #L748 - L760 were not covered by tests
s = fmt.Sprintf(s, cert.Proposal.BlockDigest, fetchedCert.Proposal.BlockDigest, cert, fetchedCert, block)
fmt.Println(s)
logging.Base().Error(s)
Expand Down
15 changes: 15 additions & 0 deletions cmd/catchpointdump/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/algorand/avm-abi/apps"
cmdutil "github.com/algorand/go-algorand/cmd/util"
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/ledger"
Expand All @@ -48,11 +49,13 @@ import (
var catchpointFile string
var outFileName string
var excludedFields = cmdutil.MakeCobraStringSliceValue(nil, []string{"version", "catchpoint"})
var printDigests bool

func init() {
fileCmd.Flags().StringVarP(&catchpointFile, "tar", "t", "", "Specify the catchpoint file (either .tar or .tar.gz) to process")
fileCmd.Flags().StringVarP(&outFileName, "output", "o", "", "Specify an outfile for the dump ( i.e. tracker.dump.txt )")
fileCmd.Flags().BoolVarP(&loadOnly, "load", "l", false, "Load only, do not dump")
fileCmd.Flags().BoolVarP(&printDigests, "digest", "d", false, "Print balances and spver digests")
fileCmd.Flags().VarP(excludedFields, "exclude-fields", "e", "List of fields to exclude from the dump: ["+excludedFields.AllowedString()+"]")
}

Expand Down Expand Up @@ -206,6 +209,18 @@ func loadCatchpointIntoDatabase(ctx context.Context, catchupAccessor ledger.Catc
header, err := tarReader.Next()
if err != nil {
if err == io.EOF {
if printDigests {
err = catchupAccessor.BuildMerkleTrie(ctx, func(uint64, uint64) {})
if err != nil {
return fileHeader, err
}
var balanceHash, spverHash crypto.Digest
balanceHash, spverHash, _, err = catchupAccessor.GetVerifyData(ctx)
if err != nil {
return fileHeader, err
}
fmt.Printf("accounts digest=%s, spver digest=%s\n\n", balanceHash, spverHash)
}
return fileHeader, nil
}
return fileHeader, err
Expand Down
12 changes: 9 additions & 3 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
simulateAllowMoreOpcodeBudget bool
simulateExtraOpcodeBudget uint64
simulateEnableRequestTrace bool
simulateStackChange bool
simulateScratchChange bool
)

func init() {
Expand All @@ -97,7 +99,7 @@
sendCmd.Flags().Uint64VarP(&amount, "amount", "a", 0, "The amount to be transferred (required), in microAlgos")
sendCmd.Flags().StringVarP(&closeToAddress, "close-to", "c", "", "Close account and send remainder to this address")
sendCmd.Flags().StringVar(&rekeyToAddress, "rekey-to", "", "Rekey account to the given spending key/address. (Future transactions from this account will need to be signed with the new key.)")
sendCmd.Flags().StringVarP(&programSource, "from-program", "F", "", "Program source to use as account logic")
sendCmd.Flags().StringVarP(&programSource, "from-program", "F", "", "Program source file to use as account logic")
sendCmd.Flags().StringVarP(&progByteFile, "from-program-bytes", "P", "", "Program binary to use as account logic")
sendCmd.Flags().StringSliceVar(&argB64Strings, "argb64", nil, "Base64 encoded args to pass to transaction logic")
sendCmd.Flags().StringVarP(&logicSigFile, "logic-sig", "L", "", "LogicSig to apply to transaction")
Expand All @@ -117,7 +119,7 @@
signCmd.Flags().StringVarP(&txFilename, "infile", "i", "", "Partially-signed transaction file to add signature to")
signCmd.Flags().StringVarP(&outFilename, "outfile", "o", "", "Filename for writing the signed transaction")
signCmd.Flags().StringVarP(&signerAddress, "signer", "S", "", "Address of key to sign with, if different from transaction \"from\" address due to rekeying")
signCmd.Flags().StringVarP(&programSource, "program", "p", "", "Program source to use as account logic")
signCmd.Flags().StringVarP(&programSource, "program", "p", "", "Program source file to use as account logic")
signCmd.Flags().StringVarP(&logicSigFile, "logic-sig", "L", "", "LogicSig to apply to transaction")
signCmd.Flags().StringSliceVar(&argB64Strings, "argb64", nil, "Base64 encoded args to pass to transaction logic")
signCmd.Flags().StringVarP(&protoVersion, "proto", "P", "", "Consensus protocol version id string")
Expand Down Expand Up @@ -163,6 +165,8 @@
simulateCmd.Flags().BoolVar(&simulateAllowMoreOpcodeBudget, "allow-more-opcode-budget", false, "Apply max extra opcode budget for apps per transaction group (default 320000) during simulation")
simulateCmd.Flags().Uint64Var(&simulateExtraOpcodeBudget, "extra-opcode-budget", 0, "Apply extra opcode budget for apps per transaction group during simulation")
simulateCmd.Flags().BoolVar(&simulateEnableRequestTrace, "trace", false, "Enable simulation time execution trace of app calls")
simulateCmd.Flags().BoolVar(&simulateStackChange, "stack", false, "Report stack change during simulation time")
simulateCmd.Flags().BoolVar(&simulateScratchChange, "scratch", false, "Report scratch change during simulation time")
}

var clerkCmd = &cobra.Command{
Expand Down Expand Up @@ -1365,6 +1369,8 @@

func traceCmdOptionToSimulateTraceConfigModel() simulation.ExecTraceConfig {
return simulation.ExecTraceConfig{
Enable: simulateEnableRequestTrace,
Enable: simulateEnableRequestTrace,
Stack: simulateStackChange,
Scratch: simulateScratchChange,

Check warning on line 1374 in cmd/goal/clerk.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/clerk.go#L1372-L1374

Added lines #L1372 - L1374 were not covered by tests
}
}
7 changes: 7 additions & 0 deletions components/mocks/mockCatchpointCatchupAccessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package mocks
import (
"context"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/ledger"
"github.com/algorand/go-algorand/ledger/ledgercore"
)

// MockCatchpointCatchupAccessor is a dummy CatchpointCatchupAccessor implementation which doesn't do anything.
Expand Down Expand Up @@ -67,6 +69,11 @@ func (m *MockCatchpointCatchupAccessor) GetCatchupBlockRound(ctx context.Context
return basics.Round(0), nil
}

// GetVerifyData returns the balances hash, spver hash and totals used by VerifyCatchpoint
func (m *MockCatchpointCatchupAccessor) GetVerifyData(ctx context.Context) (balancesHash crypto.Digest, spverHash crypto.Digest, totals ledgercore.AccountTotals, err error) {
return crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
}

// VerifyCatchpoint verifies that the catchpoint is valid by reconstructing the label.
func (m *MockCatchpointCatchupAccessor) VerifyCatchpoint(ctx context.Context, blk *bookkeeping.Block) (err error) {
return nil
Expand Down
66 changes: 66 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,29 @@
}
}
},
"AvmValue": {
"description": "Represents an AVM value.",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"description": "value type. Value `1` refers to **bytes**, value `2` refers to **uint64**",
"type": "integer"
},
"bytes": {
"description": "bytes value.",
"type": "string",
"format": "byte"
},
"uint": {
"description": "uint value.",
"type": "integer",
"x-algorand-format": "uint64"
}
}
},
"StateDelta": {
"description": "Application state delta.",
"type": "array",
Expand Down Expand Up @@ -3491,6 +3514,14 @@
"enable": {
"description": "A boolean option for opting in execution trace features simulation endpoint.",
"type": "boolean"
},
"stack-change": {
"description": "A boolean option enabling returning stack changes together with execution trace during simulation.",
"type": "boolean"
},
"scratch-change": {
"description": "A boolean option enabling returning scratch slot changes together with execution trace during simulation.",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -3853,6 +3884,23 @@
}
}
},
"ScratchChange": {
"description": "A write operation into a scratch slot.",
"type": "object",
"required": [
"slot",
"new-value"
],
"properties": {
"slot": {
"description": "The scratch slot written.",
"type": "integer"
},
"new-value": {
"$ref": "#/definitions/AvmValue"
}
}
},
"SimulationOpcodeTraceUnit": {
"description": "The set of trace information and effect from evaluating a single opcode.",
"type": "object",
Expand All @@ -3864,12 +3912,30 @@
"description": "The program counter of the current opcode being evaluated.",
"type": "integer"
},
"scratch-changes": {
"description": "The writes into scratch slots.",
"type": "array",
"items": {
"$ref": "#/definitions/ScratchChange"
}
},
"spawned-inners": {
"description": "The indexes of the traces for inner transactions spawned by this opcode, if any.",
"type": "array",
"items": {
"type": "integer"
}
},
"stack-pop-count": {
"description": "The number of deleted stack values by this opcode.",
"type": "integer"
},
"stack-additions": {
"description": "The values added by this opcode to the stack.",
"type": "array",
"items": {
"$ref": "#/definitions/AvmValue"
}
}
}
},
Expand Down
Loading