Skip to content

Commit 1cfd8bb

Browse files
committed
Merge branch 'hotfix/2.3.4'
2 parents 511095d + 87dcbd5 commit 1cfd8bb

File tree

7 files changed

+280
-39
lines changed

7 files changed

+280
-39
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.3
1+
2.3.4

idb/postgres/postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ func (db *IndexerDb) CommitRoundAccounting(updates idb.RoundUpdates, round uint6
916916
// Create new account_asset, initialize a previously destroyed asset, or apply the balance delta.
917917
// Setting frozen is complicated for the no-op optin case. It should only be set to default-frozen when the
918918
// holding is deleted, otherwise it should be left as the original value.
919-
seta, err := tx.Prepare(`INSERT INTO account_asset (addr, assetid, amount, frozen, created_at, deleted) VALUES ($1, $2, $3, $4, $5, false) ON CONFLICT (addr, assetid) DO UPDATE SET amount = account_asset.amount + EXCLUDED.amount, frozen = (EXCLUDED.frozen AND account_asset.deleted) OR (account_asset.frozen AND NOT account_asset.deleted), deleted = false`)
919+
seta, err := tx.Prepare(`INSERT INTO account_asset (addr, assetid, amount, frozen, created_at, deleted) VALUES ($1, $2, $3, $4, $5, false) ON CONFLICT (addr, assetid) DO UPDATE SET amount = account_asset.amount + EXCLUDED.amount, frozen = (EXCLUDED.frozen AND coalesce(account_asset.deleted, false)) OR (account_asset.frozen AND NOT coalesce(account_asset.deleted, false)), deleted = false`)
920920
if err != nil {
921921
return fmt.Errorf("prepare set account_asset, %v", err)
922922
}

idb/postgres/postgres_migrations.go

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,13 @@ func updateAccounts(db *IndexerDb, specialAccounts idb.SpecialAccounts, accounts
10461046
numBatches, writeDuration)
10471047
}
10481048
}
1049+
} else {
1050+
// Delete assets created by `address`.
1051+
if accountData.additional != nil {
1052+
for assetID := range accountData.additional.asset {
1053+
delete(assetDataMap, assetID)
1054+
}
1055+
}
10491056
}
10501057
}
10511058
}
@@ -1083,40 +1090,43 @@ func updateAccounts(db *IndexerDb, specialAccounts idb.SpecialAccounts, accounts
10831090
func m7RewardsAndDatesPart2(db *IndexerDb, state *MigrationState) error {
10841091
db.log.Print("m7 account cumulative rewards migration starting")
10851092

1086-
maxRound := uint32(state.NextRound)
1093+
// Skip the work if all accounts have previously been updated.
1094+
if (state.PointerRound == nil) || (*state.PointerRound != 0) || (*state.PointerIntra != 0) {
1095+
maxRound := uint32(state.NextRound)
10871096

1088-
// Get the number of accounts to potentially warn the user about high memory usage.
1089-
err := warnUser(db, maxRound)
1090-
if err != nil {
1091-
return err
1092-
}
1093-
// Get special accounts, so that we can ignore them throughout the migration. A later migration
1094-
// handles them.
1095-
specialAccounts, err := db.GetSpecialAccounts()
1096-
if err != nil {
1097-
return fmt.Errorf("m7: unable to get special accounts: %v", err)
1098-
}
1099-
// Get the transaction id that created each account. This function simple loops over all
1100-
// transactions from rounds <= `maxRound` in arbitrary order.
1101-
accountsFirstUsed, err := getAccountsFirstUsed(db, maxRound, specialAccounts)
1102-
if err != nil {
1103-
return err
1104-
}
1105-
// Get account data for accounts without transactions such as genesis accounts.
1106-
// This function reads the `account` table but only considers accounts created before or at
1107-
// `maxRound`.
1108-
readyAccountData, err := getAccountsWithoutTxnData(
1109-
db, maxRound, specialAccounts, accountsFirstUsed)
1110-
if err != nil {
1111-
return err
1112-
}
1113-
// Finally, read all accounts from most recent to oldest, update rewards and create/close dates,
1114-
// and write this account data to the database. To save memory, this function removes account's
1115-
// data as soon as we reach the transaction that created this account at which point older
1116-
// transactions cannot update its state. It writes account data to the database in batches.
1117-
err = updateAccounts(db, specialAccounts, accountsFirstUsed, readyAccountData, state)
1118-
if err != nil {
1119-
return err
1097+
// Get the number of accounts to potentially warn the user about high memory usage.
1098+
err := warnUser(db, maxRound)
1099+
if err != nil {
1100+
return err
1101+
}
1102+
// Get special accounts, so that we can ignore them throughout the migration. A later migration
1103+
// handles them.
1104+
specialAccounts, err := db.GetSpecialAccounts()
1105+
if err != nil {
1106+
return fmt.Errorf("m7: unable to get special accounts: %v", err)
1107+
}
1108+
// Get the transaction id that created each account. This function simple loops over all
1109+
// transactions from rounds <= `maxRound` in arbitrary order.
1110+
accountsFirstUsed, err := getAccountsFirstUsed(db, maxRound, specialAccounts)
1111+
if err != nil {
1112+
return err
1113+
}
1114+
// Get account data for accounts without transactions such as genesis accounts.
1115+
// This function reads the `account` table but only considers accounts created before or at
1116+
// `maxRound`.
1117+
readyAccountData, err := getAccountsWithoutTxnData(
1118+
db, maxRound, specialAccounts, accountsFirstUsed)
1119+
if err != nil {
1120+
return err
1121+
}
1122+
// Finally, read all accounts from most recent to oldest, update rewards and create/close dates,
1123+
// and write this account data to the database. To save memory, this function removes account's
1124+
// data as soon as we reach the transaction that created this account at which point older
1125+
// transactions cannot update its state. It writes account data to the database in batches.
1126+
err = updateAccounts(db, specialAccounts, accountsFirstUsed, readyAccountData, state)
1127+
if err != nil {
1128+
return err
1129+
}
11201130
}
11211131

11221132
// Update migration state.
@@ -1125,7 +1135,7 @@ func m7RewardsAndDatesPart2(db *IndexerDb, state *MigrationState) error {
11251135
state.PointerRound = nil
11261136
state.PointerIntra = nil
11271137
migrationStateJSON := idb.JSONOneLine(state)
1128-
_, err = db.db.Exec(setMetastateUpsert, migrationMetastateKey, migrationStateJSON)
1138+
_, err := db.db.Exec(setMetastateUpsert, migrationMetastateKey, migrationStateJSON)
11291139
if err != nil {
11301140
return fmt.Errorf("m7: failed to write final migration state: %v", err)
11311141
}

misc/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def link(sourcepath, destpath):
9999
os.remove(destpath)
100100
os.link(sourcepath, destpath)
101101

102-
_tagpat = re.compile(r'tag:\s+([^,]+)')
102+
_tagpat = re.compile(r'tag:\s+([^,\n]+)')
103103

104104
def compile_version_opts(release_version=None, allow_mismatch=False):
105105
result = subprocess.run(['git', 'log', '-n', '1', '--pretty=%H %D'], stdout=subprocess.PIPE)

types/protocols.json

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"MinUpgradeWaitRounds": 10000,
6464
"NextCommitteeSize": 5000,
6565
"NextCommitteeThreshold": 3838,
66+
"NoEmptyLocalDeltas": true,
6667
"NumProposers": 20,
6768
"PaysetCommit": 2,
6869
"PendingResidueRewards": true,
@@ -155,6 +156,7 @@
155156
"MinUpgradeWaitRounds": 0,
156157
"NextCommitteeSize": 5000,
157158
"NextCommitteeThreshold": 3838,
159+
"NoEmptyLocalDeltas": false,
158160
"NumProposers": 20,
159161
"PaysetCommit": 1,
160162
"PendingResidueRewards": false,
@@ -247,6 +249,7 @@
247249
"MinUpgradeWaitRounds": 0,
248250
"NextCommitteeSize": 5000,
249251
"NextCommitteeThreshold": 3838,
252+
"NoEmptyLocalDeltas": false,
250253
"NumProposers": 20,
251254
"PaysetCommit": 1,
252255
"PendingResidueRewards": false,
@@ -339,6 +342,7 @@
339342
"MinUpgradeWaitRounds": 0,
340343
"NextCommitteeSize": 5000,
341344
"NextCommitteeThreshold": 3838,
345+
"NoEmptyLocalDeltas": false,
342346
"NumProposers": 20,
343347
"PaysetCommit": 1,
344348
"PendingResidueRewards": false,
@@ -431,6 +435,7 @@
431435
"MinUpgradeWaitRounds": 0,
432436
"NextCommitteeSize": 5000,
433437
"NextCommitteeThreshold": 3838,
438+
"NoEmptyLocalDeltas": false,
434439
"NumProposers": 20,
435440
"PaysetCommit": 1,
436441
"PendingResidueRewards": false,
@@ -523,6 +528,7 @@
523528
"MinUpgradeWaitRounds": 0,
524529
"NextCommitteeSize": 5000,
525530
"NextCommitteeThreshold": 3838,
531+
"NoEmptyLocalDeltas": false,
526532
"NumProposers": 20,
527533
"PaysetCommit": 1,
528534
"PendingResidueRewards": true,
@@ -615,6 +621,7 @@
615621
"MinUpgradeWaitRounds": 10000,
616622
"NextCommitteeSize": 5000,
617623
"NextCommitteeThreshold": 3838,
624+
"NoEmptyLocalDeltas": false,
618625
"NumProposers": 20,
619626
"PaysetCommit": 1,
620627
"PendingResidueRewards": true,
@@ -707,6 +714,7 @@
707714
"MinUpgradeWaitRounds": 0,
708715
"NextCommitteeSize": 5000,
709716
"NextCommitteeThreshold": 3838,
717+
"NoEmptyLocalDeltas": false,
710718
"NumProposers": 20,
711719
"PaysetCommit": 1,
712720
"PendingResidueRewards": true,
@@ -799,6 +807,7 @@
799807
"MinUpgradeWaitRounds": 0,
800808
"NextCommitteeSize": 5000,
801809
"NextCommitteeThreshold": 3838,
810+
"NoEmptyLocalDeltas": false,
802811
"NumProposers": 20,
803812
"PaysetCommit": 1,
804813
"PendingResidueRewards": false,
@@ -891,6 +900,7 @@
891900
"MinUpgradeWaitRounds": 10000,
892901
"NextCommitteeSize": 5000,
893902
"NextCommitteeThreshold": 3838,
903+
"NoEmptyLocalDeltas": false,
894904
"NumProposers": 20,
895905
"PaysetCommit": 1,
896906
"PendingResidueRewards": true,
@@ -983,6 +993,7 @@
983993
"MinUpgradeWaitRounds": 0,
984994
"NextCommitteeSize": 5000,
985995
"NextCommitteeThreshold": 3838,
996+
"NoEmptyLocalDeltas": false,
986997
"NumProposers": 20,
987998
"PaysetCommit": 1,
988999
"PendingResidueRewards": true,
@@ -1075,6 +1086,7 @@
10751086
"MinUpgradeWaitRounds": 0,
10761087
"NextCommitteeSize": 5000,
10771088
"NextCommitteeThreshold": 3838,
1089+
"NoEmptyLocalDeltas": false,
10781090
"NumProposers": 20,
10791091
"PaysetCommit": 1,
10801092
"PendingResidueRewards": true,
@@ -1108,7 +1120,9 @@
11081120
"AppFlatParamsMinBalance": 100000,
11091121
"Application": true,
11101122
"ApplyData": true,
1111-
"ApprovedUpgrades": {},
1123+
"ApprovedUpgrades": {
1124+
"https://github.com/algorandfoundation/specs/tree/d050b3cade6d5c664df8bd729bf219f179812595": 60000
1125+
},
11121126
"Asset": true,
11131127
"CertCommitteeSize": 1500,
11141128
"CertCommitteeThreshold": 1112,
@@ -1165,6 +1179,7 @@
11651179
"MinUpgradeWaitRounds": 10000,
11661180
"NextCommitteeSize": 5000,
11671181
"NextCommitteeThreshold": 3838,
1182+
"NoEmptyLocalDeltas": false,
11681183
"NumProposers": 20,
11691184
"PaysetCommit": 2,
11701185
"PendingResidueRewards": true,
@@ -1257,6 +1272,7 @@
12571272
"MinUpgradeWaitRounds": 10000,
12581273
"NextCommitteeSize": 5000,
12591274
"NextCommitteeThreshold": 3838,
1275+
"NoEmptyLocalDeltas": false,
12601276
"NumProposers": 20,
12611277
"PaysetCommit": 1,
12621278
"PendingResidueRewards": true,
@@ -1283,6 +1299,97 @@
12831299
"UpgradeThreshold": 9000,
12841300
"UpgradeVoteRounds": 10000
12851301
},
1302+
"https://github.com/algorandfoundation/specs/tree/d050b3cade6d5c664df8bd729bf219f179812595": {
1303+
"AgreementFilterTimeout": 4000000000,
1304+
"AgreementFilterTimeoutPeriod0": 4000000000,
1305+
"AppFlatOptInMinBalance": 100000,
1306+
"AppFlatParamsMinBalance": 100000,
1307+
"Application": true,
1308+
"ApplyData": true,
1309+
"ApprovedUpgrades": {},
1310+
"Asset": true,
1311+
"CertCommitteeSize": 1500,
1312+
"CertCommitteeThreshold": 1112,
1313+
"CompactCertRounds": 0,
1314+
"CompactCertSecKQ": 0,
1315+
"CompactCertTopVoters": 0,
1316+
"CompactCertVotersLookback": 0,
1317+
"CompactCertWeightThreshold": 0,
1318+
"CredentialDomainSeparationEnabled": true,
1319+
"DefaultKeyDilution": 10000,
1320+
"DefaultUpgradeWaitRounds": 140000,
1321+
"DownCommitteeSize": 6000,
1322+
"DownCommitteeThreshold": 4560,
1323+
"EnableAssetCloseAmount": true,
1324+
"FastPartitionRecovery": true,
1325+
"FastRecoveryLambda": 300000000000,
1326+
"FixTransactionLeases": true,
1327+
"ForceNonParticipatingFeeSink": true,
1328+
"InitialRewardsRateCalculation": true,
1329+
"LateCommitteeSize": 500,
1330+
"LateCommitteeThreshold": 320,
1331+
"LogicSigMaxCost": 20000,
1332+
"LogicSigMaxSize": 1000,
1333+
"LogicSigVersion": 3,
1334+
"MaxAppArgs": 16,
1335+
"MaxAppBytesValueLen": 64,
1336+
"MaxAppKeyLen": 64,
1337+
"MaxAppProgramCost": 700,
1338+
"MaxAppProgramLen": 1024,
1339+
"MaxAppTotalArgLen": 2048,
1340+
"MaxAppTxnAccounts": 4,
1341+
"MaxAppTxnForeignApps": 2,
1342+
"MaxAppTxnForeignAssets": 2,
1343+
"MaxAppsCreated": 10,
1344+
"MaxAppsOptedIn": 10,
1345+
"MaxAssetDecimals": 19,
1346+
"MaxAssetNameBytes": 32,
1347+
"MaxAssetURLBytes": 32,
1348+
"MaxAssetUnitNameBytes": 8,
1349+
"MaxAssetsPerAccount": 1000,
1350+
"MaxBalLookback": 320,
1351+
"MaxGlobalSchemaEntries": 64,
1352+
"MaxLocalSchemaEntries": 16,
1353+
"MaxTimestampIncrement": 25,
1354+
"MaxTxGroupSize": 16,
1355+
"MaxTxnBytesPerBlock": 1000000,
1356+
"MaxTxnLife": 1000,
1357+
"MaxTxnNoteBytes": 1024,
1358+
"MaxUpgradeWaitRounds": 150000,
1359+
"MaxVersionStringLen": 128,
1360+
"MaximumMinimumBalance": 100100000,
1361+
"MinBalance": 100000,
1362+
"MinTxnFee": 1000,
1363+
"MinUpgradeWaitRounds": 10000,
1364+
"NextCommitteeSize": 5000,
1365+
"NextCommitteeThreshold": 3838,
1366+
"NoEmptyLocalDeltas": true,
1367+
"NumProposers": 20,
1368+
"PaysetCommit": 2,
1369+
"PendingResidueRewards": true,
1370+
"RedoCommitteeSize": 2400,
1371+
"RedoCommitteeThreshold": 1768,
1372+
"RequireGenesisHash": true,
1373+
"RewardUnit": 1000000,
1374+
"RewardsInApplyData": true,
1375+
"RewardsRateRefreshInterval": 500000,
1376+
"SchemaBytesMinBalance": 25000,
1377+
"SchemaMinBalancePerEntry": 25000,
1378+
"SchemaUintMinBalance": 3500,
1379+
"SeedLookback": 2,
1380+
"SeedRefreshInterval": 80,
1381+
"SoftCommitteeSize": 2990,
1382+
"SoftCommitteeThreshold": 2267,
1383+
"SupportBecomeNonParticipatingTransactions": true,
1384+
"SupportGenesisHash": true,
1385+
"SupportRekeying": true,
1386+
"SupportSignedTxnInBlock": true,
1387+
"SupportTransactionLeases": true,
1388+
"SupportTxGroups": true,
1389+
"TxnCounter": true,
1390+
"UpgradeThreshold": 9000,
1391+
"UpgradeVoteRounds": 10000
1392+
},
12861393
"https://github.com/algorandfoundation/specs/tree/e5f565421d720c6f75cdd186f7098495caf9101f": {
12871394
"AgreementFilterTimeout": 4000000000,
12881395
"AgreementFilterTimeoutPeriod0": 4000000000,
@@ -1349,6 +1456,7 @@
13491456
"MinUpgradeWaitRounds": 10000,
13501457
"NextCommitteeSize": 5000,
13511458
"NextCommitteeThreshold": 3838,
1459+
"NoEmptyLocalDeltas": false,
13521460
"NumProposers": 20,
13531461
"PaysetCommit": 1,
13541462
"PendingResidueRewards": true,
@@ -1441,6 +1549,7 @@
14411549
"MinUpgradeWaitRounds": 0,
14421550
"NextCommitteeSize": 5000,
14431551
"NextCommitteeThreshold": 3838,
1552+
"NoEmptyLocalDeltas": false,
14441553
"NumProposers": 20,
14451554
"PaysetCommit": 0,
14461555
"PendingResidueRewards": false,
@@ -1533,6 +1642,7 @@
15331642
"MinUpgradeWaitRounds": 0,
15341643
"NextCommitteeSize": 5000,
15351644
"NextCommitteeThreshold": 3838,
1645+
"NoEmptyLocalDeltas": false,
15361646
"NumProposers": 20,
15371647
"PaysetCommit": 1,
15381648
"PendingResidueRewards": false,
@@ -1625,6 +1735,7 @@
16251735
"MinUpgradeWaitRounds": 0,
16261736
"NextCommitteeSize": 5000,
16271737
"NextCommitteeThreshold": 3838,
1738+
"NoEmptyLocalDeltas": false,
16281739
"NumProposers": 20,
16291740
"PaysetCommit": 1,
16301741
"PendingResidueRewards": false,
@@ -1717,6 +1828,7 @@
17171828
"MinUpgradeWaitRounds": 0,
17181829
"NextCommitteeSize": 10000,
17191830
"NextCommitteeThreshold": 7750,
1831+
"NoEmptyLocalDeltas": false,
17201832
"NumProposers": 30,
17211833
"PaysetCommit": 0,
17221834
"PendingResidueRewards": false,
@@ -1809,6 +1921,7 @@
18091921
"MinUpgradeWaitRounds": 0,
18101922
"NextCommitteeSize": 5000,
18111923
"NextCommitteeThreshold": 3838,
1924+
"NoEmptyLocalDeltas": false,
18121925
"NumProposers": 9,
18131926
"PaysetCommit": 0,
18141927
"PendingResidueRewards": false,
@@ -1901,6 +2014,7 @@
19012014
"MinUpgradeWaitRounds": 0,
19022015
"NextCommitteeSize": 5000,
19032016
"NextCommitteeThreshold": 3838,
2017+
"NoEmptyLocalDeltas": false,
19042018
"NumProposers": 9,
19052019
"PaysetCommit": 0,
19062020
"PendingResidueRewards": false,

0 commit comments

Comments
 (0)