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.12.2-stable Release PR #4837

Merged
merged 78 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e8e1b41
API: bump max size of teal source and dryrun (#4633)
barnjamin Oct 24, 2022
5b028c2
Merge remote-tracking branch 'origin/rel/stable' into relstable3.11.2…
Algo-devops-service Oct 24, 2022
1a83da0
Bump Version, Remove buildnumber.dat and genesistimestamp.dat files.
Algo-devops-service Oct 24, 2022
0c2bc3a
Merge pull request #4688 from Algo-devops-service/relstable3.11.2-rem…
algojohnlee Oct 24, 2022
fbd5b17
ledger: Make AccountDelta fields visible for serialization. (#4620)
winder Oct 24, 2022
5e0ea76
perf test: Transaction group handle/verify (#4652)
algonautshant Oct 24, 2022
fb332de
Netgoal: Update netgoal generate flags and variables (#4656)
algobarb Oct 25, 2022
6a2942d
lint: enable go vet printf format arg checks for logging (#4679)
cce Oct 25, 2022
ad08f74
logging: demote LeaseInLedgerError from warn to info level (#4685)
cce Oct 26, 2022
a3e90ad
test: metrics gathering improvements (#4639)
brianolson Oct 26, 2022
4e36847
Tests: Fix handling of empty local state in TestResourcesDataApp (#4699)
michaeldiamant Oct 26, 2022
ab87a8a
AVM: match, pushints, and pushbytess opcodes (#4645)
algoidurovic Oct 26, 2022
40974ee
network: align duplicateFilterCount to prevent panic on 32-bit platfo…
cce Oct 28, 2022
e2c2bc4
Bug-fix: return v2 spec from swagger endpoint (#4697)
AlgoStephenAkiki Oct 28, 2022
0cb9a2e
AVM: Add support for Boxes (#4149)
michaeldiamant Oct 31, 2022
7602d4f
performance: don't create child cow in TestTransactionGroup (#4706)
cce Oct 31, 2022
fb1f498
db: print dbutil.go error in stderr (#4712)
michaeldiamant Oct 31, 2022
ba9c593
performance: agreement state serialization using msgp (#4644)
iansuvak Oct 31, 2022
e6f396b
prefetcher: enable prefetcher for assets and apps (#4352)
algorandskiy Oct 31, 2022
97c232d
test: fix after boxes and prefetcher remerge (#4716)
algorandskiy Nov 1, 2022
959fb5a
blank import needs commenting out for indexer's lint (#4720)
tzaffi Nov 1, 2022
bac4117
AVM: fix early eval exits for Debugger (#4719)
jannotti Nov 1, 2022
daca5d3
DevOps: Update docker container in build (#4723)
onetechnical Nov 1, 2022
15efc02
catchpoint: actualize limit constants and fix txtail table init (#4703)
algorandskiy Nov 1, 2022
a8f1b4a
tools: allow specification of RewardPoolBalance in genesis (#4643)
barnjamin Nov 1, 2022
06f9109
Consensus: v36 upgrade (#4722)
jannotti Nov 1, 2022
f37bb6e
dispenser: add input validation (#4713)
algolucky Nov 1, 2022
2c0dd9e
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service Nov 1, 2022
31a1099
Merge pull request #4730 from Algo-devops-service/relbeta3.12.0
algojohnlee Nov 1, 2022
e387553
mergeback: feature/alphanet (#4726)
algolucky Nov 2, 2022
fa77937
add unconvert to warning linter (#4710)
cce Nov 2, 2022
561bc4a
db: add AtomicContext (#4724)
algorandskiy Nov 2, 2022
995ae47
update vAlpha5 to point to v36 (#4729)
cce Nov 2, 2022
3701d29
tests: make ledger tests ~20 sec faster (#4739)
algorandskiy Nov 3, 2022
4ac719a
catchpointdump: supports tar.gz files (#4743)
almog-t Nov 3, 2022
25e0087
perf: don't preallocate rarely used maps in MakeStateDelta (#4715)
iansuvak Nov 3, 2022
855304e
tools: remove doberman and dependency (#4750)
winder Nov 3, 2022
06d146b
algod: Migrate internal uses of v1 algod API to v2 (#4684)
algochoi Nov 3, 2022
7fcfe26
test: add test defending against regression in testnet genesis gener…
michaeldiamant Nov 3, 2022
ae443cd
tests: Fix account tests for calling pending txn endpoint and box tes…
algochoi Nov 3, 2022
0af97b3
goal: Add URL to goal asset info. (#4731)
winder Nov 4, 2022
207f964
performance: turn cache misses during assembly into cache hits during…
icorderi Nov 4, 2022
7f94674
Testing: Lint for unparallelized tests without explicit reason (#4746)
jdtzmn Nov 4, 2022
863e6ca
daemon: add pool error message (#4755)
algorandskiy Nov 4, 2022
0eae1c0
Tests: Fix types in assertions and change to using libgoal client whe…
algochoi Nov 4, 2022
76ff3a8
goal: Change asset commands to use AccountAssetInformation (#4758)
algochoi Nov 7, 2022
5c97463
API: Update oapi-codegen version to v1.12.0 of our fork (#4707)
Eric-Warehime Nov 7, 2022
e6172bc
Tests: Move box test artifacts to a temp directory (#4771)
algochoi Nov 8, 2022
94e3eba
algod: Delete v1 usage from client and remove `V2` prefix from APIs (…
algochoi Nov 9, 2022
327e987
netgoal: start with 20GB RootStorage (#4779)
algolucky Nov 10, 2022
1a13168
Update SECURITY.md (#4782)
algonoah Nov 10, 2022
445b45b
Fix resolver test endpoint (#4784)
Eric-Warehime Nov 14, 2022
23890a8
algod: Consolidate models (#4714)
Eric-Warehime Nov 14, 2022
9f90fd1
Notify when GHA workflow fails on master (#4791)
michaeldiamant Nov 16, 2022
bffd703
Notify about CircleCI build failures for master and rel branches only…
michaeldiamant Nov 16, 2022
6b85209
Tests: Fix txid-string comparison (#4792)
algochoi Nov 16, 2022
31e8c03
Merge remote-tracking branch 'origin/rel/stable' into relstable3.11.3…
Algo-devops-service Nov 17, 2022
e618fbf
Merge pull request #4811 from Algo-devops-service/relstable3.11.3-rem…
algojohnlee Nov 17, 2022
526cb89
telemetry: add TCP RTT info collection (#4745)
cce Nov 17, 2022
d22fa42
txHandler: add more metric (#4786)
algorandskiy Nov 17, 2022
06e61a9
metrics: split out /Transaction/AssembleBlock metrics (#4795)
iansuvak Nov 17, 2022
3ece6bd
test: large generated accountdb cluster test (#4772)
brianolson Nov 17, 2022
68a72e3
cow: always process KvMods to add OldData to mods when building State…
cce Nov 18, 2022
6acbd18
txHandler: service does not restart after node catching up (#4809)
algonautshant Nov 18, 2022
fe580fd
Catchpoints: Add the kv hashes into the trie (#4812)
jannotti Nov 18, 2022
9791d64
txSyncer: service does not start after node catching up (#4768)
algonautshant Nov 18, 2022
9202a43
CI: Fix GHA failure notification trigger condition (#4810)
michaeldiamant Nov 18, 2022
5b45539
Catchpoints: Enrich catchpoint generation and status with KV metadat…
michaeldiamant Nov 18, 2022
d80de1a
Squelch macOS accept incoming network connections notifications (#4814)
michaeldiamant Nov 18, 2022
8c7fb86
add TransactionGroupTxSyncHandled (#4815)
cce Nov 18, 2022
60cdd7d
tools: update catchpointdump 'database' and 'database check' commands…
cce Nov 18, 2022
b66a955
accountdb: add migration 8 for resetting accounthashes on betanet (#4…
cce Nov 21, 2022
62568c5
Merge branch 'master' into relbeta3.12.1
Algo-devops-service Nov 21, 2022
efdfc1f
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service Nov 21, 2022
bacdf8d
Merge pull request #4823 from Algo-devops-service/relbeta3.12.1
algojohnlee Nov 22, 2022
0ca1eb7
Bump buildnumber.dat
onetechnical Nov 22, 2022
6f01d48
test: disable TestWebsocketNetworkTelemetryTCP on CI (#4827)
algorandskiy Nov 22, 2022
3583908
Merge pull request #4828 from onetechnical/relbeta3.12.2
algojohnlee Nov 22, 2022
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
catchpoint: actualize limit constants and fix txtail table init (#4703)
  • Loading branch information
algorandskiy authored Nov 1, 2022
commit 15efc02d8dde1fe223cd6daf353a595d4d4c91c5
4 changes: 2 additions & 2 deletions catchup/ledgerFetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
var errNoLedgerForRound = errors.New("no ledger available for given round")

const (
// maxCatchpointFileChunkSize is a rough estimate for the worst-case scenario we're going to have of all the accounts data per a single catchpoint file chunk.
maxCatchpointFileChunkSize = ledger.BalancesPerCatchpointFileChunk * basics.MaxEncodedAccountDataSize
// maxCatchpointFileChunkSize is a rough estimate for the worst-case scenario we're going to have of all the accounts data per a single catchpoint file chunk and one account with max resources.
maxCatchpointFileChunkSize = ledger.BalancesPerCatchpointFileChunk*(ledger.MaxEncodedBaseAccountDataSize+ledger.MaxEncodedKVDataSize) + ledger.ResourcesPerCatchpointFileChunk*ledger.MaxEncodedBaseResourceDataSize
// defaultMinCatchpointFileDownloadBytesPerSecond defines the worst-case scenario download speed we expect to get while downloading a catchpoint file
defaultMinCatchpointFileDownloadBytesPerSecond = 20 * 1024
// catchpointFileStreamReadSize defines the number of bytes we would attempt to read at each iteration from the incoming http data stream
Expand Down
8 changes: 2 additions & 6 deletions data/basics/userBalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,16 @@ const (
// These two accounts also have additional Algo transfer restrictions.
NotParticipating

// MaxEncodedAccountDataSize is a rough estimate for the worst-case scenario we're going to have of the account data and address serialized.
// this number is verified by the TestEncodedAccountDataSize function.
MaxEncodedAccountDataSize = 850000

// encodedMaxAssetsPerAccount is the decoder limit of number of assets stored per account.
// it's being verified by the unit test TestEncodedAccountAllocationBounds to align
// with config.Consensus[protocol.ConsensusCurrentVersion].MaxAssetsPerAccount; note that the decoded
// parameter is used only for protecting the decoder against malicious encoded account data stream.
// protocol-specific constains would be tested once the decoding is complete.
// protocol-specific contains would be tested once the decoding is complete.
encodedMaxAssetsPerAccount = 1024

// EncodedMaxAppLocalStates is the decoder limit for number of opted-in apps in a single account.
// It is verified in TestEncodedAccountAllocationBounds to align with
// config.Consensus[protocol.ConsensusCurrentVersion].MaxppsOptedIn
// config.Consensus[protocol.ConsensusCurrentVersion].MaxAppsOptedIn
EncodedMaxAppLocalStates = 64

// EncodedMaxAppParams is the decoder limit for number of created apps in a single account.
Expand Down
96 changes: 0 additions & 96 deletions data/basics/userBalance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,102 +131,6 @@ func getSampleAccountData() AccountData {
}
}

func TestEncodedAccountDataSize(t *testing.T) {
partitiontest.PartitionTest(t)

maxStateSchema := StateSchema{
NumUint: 0x1234123412341234,
NumByteSlice: 0x1234123412341234,
}
ad := getSampleAccountData()
ad.TotalAppSchema = maxStateSchema

// TODO after applications enabled: change back to protocol.ConsensusCurrentVersion
currentConsensusParams := config.Consensus[protocol.ConsensusFuture]

for assetCreatorAssets := 0; assetCreatorAssets < currentConsensusParams.MaxAssetsPerAccount; assetCreatorAssets++ {
ap := AssetParams{
Total: 0x1234123412341234,
Decimals: 0x12341234,
DefaultFrozen: true,
UnitName: makeString(currentConsensusParams.MaxAssetUnitNameBytes),
AssetName: makeString(currentConsensusParams.MaxAssetNameBytes),
URL: makeString(currentConsensusParams.MaxAssetURLBytes),
Manager: Address(crypto.Hash([]byte{1, byte(assetCreatorAssets)})),
Reserve: Address(crypto.Hash([]byte{2, byte(assetCreatorAssets)})),
Freeze: Address(crypto.Hash([]byte{3, byte(assetCreatorAssets)})),
Clawback: Address(crypto.Hash([]byte{4, byte(assetCreatorAssets)})),
}
copy(ap.MetadataHash[:], makeString(32))
ad.AssetParams[AssetIndex(0x1234123412341234-assetCreatorAssets)] = ap
}

for assetHolderAssets := 0; assetHolderAssets < currentConsensusParams.MaxAssetsPerAccount; assetHolderAssets++ {
ah := AssetHolding{
Amount: 0x1234123412341234,
Frozen: true,
}
ad.Assets[AssetIndex(0x1234123412341234-assetHolderAssets)] = ah
}

maxProg := []byte(makeString(config.MaxAvailableAppProgramLen))
maxGlobalState := make(TealKeyValue, currentConsensusParams.MaxGlobalSchemaEntries)
maxLocalState := make(TealKeyValue, currentConsensusParams.MaxLocalSchemaEntries)

for globalKey := uint64(0); globalKey < currentConsensusParams.MaxGlobalSchemaEntries; globalKey++ {
prefix := fmt.Sprintf("%d|", globalKey)
padding := makeString(currentConsensusParams.MaxAppKeyLen - len(prefix))
maxKey := prefix + padding
maxValue := TealValue{
Type: TealBytesType,
Bytes: makeString(currentConsensusParams.MaxAppSumKeyValueLens - len(maxKey)),
}
maxGlobalState[maxKey] = maxValue
}

for localKey := uint64(0); localKey < currentConsensusParams.MaxLocalSchemaEntries; localKey++ {
prefix := fmt.Sprintf("%d|", localKey)
padding := makeString(currentConsensusParams.MaxAppKeyLen - len(prefix))
maxKey := prefix + padding
maxValue := TealValue{
Type: TealBytesType,
Bytes: makeString(currentConsensusParams.MaxAppSumKeyValueLens - len(maxKey)),
}
maxLocalState[maxKey] = maxValue
}
maxAppsCreate := currentConsensusParams.MaxAppsCreated
if maxAppsCreate == 0 {
maxAppsCreate = config.Consensus[protocol.ConsensusV30].MaxAppsCreated
}
for appCreatorApps := 0; appCreatorApps < maxAppsCreate; appCreatorApps++ {
ap := AppParams{
ApprovalProgram: maxProg,
ClearStateProgram: maxProg,
GlobalState: maxGlobalState,
StateSchemas: StateSchemas{
LocalStateSchema: maxStateSchema,
GlobalStateSchema: maxStateSchema,
},
}
ad.AppParams[AppIndex(0x1234123412341234-appCreatorApps)] = ap
}

maxAppsOptedIn := currentConsensusParams.MaxAppsOptedIn
if maxAppsOptedIn == 0 {
maxAppsOptedIn = config.Consensus[protocol.ConsensusV30].MaxAppsOptedIn
}
for appHolderApps := 0; appHolderApps < maxAppsOptedIn; appHolderApps++ {
ls := AppLocalState{
KeyValue: maxLocalState,
Schema: maxStateSchema,
}
ad.AppLocalStates[AppIndex(0x1234123412341234-appHolderApps)] = ls
}

encoded := ad.MarshalMsg(nil)
require.GreaterOrEqual(t, MaxEncodedAccountDataSize, len(encoded))
}

func TestEncodedAccountAllocationBounds(t *testing.T) {
partitiontest.PartitionTest(t)

Expand Down
38 changes: 28 additions & 10 deletions ledger/accountdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"math"
"strings"
"time"

Expand Down Expand Up @@ -372,6 +373,14 @@ const (
catchpointStateCatchpointLookback = catchpointState("catchpointLookback")
)

// MaxEncodedBaseAccountDataSize is a rough estimate for the worst-case scenario we're going to have of the base account data serialized.
// this number is verified by the TestEncodedBaseAccountDataSize function.
const MaxEncodedBaseAccountDataSize = 350

// MaxEncodedBaseResourceDataSize is a rough estimate for the worst-case scenario we're going to have of the base resource data serialized.
// this number is verified by the TestEncodedBaseResourceSize function.
const MaxEncodedBaseResourceDataSize = 20000

// normalizedAccountBalance is a staging area for a catchpoint file account information before it's being added to the catchpoint staging tables.
type normalizedAccountBalance struct {
// The public key address to which the account belongs.
Expand Down Expand Up @@ -2250,13 +2259,24 @@ func performTxTailTableMigration(ctx context.Context, tx *sql.Tx, blockDb db.Acc
return fmt.Errorf("latest block header %d cannot be retrieved : %w", dbRound, err)
}

maxTxnLife := basics.Round(config.Consensus[latestHdr.CurrentProtocol].MaxTxnLife)
deeperBlockHistory := basics.Round(config.Consensus[latestHdr.CurrentProtocol].DeeperBlockHeaderHistory)
firstRound := (latestBlockRound + 1).SubSaturate(maxTxnLife + deeperBlockHistory)
proto := config.Consensus[latestHdr.CurrentProtocol]
maxTxnLife := basics.Round(proto.MaxTxnLife)
deeperBlockHistory := basics.Round(proto.DeeperBlockHeaderHistory)
// firstRound is either maxTxnLife + deeperBlockHistory back from the latest for regular init
// or maxTxnLife + deeperBlockHistory + CatchpointLookback back for catchpoint apply.
// Try to check the earliest available and start from there.
firstRound := (latestBlockRound + 1).SubSaturate(maxTxnLife + deeperBlockHistory + basics.Round(proto.CatchpointLookback))
// we don't need to have the txtail for round 0.
if firstRound == basics.Round(0) {
firstRound++
}
if _, err := blockGet(blockTx, firstRound); err != nil {
// looks like not catchpoint but a regular migration, start from maxTxnLife + deeperBlockHistory back
firstRound = (latestBlockRound + 1).SubSaturate(maxTxnLife + deeperBlockHistory)
if firstRound == basics.Round(0) {
firstRound++
}
}
tailRounds := make([][]byte, 0, maxTxnLife)
for rnd := firstRound; rnd <= dbRound; rnd++ {
blk, err := blockGet(blockTx, rnd)
Expand Down Expand Up @@ -4403,18 +4423,16 @@ type orderedAccountsIter struct {
pendingBaseRow pendingBaseRow
pendingResourceRow pendingResourceRow
accountCount int
resourceCount int
insertStmt *sql.Stmt
}

// makeOrderedAccountsIter creates an ordered account iterator. Note that due to implementation reasons,
// only a single iterator can be active at a time.
func makeOrderedAccountsIter(tx *sql.Tx, accountCount int, resourceCount int) *orderedAccountsIter {
func makeOrderedAccountsIter(tx *sql.Tx, accountCount int) *orderedAccountsIter {
return &orderedAccountsIter{
tx: tx,
accountCount: accountCount,
resourceCount: resourceCount,
step: oaiStepStartup,
tx: tx,
accountCount: accountCount,
step: oaiStepStartup,
}
}

Expand Down Expand Up @@ -4812,7 +4830,7 @@ func (iterator *orderedAccountsIter) Next(ctx context.Context) (acct []accountAd
count, iterator.pendingBaseRow, iterator.pendingResourceRow, err = processAllBaseAccountRecords(
iterator.accountBaseRows, iterator.resourcesRows,
baseCb, resCb,
iterator.pendingBaseRow, iterator.pendingResourceRow, iterator.accountCount, iterator.resourceCount,
iterator.pendingBaseRow, iterator.pendingResourceRow, iterator.accountCount, math.MaxInt,
)
if err != nil {
iterator.Close(ctx)
Expand Down
120 changes: 120 additions & 0 deletions ledger/accountdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"math/rand"
"os"
"reflect"
Expand Down Expand Up @@ -4589,3 +4590,122 @@ func TestRemoveOfflineStateProofID(t *testing.T) {
}
}
}

func TestEncodedBaseAccountDataSize(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

vd := baseVotingData{
VoteFirstValid: basics.Round(crypto.RandUint64()),
VoteLastValid: basics.Round(crypto.RandUint64()),
VoteKeyDilution: crypto.RandUint64(),
}
crypto.RandBytes(vd.VoteID[:])
crypto.RandBytes(vd.StateProofID[:])
crypto.RandBytes(vd.SelectionID[:])

baseAD := baseAccountData{
Status: basics.Online,
MicroAlgos: basics.MicroAlgos{Raw: crypto.RandUint64()},
RewardsBase: crypto.RandUint64(),
RewardedMicroAlgos: basics.MicroAlgos{Raw: crypto.RandUint64()},
AuthAddr: ledgertesting.RandomAddress(),
TotalAppSchemaNumUint: crypto.RandUint64(),
TotalAppSchemaNumByteSlice: crypto.RandUint64(),
TotalExtraAppPages: uint32(crypto.RandUint63() % uint64(math.MaxUint32)),
TotalAssetParams: crypto.RandUint64(),
TotalAssets: crypto.RandUint64(),
TotalAppParams: crypto.RandUint64(),
TotalAppLocalStates: crypto.RandUint64(),
baseVotingData: vd,
UpdateRound: crypto.RandUint64(),
}

encoded := baseAD.MarshalMsg(nil)
require.GreaterOrEqual(t, MaxEncodedBaseAccountDataSize, len(encoded))
}

func TestEncodedBaseResourceSize(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

currentConsensusParams := config.Consensus[protocol.ConsensusCurrentVersion]

// resourcesData is suiteable for keeping asset params, holding, app params, app local state
// but only asset + holding or app + local state can appear there
rdAsset := resourcesData{
Total: crypto.RandUint64(),
Decimals: uint32(crypto.RandUint63() % uint64(math.MaxUint32)),
DefaultFrozen: true,
// MetadataHash
UnitName: makeString(currentConsensusParams.MaxAssetUnitNameBytes),
AssetName: makeString(currentConsensusParams.MaxAssetNameBytes),
URL: makeString(currentConsensusParams.MaxAssetURLBytes),
Manager: ledgertesting.RandomAddress(),
Reserve: ledgertesting.RandomAddress(),
Freeze: ledgertesting.RandomAddress(),
Clawback: ledgertesting.RandomAddress(),

Amount: crypto.RandUint64(),
Frozen: true,
}
crypto.RandBytes(rdAsset.MetadataHash[:])

rdApp := resourcesData{

SchemaNumUint: crypto.RandUint64(),
SchemaNumByteSlice: crypto.RandUint64(),
// KeyValue

// ApprovalProgram
// ClearStateProgram
// GlobalState
LocalStateSchemaNumUint: crypto.RandUint64(),
LocalStateSchemaNumByteSlice: crypto.RandUint64(),
GlobalStateSchemaNumUint: crypto.RandUint64(),
GlobalStateSchemaNumByteSlice: crypto.RandUint64(),
ExtraProgramPages: uint32(crypto.RandUint63() % uint64(math.MaxUint32)),

ResourceFlags: 255,
UpdateRound: crypto.RandUint64(),
}

// MaxAvailableAppProgramLen is conbined size of approval and clear state since it is bound by proto.MaxAppTotalProgramLen
rdApp.ApprovalProgram = make([]byte, config.MaxAvailableAppProgramLen/2)
crypto.RandBytes(rdApp.ApprovalProgram)
rdApp.ClearStateProgram = make([]byte, config.MaxAvailableAppProgramLen/2)
crypto.RandBytes(rdApp.ClearStateProgram)

maxGlobalState := make(basics.TealKeyValue, currentConsensusParams.MaxGlobalSchemaEntries)
for globalKey := uint64(0); globalKey < currentConsensusParams.MaxGlobalSchemaEntries; globalKey++ {
prefix := fmt.Sprintf("%d|", globalKey)
padding := makeString(currentConsensusParams.MaxAppKeyLen - len(prefix))
maxKey := prefix + padding
maxValue := basics.TealValue{
Type: basics.TealBytesType,
Bytes: makeString(currentConsensusParams.MaxAppSumKeyValueLens - len(maxKey)),
}
maxGlobalState[maxKey] = maxValue
}

maxLocalState := make(basics.TealKeyValue, currentConsensusParams.MaxLocalSchemaEntries)
for localKey := uint64(0); localKey < currentConsensusParams.MaxLocalSchemaEntries; localKey++ {
prefix := fmt.Sprintf("%d|", localKey)
padding := makeString(currentConsensusParams.MaxAppKeyLen - len(prefix))
maxKey := prefix + padding
maxValue := basics.TealValue{
Type: basics.TealBytesType,
Bytes: makeString(currentConsensusParams.MaxAppSumKeyValueLens - len(maxKey)),
}
maxLocalState[maxKey] = maxValue
}

rdApp.GlobalState = maxGlobalState
rdApp.KeyValue = maxLocalState

encodedAsset := rdAsset.MarshalMsg(nil)
encodedApp := rdApp.MarshalMsg(nil)

require.Less(t, len(encodedAsset), len(encodedApp))
require.GreaterOrEqual(t, MaxEncodedBaseResourceDataSize, len(encodedApp))
}
6 changes: 3 additions & 3 deletions ledger/catchpointtracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func (ct *catchpointTracker) generateCatchpointData(ctx context.Context, account
start := time.Now()
ledgerGeneratecatchpointCount.Inc(nil)
err := ct.dbs.Rdb.Atomic(func(dbCtx context.Context, tx *sql.Tx) (err error) {
catchpointWriter, err = makeCatchpointWriter(ctx, catchpointDataFilePath, tx, DefaultMaxResourcesPerChunk)
catchpointWriter, err = makeCatchpointWriter(ctx, catchpointDataFilePath, tx, ResourcesPerCatchpointFileChunk)
if err != nil {
return
}
Expand Down Expand Up @@ -1527,7 +1527,7 @@ func (ct *catchpointTracker) accountsInitializeHashes(ctx context.Context, tx *s

if rootHash.IsZero() {
ct.log.Infof("accountsInitialize rebuilding merkle trie for round %d", rnd)
accountBuilderIt := makeOrderedAccountsIter(tx, trieRebuildAccountChunkSize, DefaultMaxResourcesPerChunk)
accountBuilderIt := makeOrderedAccountsIter(tx, trieRebuildAccountChunkSize)
defer accountBuilderIt.Close(ctx)
startTrieBuildTime := time.Now()
trieHashCount := 0
Expand All @@ -1552,7 +1552,7 @@ func (ct *catchpointTracker) accountsInitializeHashes(ctx context.Context, tx *s
return fmt.Errorf("accountsInitialize was unable to add changes to trie: %v", err)
}
if !added {
// we need to transalate the "addrid" into actual account address so that
// we need to translate the "addrid" into actual account address so that
// we can report the failure.
addr, err := lookupAccountAddressFromAddressID(ctx, tx, acct.addrid)
if err != nil {
Expand Down
Loading