From 58295d772db5ffbb7bf055aed4b1747216630b97 Mon Sep 17 00:00:00 2001 From: superzordon Date: Sat, 25 Mar 2023 18:21:38 -0400 Subject: [PATCH 01/10] Update types and n0_test params --- cmd/run.go | 4 ++++ scripts/nodes/n0_test | 2 ++ scripts/tools/clear_ancestral_records.go | 2 +- scripts/tools/compute_db_checksum.go | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index aeac0335..e5c40775 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -168,6 +168,10 @@ func init() { // Tag transaction with node source runCmd.PersistentFlags().Uint64("node-source", 0, "Node ID to tag transaction with. Maps to ../core/lib/nodes.go") + // State syncer + runCmd.PersistentFlags().String("state-change-file-path", "", "Path to state syncer file") + runCmd.PersistentFlags().String("state-change-index-file-path", "", "Path to state syncer file") + // Public keys that need their balances monitored. Map of Label to Public key runCmd.PersistentFlags().String("public-key-balances-to-monitor", "", "Comma-separated string of 'label=publicKey'. These balances of the public key provided will be logged in DataDog with the label provided.") diff --git a/scripts/nodes/n0_test b/scripts/nodes/n0_test index fb9f8855..a1b2f7e6 100755 --- a/scripts/nodes/n0_test +++ b/scripts/nodes/n0_test @@ -36,6 +36,8 @@ rm /tmp/main.*.log --block-producer-seed='essence camp ghost remove document vault ladder swim pupil index apart ring' \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ --data-dir=/tmp/n0_test_00000 \ + --state-change-file-path=/tmp/state-changes \ + --state-change-index-file-path=/tmp/state-changes-index \ --access-control-allow-origins=http://localhost:4200,http://localhost:80,http://localhost:18002,http://localhost:4201,http://localhost:18001 \ --secure-header-allow-hosts=localhost:4200 \ --secure-header-development=true \ diff --git a/scripts/tools/clear_ancestral_records.go b/scripts/tools/clear_ancestral_records.go index cf7a9edb..775d8688 100644 --- a/scripts/tools/clear_ancestral_records.go +++ b/scripts/tools/clear_ancestral_records.go @@ -16,7 +16,7 @@ func main() { fmt.Printf("Error reading db1 err: %v", err) return } - snap, err, _ := lib.NewSnapshot(db, dbDir, lib.SnapshotBlockHeightPeriod, false, false, &lib.DeSoMainnetParams, false) + snap, err, _ := lib.NewSnapshot(db, dbDir, lib.SnapshotBlockHeightPeriod, false, false, &lib.DeSoMainnetParams, false, nil) if err != nil { fmt.Printf("Error reading snap err: %v", err) return diff --git a/scripts/tools/compute_db_checksum.go b/scripts/tools/compute_db_checksum.go index 681b5c4b..ba8b9f3f 100644 --- a/scripts/tools/compute_db_checksum.go +++ b/scripts/tools/compute_db_checksum.go @@ -19,7 +19,7 @@ func main() { fmt.Printf("Error reading db1 err: %v", err) return } - snap, err, _ := lib.NewSnapshot(dbSnap, dirSnap, lib.SnapshotBlockHeightPeriod, false, false, &lib.DeSoMainnetParams, false) + snap, err, _ := lib.NewSnapshot(dbSnap, dirSnap, lib.SnapshotBlockHeightPeriod, false, false, &lib.DeSoMainnetParams, false, nil) if err != nil { fmt.Printf("Error reading snap err: %v", err) return From aca385bbd8ca2a34c3168a91300156b5f0dae8bb Mon Sep 17 00:00:00 2001 From: superzordon Date: Sat, 25 Mar 2023 19:58:16 -0400 Subject: [PATCH 02/10] Empty commit From 84d85b20c17763fd25428e11b032e59096832489 Mon Sep 17 00:00:00 2001 From: superzordon Date: Thu, 30 Mar 2023 17:10:38 -0400 Subject: [PATCH 03/10] Updates to syncer --- scripts/nodes/n0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index 84289258..9d474a26 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -11,6 +11,8 @@ rm /tmp/main.*.log --num-mining-threads=1 \ --txindex=true \ --admin-public-keys=* \ + --state-change-file-path=/tmp/state-changes \ + --state-change-index-file-path=/tmp/state-changes-index \ --super-admin-public-keys=* \ --miner-public-keys=BC1YLgKZyfgyNntCMXAZYExM8JooYqrYvVsrR8d8XVxorDruYFdq31p \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ From e2d2ac7ddcbeee3723bdc5eb71650dfed25fe6cc Mon Sep 17 00:00:00 2001 From: superzordon Date: Mon, 3 Apr 2023 17:54:54 -0400 Subject: [PATCH 04/10] Updates to backend --- scripts/nodes/n0 | 3 ++- scripts/nodes/n0_test | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index 9d474a26..d9ef3c92 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -20,7 +20,8 @@ rm /tmp/main.*.log --block-cypher-api-key=092dae962ea44b02809a4c74408b42a1 \ --min-satoshis-for-profile=0 \ --connect-ips=deso-seed-2.io:17000 \ - --run-hot-feed-routine=true + --sync-type=hypersync \ + --run-hot-feed-routine=false ) # These are nodes that can be relied upon if the decentralized seed diff --git a/scripts/nodes/n0_test b/scripts/nodes/n0_test index a1b2f7e6..17495a4d 100755 --- a/scripts/nodes/n0_test +++ b/scripts/nodes/n0_test @@ -36,8 +36,8 @@ rm /tmp/main.*.log --block-producer-seed='essence camp ghost remove document vault ladder swim pupil index apart ring' \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ --data-dir=/tmp/n0_test_00000 \ - --state-change-file-path=/tmp/state-changes \ - --state-change-index-file-path=/tmp/state-changes-index \ + --state-change-file-path=/tmp/state-changes-test \ + --state-change-index-file-path=/tmp/state-changes-index-test \ --access-control-allow-origins=http://localhost:4200,http://localhost:80,http://localhost:18002,http://localhost:4201,http://localhost:18001 \ --secure-header-allow-hosts=localhost:4200 \ --secure-header-development=true \ From c41cedfe2699a53e1f7a1034ffb01b3ee088363e Mon Sep 17 00:00:00 2001 From: superzordon Date: Mon, 3 Apr 2023 22:44:15 -0400 Subject: [PATCH 05/10] Clean up state change file handling --- cmd/run.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/run.go b/cmd/run.go index e5c40775..e4ddeba1 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -170,7 +170,6 @@ func init() { // State syncer runCmd.PersistentFlags().String("state-change-file-path", "", "Path to state syncer file") - runCmd.PersistentFlags().String("state-change-index-file-path", "", "Path to state syncer file") // Public keys that need their balances monitored. Map of Label to Public key runCmd.PersistentFlags().String("public-key-balances-to-monitor", "", From 943d92f6cc1d9b056a5dd797b20a125baf198456 Mon Sep 17 00:00:00 2001 From: superzordon Date: Tue, 4 Apr 2023 18:23:29 -0400 Subject: [PATCH 06/10] Update n0 configs --- scripts/nodes/n0 | 1 - scripts/nodes/n0_test | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index d9ef3c92..de75541c 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -12,7 +12,6 @@ rm /tmp/main.*.log --txindex=true \ --admin-public-keys=* \ --state-change-file-path=/tmp/state-changes \ - --state-change-index-file-path=/tmp/state-changes-index \ --super-admin-public-keys=* \ --miner-public-keys=BC1YLgKZyfgyNntCMXAZYExM8JooYqrYvVsrR8d8XVxorDruYFdq31p \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ diff --git a/scripts/nodes/n0_test b/scripts/nodes/n0_test index 17495a4d..e7038307 100755 --- a/scripts/nodes/n0_test +++ b/scripts/nodes/n0_test @@ -37,7 +37,6 @@ rm /tmp/main.*.log --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ --data-dir=/tmp/n0_test_00000 \ --state-change-file-path=/tmp/state-changes-test \ - --state-change-index-file-path=/tmp/state-changes-index-test \ --access-control-allow-origins=http://localhost:4200,http://localhost:80,http://localhost:18002,http://localhost:4201,http://localhost:18001 \ --secure-header-allow-hosts=localhost:4200 \ --secure-header-development=true \ From 96fb7ef8f0c8f99f4a07a7c8b630ceab2d1735ab Mon Sep 17 00:00:00 2001 From: superzordon Date: Mon, 1 May 2023 15:58:28 -0400 Subject: [PATCH 07/10] Updates to node files --- routes/associations.go | 17 +++++++++-------- scripts/nodes/n0 | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/routes/associations.go b/routes/associations.go index 14c9f9b7..cf919564 100644 --- a/routes/associations.go +++ b/routes/associations.go @@ -31,14 +31,15 @@ const MaxAssociationValuesPerQueryLimit = 12 // ------------ type CreateUserAssociationRequest struct { - TransactorPublicKeyBase58Check string `safeForLogging:"true"` - TargetUserPublicKeyBase58Check string `safeForLogging:"true"` - AppPublicKeyBase58Check string `safeForLogging:"true"` - AssociationType string `safeForLogging:"true"` - AssociationValue string `safeForLogging:"true"` - ExtraData map[string]string `safeForLogging:"true"` - MinFeeRateNanosPerKB uint64 `safeForLogging:"true"` - TransactionFees []TransactionFee `safeForLogging:"true"` + TransactorPublicKeyBase58Check string `safeForLogging:"true"` + TargetUserPublicKeyBase58Check string `safeForLogging:"true"` + AppPublicKeyBase58Check string `safeForLogging:"true"` + AssociationType string `safeForLogging:"true"` + // blog-slug:introducing-the-deso-long-form-content-standard + AssociationValue string `safeForLogging:"true"` + ExtraData map[string]string `safeForLogging:"true"` + MinFeeRateNanosPerKB uint64 `safeForLogging:"true"` + TransactionFees []TransactionFee `safeForLogging:"true"` } type UserAssociationQuery struct { diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index de75541c..23db5737 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -11,7 +11,7 @@ rm /tmp/main.*.log --num-mining-threads=1 \ --txindex=true \ --admin-public-keys=* \ - --state-change-file-path=/tmp/state-changes \ + --state-change-file-path=/tmp/state-changes-2 \ --super-admin-public-keys=* \ --miner-public-keys=BC1YLgKZyfgyNntCMXAZYExM8JooYqrYvVsrR8d8XVxorDruYFdq31p \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ From b5fc30ada46cb8c62434bbb1af64297f76055913 Mon Sep 17 00:00:00 2001 From: superzordon Date: Tue, 27 Jun 2023 17:26:03 -0400 Subject: [PATCH 08/10] Updates --- scripts/nodes/n0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index 23db5737..de75541c 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -11,7 +11,7 @@ rm /tmp/main.*.log --num-mining-threads=1 \ --txindex=true \ --admin-public-keys=* \ - --state-change-file-path=/tmp/state-changes-2 \ + --state-change-file-path=/tmp/state-changes \ --super-admin-public-keys=* \ --miner-public-keys=BC1YLgKZyfgyNntCMXAZYExM8JooYqrYvVsrR8d8XVxorDruYFdq31p \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ From 145ec5ab0ae1ebd7e4093566f1e7bcf2b88f87fb Mon Sep 17 00:00:00 2001 From: superzordon Date: Tue, 8 Aug 2023 00:19:46 -0400 Subject: [PATCH 09/10] Reduce mempool time --- cmd/run.go | 2 +- routes/admin_fees.go | 4 ++-- routes/admin_jumio.go | 2 +- routes/admin_referrals.go | 14 +++++++------- routes/admin_tutorial.go | 2 +- routes/admin_user.go | 20 ++++++++++---------- routes/associations.go | 6 +++--- routes/dao_coin_exchange.go | 8 ++++---- routes/exchange.go | 2 +- routes/expose_global_state.go | 18 +++++++++--------- routes/global_state.go | 14 +++++++------- routes/hot_feed.go | 24 ++++++++++++------------ routes/nft.go | 4 ++-- routes/server.go | 10 +++++----- routes/transaction.go | 16 ++++++++-------- routes/tutorial.go | 4 ++-- routes/user.go | 10 +++++----- routes/verify.go | 6 +++--- scripts/nodes/n0 | 2 +- scripts/nodes/n0_test | 2 +- 20 files changed, 85 insertions(+), 85 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index e4ddeba1..af64c0e3 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -169,7 +169,7 @@ func init() { runCmd.PersistentFlags().Uint64("node-source", 0, "Node ID to tag transaction with. Maps to ../core/lib/nodes.go") // State syncer - runCmd.PersistentFlags().String("state-change-file-path", "", "Path to state syncer file") + runCmd.PersistentFlags().String("state-change-dir", "", "Path to state syncer directory containing the state change file and index files") // Public keys that need their balances monitored. Map of Label to Public key runCmd.PersistentFlags().String("public-key-balances-to-monitor", "", diff --git a/routes/admin_fees.go b/routes/admin_fees.go index 52eebe7f..f4d1f4f7 100644 --- a/routes/admin_fees.go +++ b/routes/admin_fees.go @@ -214,10 +214,10 @@ func (fes *APIServer) TxnFeeMapToResponse(skipProfileEntryResponses bool) map[st // Get the ProfileEntryResponse if we need it. Save it in the profileEntryResponseMap to expedite lookup // if we have duplicates. if !skipProfileEntryResponses && utxoView != nil { - // Get the PKID + // Get the PublicKey pkid := utxoView.GetPKIDForPublicKey(output.PublicKey) var exists bool - // Check if the PKID exists in the map + // Check if the PublicKey exists in the map profileEntryResponse, exists = profileEntryResponseMap[pkid.PKID] // If it doesn't exist, try to get the ProfileEntry and convert it to a response and save it in the map. if !exists { diff --git a/routes/admin_jumio.go b/routes/admin_jumio.go index adfe40dc..fc70cce1 100644 --- a/routes/admin_jumio.go +++ b/routes/admin_jumio.go @@ -66,7 +66,7 @@ func (fes *APIServer) AdminResetJumioForPublicKey(ww http.ResponseWriter, req *h pkid := utxoView.GetPKIDForPublicKey(userMetadata.PublicKey) if pkid == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminResetJumioForPublicKey: No PKID found for public key: %v", requestData.PublicKeyBase58Check)) + _AddBadRequestError(ww, fmt.Sprintf("AdminResetJumioForPublicKey: No PublicKey found for public key: %v", requestData.PublicKeyBase58Check)) return } prefix := GlobalStatePrefixforPKIDTstampnanosToJumioTransaction(pkid.PKID) diff --git a/routes/admin_referrals.go b/routes/admin_referrals.go index aa62fb8d..16be5cb5 100644 --- a/routes/admin_referrals.go +++ b/routes/admin_referrals.go @@ -193,7 +193,7 @@ func (fes *APIServer) AdminCreateReferralHash(ww http.ResponseWriter, req *http. userPublicKeyBytes = profile.PublicKey } - // Get the PKID for the pub key. + // Get the PublicKey for the pub key. utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() if err != nil { _AddBadRequestError(ww, fmt.Sprintf("AdminCreateReferralHash: Problem getting utxoView: %v", err)) @@ -202,7 +202,7 @@ func (fes *APIServer) AdminCreateReferralHash(ww http.ResponseWriter, req *http. referrerPKID := utxoView.GetPKIDForPublicKey(userPublicKeyBytes) if referrerPKID == nil { _AddBadRequestError(ww, fmt.Sprintf( - "AdminCreateReferralHash: nil PKID for pubkey: %v", lib.PkToString(userPublicKeyBytes, fes.Params))) + "AdminCreateReferralHash: nil PublicKey for pubkey: %v", lib.PkToString(userPublicKeyBytes, fes.Params))) return } @@ -294,7 +294,7 @@ func (fes *APIServer) AdminUpdateReferralHash(ww http.ResponseWriter, req *http. } // Make a copy of the referral info. Note that the referrerPKID is a pointer but it should - // be safe to leave them pointing to the same PKID in this endpoint. + // be safe to leave them pointing to the same PublicKey in this endpoint. updatedReferralInfo := &ReferralInfo{} *updatedReferralInfo = *referralInfo @@ -361,7 +361,7 @@ type AdminGetAllReferralInfoForUserResponse struct { func (fes *APIServer) getReferralInfoResponsesForPubKey(pkBytes []byte, includeReferredUsers bool, ) (_referralInfoResponses []ReferralInfoResponse, _err error) { - // Get the PKID for the pub key passed in. + // Get the PublicKey for the pub key passed in. utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() if err != nil { return nil, fmt.Errorf("putReferralHashWithInfo: Problem getting utxoView: %v", err) @@ -369,10 +369,10 @@ func (fes *APIServer) getReferralInfoResponsesForPubKey(pkBytes []byte, includeR referrerPKID := utxoView.GetPKIDForPublicKey(pkBytes) if referrerPKID == nil { return nil, fmt.Errorf( - "putReferralHashWithInfo: nil PKID for pubkey: %v", lib.PkToString(pkBytes, fes.Params)) + "putReferralHashWithInfo: nil PublicKey for pubkey: %v", lib.PkToString(pkBytes, fes.Params)) } - // Build a key to seek all of the referral hashes for this PKID. + // Build a key to seek all of the referral hashes for this PublicKey. dbSeekKey := GlobalStateSeekKeyForPKIDReferralHashes(referrerPKID.PKID) keysFound, valsFound, err := fes.GlobalState.Seek( dbSeekKey, dbSeekKey, 0, 0, false /*reverse*/, true /*fetchValue*/) @@ -670,7 +670,7 @@ func (fes *APIServer) updateOrCreateReferralInfoFromCSVRow(row []string) (_err e referralInfo = *existingReferralInfo } - // Decode and fill the PKID. + // Decode and fill the PublicKey. var err error pkBytes, _, err := lib.Base58CheckDecode(row[CSVColumnPKID]) if err != nil || len(pkBytes) != btcec.PubKeyBytesLenCompressed { diff --git a/routes/admin_tutorial.go b/routes/admin_tutorial.go index ccb0e1bd..7bcd7039 100644 --- a/routes/admin_tutorial.go +++ b/routes/admin_tutorial.go @@ -47,7 +47,7 @@ func (fes *APIServer) AdminUpdateTutorialCreator(ww http.ResponseWriter, req *ht pkid := utxoView.GetPKIDForPublicKey(userMetadata.PublicKey) if pkid == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminUpdateTutorialCreator: No PKID found for public key: %v", requestData.PublicKeyBase58Check)) + _AddBadRequestError(ww, fmt.Sprintf("AdminUpdateTutorialCreator: No PublicKey found for public key: %v", requestData.PublicKeyBase58Check)) return } var key []byte diff --git a/routes/admin_user.go b/routes/admin_user.go index f6948806..9cf6773b 100644 --- a/routes/admin_user.go +++ b/routes/admin_user.go @@ -482,8 +482,8 @@ func (fes *APIServer) UpdateUsernameVerificationAuditLog(usernameToVerify string return errors.Wrap(fmt.Errorf("UpdateUsernameVerificationAuditLog: Failed to decode verifier public key bytes"), "") } - // Get verifier's PKID and then get profile entry -- This is separated into two steps since we save the - // PKID in the VerificationUsernameAuditLog + // Get verifier's PublicKey and then get profile entry -- This is separated into two steps since we save the + // PublicKey in the VerificationUsernameAuditLog verifierPKID := utxoView.GetPKIDForPublicKey(verifierPublicKeyBytes) verifierProfileEntry := utxoView.GetProfileEntryForPKID(verifierPKID.PKID) verifierUsername := "" @@ -609,7 +609,7 @@ type VerifiedUsernameToPKID struct { type VerificationUsernameAuditLog struct { // Time at which the verification was granted or removed. TimestampNanos uint64 - // Username and PKID of the admin who verified the user. + // Username and PublicKey of the admin who verified the user. VerifierUsername string VerifierPKID *lib.PKID // The user who was verified or had their verification removed. @@ -633,7 +633,7 @@ type FilterAuditLog struct { TimestampNanos uint64 // The filter type being updated Filter FilterType - // Username and PKID of the admin who filtered the user. + // Username and PublicKey of the admin who filtered the user. UpdaterUsername string UpdaterPKID *lib.PKID // The user who was filtered or had their filter removed. @@ -690,7 +690,7 @@ func (fes *APIServer) AdminGrantVerificationBadge(ww http.ResponseWriter, req *h } pkidEntryToVerify := utxoView.GetPKIDForPublicKey(pubKey) if pkidEntryToVerify == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminGrantVerificationBadge: PKID not found for username: %s", usernameToVerify)) + _AddBadRequestError(ww, fmt.Sprintf("AdminGrantVerificationBadge: PublicKey not found for username: %s", usernameToVerify)) return } @@ -713,8 +713,8 @@ func (fes *APIServer) AdminGrantVerificationBadge(ww http.ResponseWriter, req *h _AddBadRequestError(ww, fmt.Sprintf("AdminGrantVerificationBadge: error updating audit log of username verification: %v", err)) return } - // Add username -> PKID mapping - // A username must map to a specific PKID, as someone could change their username + // Add username -> PublicKey mapping + // A username must map to a specific PublicKey, as someone could change their username // and impersonate someone else. For example: // @elonmusk changes his username to @jeffbezos // We verify the username still matches or else it would transfer over @@ -760,7 +760,7 @@ type AdminRemoveVerificationBadgeResponse struct { // AdminRemoveVerificationBadge // -// A valid verification mapping will have an element where map[PKID] = username. +// A valid verification mapping will have an element where map[PublicKey] = username. // If the public key still has the same username, the user is considered verified. // In order to "delete" a user efficiently, we simply map their public key to an empty string. // Since their public key can never have an underlying username of "", it will never show up as verified. @@ -795,7 +795,7 @@ func (fes *APIServer) AdminRemoveVerificationBadge(ww http.ResponseWriter, req * } pkidEntryToUnverify := utxoView.GetPKIDForPublicKey(pubKey) if pkidEntryToUnverify == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminRemoveVerificationBadge: PKID not found for username: %s", usernameToRemove)) + _AddBadRequestError(ww, fmt.Sprintf("AdminRemoveVerificationBadge: PublicKey not found for username: %s", usernameToRemove)) return } @@ -827,7 +827,7 @@ func (fes *APIServer) AdminRemoveVerificationBadge(ww http.ResponseWriter, req * return } - // We set the value for this username to an empty PKID to signify that it has been removed. + // We set the value for this username to an empty PublicKey to signify that it has been removed. verifiedMapStruct.VerifiedUsernameToPKID[strings.ToLower(usernameToRemove)] = &lib.ZeroPKID // Encode the updated entry and stick it in the database. diff --git a/routes/associations.go b/routes/associations.go index cf919564..307bddda 100644 --- a/routes/associations.go +++ b/routes/associations.go @@ -1302,7 +1302,7 @@ func (fes *APIServer) _parseAssociationQueryParams( if transactorPublicKeyBase58Check != "" { transactorPKID, err = fes.getPKIDFromPublicKeyBase58Check(utxoView, transactorPublicKeyBase58Check) if err != nil { - return nil, nil, nil, nil, errors.New("problem getting PKID for the transactor") + return nil, nil, nil, nil, errors.New("problem getting PublicKey for the transactor") } } @@ -1311,7 +1311,7 @@ func (fes *APIServer) _parseAssociationQueryParams( if targetUserPublicKeyBase58Check != "" { targetUserPKID, err = fes.getPKIDFromPublicKeyBase58Check(utxoView, targetUserPublicKeyBase58Check) if err != nil { - return nil, nil, nil, nil, errors.New("problem getting PKID for the target user") + return nil, nil, nil, nil, errors.New("problem getting PublicKey for the target user") } } @@ -1330,7 +1330,7 @@ func (fes *APIServer) _parseAssociationQueryParams( if appPublicKeyBase58Check != "" { appPKID, err = fes.getPKIDFromPublicKeyBase58Check(utxoView, appPublicKeyBase58Check) if err != nil { - return nil, nil, nil, nil, errors.New("problem getting PKID for the app") + return nil, nil, nil, nil, errors.New("problem getting PublicKey for the app") } } return transactorPKID, targetUserPKID, postHash, appPKID, nil diff --git a/routes/dao_coin_exchange.go b/routes/dao_coin_exchange.go index 090fee66..fd84a556 100644 --- a/routes/dao_coin_exchange.go +++ b/routes/dao_coin_exchange.go @@ -843,7 +843,7 @@ func (fes *APIServer) validateTransactorSellingCoinBalance( return errors.Errorf("Problem fetching UTXOView: %v", err) } - // Get transactor PKID and public key from public key base58 check. + // Get transactor PublicKey and public key from public key base58 check. transactorPKID, err := fes.getPKIDFromPublicKeyBase58Check( utxoView, transactorPublicKeyBase58Check) if err != nil { @@ -854,7 +854,7 @@ func (fes *APIServer) validateTransactorSellingCoinBalance( return errors.Errorf("Error decoding transactor public key: %v", err) } - // If buying $DESO, the buying PKID is the ZeroPKID. Else it's the DAO coin's PKID. + // If buying $DESO, the buying PublicKey is the ZeroPKID. Else it's the DAO coin's PublicKey. buyingCoinPKID := &lib.ZeroPKID if buyingDAOCoinCreatorPublicKeyBase58Check != DESOCoinIdentifierString { buyingCoinPKID, err = fes.getPKIDFromPublicKeyBase58Check( @@ -864,7 +864,7 @@ func (fes *APIServer) validateTransactorSellingCoinBalance( } } - // If selling $DESO, the selling PKID is the ZeroPKID. We consider this the default + // If selling $DESO, the selling PublicKey is the ZeroPKID. We consider this the default // case and update if the transactor is actually selling a DAO coin below. sellingCoinPKID := &lib.ZeroPKID @@ -878,7 +878,7 @@ func (fes *APIServer) validateTransactorSellingCoinBalance( } transactorSellingBalanceBaseUnits = uint256.NewInt().SetUint64(desoBalanceNanos) } else { - // Get selling coin PKID and public key from public key base58 check. + // Get selling coin PublicKey and public key from public key base58 check. sellingCoinPKID, err = fes.getPKIDFromPublicKeyBase58Check( utxoView, sellingDAOCoinCreatorPublicKeyBase58Check) if err != nil { diff --git a/routes/exchange.go b/routes/exchange.go index dd039b0e..975123a9 100644 --- a/routes/exchange.go +++ b/routes/exchange.go @@ -1624,7 +1624,7 @@ func (fes *APIServer) GetPostsForFollowFeedForPublicKey(bav *lib.UtxoView, start // the old logic. pubKeyForPKID := bav.GetPublicKeyForPKID(followEntry.FollowedPKID) if len(pubKeyForPKID) == 0 { - glog.Errorf("GetPostsForFollowFeedForPublicKey found PKID %v that "+ + glog.Errorf("GetPostsForFollowFeedForPublicKey found PublicKey %v that "+ "does not have public key mapping; this should never happen", lib.PkToString(followEntry.FollowedPKID[:], bav.Params)) continue diff --git a/routes/expose_global_state.go b/routes/expose_global_state.go index b03a50d4..90091c76 100644 --- a/routes/expose_global_state.go +++ b/routes/expose_global_state.go @@ -15,13 +15,13 @@ func (fes *APIServer) GetVerifiedUsernames(ww http.ResponseWriter, req *http.Req fes.WriteGlobalStateDataToResponse(fes.VerifiedUsernameToPKIDMap, "GetVerifiedUsernames", ww) } -// GetBlacklistedPublicKeys returns a map of PKID (as Base58 encoded string) to Blacklist state bytes if global state +// GetBlacklistedPublicKeys returns a map of PublicKey (as Base58 encoded string) to Blacklist state bytes if global state // is exposed. func (fes *APIServer) GetBlacklistedPublicKeys(ww http.ResponseWriter, req *http.Request) { fes.WriteGlobalStateDataToResponse(fes.BlacklistedResponseMap, "GetBlacklistedPublicKeys", ww) } -// GetGraylistedPublicKeys returns a map of PKID (as Base58 encoded string) to Graylist state bytes if global state +// GetGraylistedPublicKeys returns a map of PublicKey (as Base58 encoded string) to Graylist state bytes if global state // is exposed. func (fes *APIServer) GetGraylistedPublicKeys(ww http.ResponseWriter, req *http.Request) { fes.WriteGlobalStateDataToResponse(fes.GraylistedResponseMap, "GetGraylistedPublicKeys", ww) @@ -93,7 +93,7 @@ func (fes *APIServer) GetVerifiedUsernameMap() ( return verifiedUsernameMap, nil } -// GetBlacklist returns both a slice of strings and a map of PKID to []byte representing the current state of +// GetBlacklist returns both a slice of strings and a map of PublicKey to []byte representing the current state of // blacklisted users. func (fes *APIServer) GetBlacklist(utxoView *lib.UtxoView) ( _blacklistedPKIDMap map[lib.PKID][]byte, _err error, @@ -101,7 +101,7 @@ func (fes *APIServer) GetBlacklist(utxoView *lib.UtxoView) ( return fes.GetRestrictedPublicKeys(_GlobalStatePrefixPublicKeyToBlacklistState, utxoView, RoutePathGetBlacklistedPublicKeys) } -// GetGraylist returns both a slice of strings and a map of PKID to []byte representing the current state of graylisted +// GetGraylist returns both a slice of strings and a map of PublicKey to []byte representing the current state of graylisted // users. func (fes *APIServer) GetGraylist(utxoView *lib.UtxoView) ( _graylistedPKIDMap map[lib.PKID][]byte, _err error, @@ -109,7 +109,7 @@ func (fes *APIServer) GetGraylist(utxoView *lib.UtxoView) ( return fes.GetRestrictedPublicKeys(_GlobalStatePrefixPublicKeyToGraylistState, utxoView, RoutePathGetGraylistedPublicKeys) } -// GetUsernameBlacklist returns both a slice of strings and a map of PKID to []byte representing the current state of +// GetUsernameBlacklist returns both a slice of strings and a map of PublicKey to []byte representing the current state of // blacklisted users. func (fes *APIServer) GetUsernameBlacklist() ( _blacklistedUsernameMap map[string][]byte, _err error, @@ -117,7 +117,7 @@ func (fes *APIServer) GetUsernameBlacklist() ( return fes.GetRestrictedUsernames(_GlobalStatePrefixUsernameToBlacklistState, RoutePathGetBlacklistedUsernames) } -// GetUsernameGraylist returns both a slice of strings and a map of PKID to []byte representing the current state of +// GetUsernameGraylist returns both a slice of strings and a map of PublicKey to []byte representing the current state of // graylisted users. func (fes *APIServer) GetUsernameGraylist() ( _blacklistedUsernameMap map[string][]byte, _err error, @@ -126,7 +126,7 @@ func (fes *APIServer) GetUsernameGraylist() ( } // GetRestrictedPublicKeys fetches the blacklisted or graylisted public keys from the configured external global state -// (if available) and merges it with this node's global state. This returns a map of PKID to restricted bytes. +// (if available) and merges it with this node's global state. This returns a map of PublicKey to restricted bytes. func (fes *APIServer) GetRestrictedPublicKeys(prefix []byte, utxoView *lib.UtxoView, routePath string) ( _pkidMap map[lib.PKID][]byte, _err error, ) { @@ -138,8 +138,8 @@ func (fes *APIServer) GetRestrictedPublicKeys(prefix []byte, utxoView *lib.UtxoV if err != nil { return nil, err } - // Decode the response into the appropriate struct. To use json encoding, we had to convert PKID to a string - // so we'll need to convert back from string to PKID here. + // Decode the response into the appropriate struct. To use json encoding, we had to convert PublicKey to a string + // so we'll need to convert back from string to PublicKey here. stringifiedPKIDsMap := make(map[string][]byte) decoder := json.NewDecoder(bytes.NewReader(restrictedPublicKeyMapBytes)) if err = decoder.Decode(&stringifiedPKIDsMap); err != nil { diff --git a/routes/global_state.go b/routes/global_state.go index 88c88acc..7464a083 100644 --- a/routes/global_state.go +++ b/routes/global_state.go @@ -94,8 +94,8 @@ var ( _GlobalStatePrefixPhoneNumberToPhoneNumberMetadata = []byte{2} // The prefix for accessing the verified users map. - // The resulting map takes a username and returns a PKID. - // -> + // The resulting map takes a username and returns a PublicKey. + // -> _GlobalStatePrefixForVerifiedMap = []byte{3} // The prefix for accessing the pinned posts on the global feed: @@ -172,11 +172,11 @@ var ( // Referral program indexes. // - -> _GlobalStatePrefixReferralHashToReferralInfo = []byte{24} - // - -> + // - -> _GlobalStatePrefixPKIDReferralHashToIsActive = []byte{25} - // - -> @@ -207,7 +207,7 @@ var ( // This key is used in a similar way to the _GlobalStatePrefixForHotFeedApprovedPostOps // above except it is used to track changes to the HotFeedPKIDMultiplier map. - // -> + // -> _GlobalStatePrefixForHotFeedPKIDMultiplierOps = []byte{36} // This key is used to manage sign up bonus configurations for a country @@ -567,7 +567,7 @@ func GlobalStateKeyForHotFeedPKIDMultiplierOp( return key } -// Key for seeking the DB for all referral hashes with a specific PKID. +// Key for seeking the DB for all referral hashes with a specific PublicKey. func GlobalStateSeekKeyForPKIDReferralHashes(pkid *lib.PKID) []byte { prefixCopy := append([]byte{}, _GlobalStatePrefixPKIDReferralHashToIsActive...) key := append(prefixCopy, pkid[:]...) diff --git a/routes/hot_feed.go b/routes/hot_feed.go index 0f058b2e..c9b3ff8a 100644 --- a/routes/hot_feed.go +++ b/routes/hot_feed.go @@ -27,9 +27,9 @@ const ( DefaultHotFeedTimeDecayBlocks uint64 = 72 // Number of blocks per halving for the scoring time decay for a tag hot feed. DefaultHotFeedTagTimeDecayBlocks uint64 = 96 - // Maximum score amount that any individual PKID can contribute before time decay. + // Maximum score amount that any individual PublicKey can contribute before time decay. DefaultHotFeedInteractionCap uint64 = 4e12 - // Maximum score amount that any individual PKID can contribute before time decay for a particular tag grouping. + // Maximum score amount that any individual PublicKey can contribute before time decay for a particular tag grouping. DefaultHotFeedTagInteractionCap uint64 = 4e12 // How many iterations of the hot feed calculation until the built-up caches should be reset. (Once per day) ResetCachesIterationLimit int = 288 @@ -56,12 +56,12 @@ type HotFeedInteractionKey struct { InteractionPostHash lib.BlockHash } -// Multipliers to help a node operator boost content from PKID's relevant to their node. +// Multipliers to help a node operator boost content from PublicKey's relevant to their node. // For example, a sports-focused node could boost athlete PKIDs. type HotFeedPKIDMultiplier struct { // A multiplier applied to the score that each user interaction adds to a post. InteractionMultiplier float64 - // A multiplier applied to all posts from this specific PKID. + // A multiplier applied to all posts from this specific PublicKey. PostsMultiplier float64 } @@ -219,7 +219,7 @@ func (fes *APIServer) UpdateHotFeedPKIDMultipliersMap( // Chop up the keys and process each operation. for opIdx, opKey := range opKeys { - // Each key consists of: prefix, timestamp, PKID. + // Each key consists of: prefix, timestamp, PublicKey. timestampStartIdx := 1 pkidStartIdx := timestampStartIdx + 8 @@ -596,7 +596,7 @@ func (fes *APIServer) PopulateHotnessInfoMap( txnHotnessScore = uint64(multiplier * float64(txnHotnessScore)) } - // Check for PKID-specifc multipliers for the poster and the interactor. + // Check for PublicKey-specifc multipliers for the poster and the interactor. posterPKIDMultiplier, hasPosterPKIDMultiplier := pkidsToMultipliers[*posterPKID] if hasPosterPKIDMultiplier { txnHotnessScore = uint64( @@ -848,7 +848,7 @@ func GetPostHashToScoreForTxn(txn *lib.MsgDeSoTxn, } // Returns the post hash that a txn is relevant to and the amount that the txn should contribute -// to that post's hotness score. The postInteractionMap is used to ensure that each PKID only +// to that post's hotness score. The postInteractionMap is used to ensure that each PublicKey only // gets one interaction per post. func (fes *APIServer) GetHotnessScoreInfoForTxn( txn *lib.MsgDeSoTxn, @@ -1110,10 +1110,10 @@ func (fes *APIServer) HandleHotFeedPageRequest( } type AdminUpdateHotFeedAlgorithmRequest struct { - // Maximum score amount that any individual PKID can contribute to the global hot feed score + // Maximum score amount that any individual PublicKey can contribute to the global hot feed score // before time decay. Ignored if set to zero. InteractionCap int - // Maximum score amount that any individual PKID can contribute to a particular tag's hot feed score + // Maximum score amount that any individual PublicKey can contribute to a particular tag's hot feed score // before time decay. Ignored if set to zero. InteractionCapTag int // Number of blocks per halving for the global hot feed score time decay. Ignored if set to zero. @@ -1332,7 +1332,7 @@ func (fes *APIServer) AdminUpdateHotFeedUserMultiplier(ww http.ResponseWriter, r } pkidEntry := utxoView.GetPKIDForPublicKey(pubKey) if pkidEntry == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminUpdateHotFeedUserMultiplier: PKID not found for username: %s", requestData.Username)) + _AddBadRequestError(ww, fmt.Sprintf("AdminUpdateHotFeedUserMultiplier: PublicKey not found for username: %s", requestData.Username)) return } @@ -1401,11 +1401,11 @@ func (fes *APIServer) AdminGetHotFeedUserMultiplier(ww http.ResponseWriter, req } pkidEntry := utxoView.GetPKIDForPublicKey(pubKey) if pkidEntry == nil { - _AddBadRequestError(ww, fmt.Sprintf("AdminGetHotFeedUserMultiplier: PKID not found for username: %s", requestData.Username)) + _AddBadRequestError(ww, fmt.Sprintf("AdminGetHotFeedUserMultiplier: PublicKey not found for username: %s", requestData.Username)) return } - // Grab the current multiplier object for this PKID. + // Grab the current multiplier object for this PublicKey. hotFeedMultiplier := fes.HotFeedPKIDMultipliers[*pkidEntry.PKID] if hotFeedMultiplier == nil { hotFeedMultiplier = &HotFeedPKIDMultiplier{ diff --git a/routes/nft.go b/routes/nft.go index c6affae5..a4813314 100644 --- a/routes/nft.go +++ b/routes/nft.go @@ -188,7 +188,7 @@ func (fes *APIServer) CreateNFT(ww http.ResponseWriter, req *http.Request) { "CreateNFT: Problem decoding Additional Coin Royalty public key %s: %v", coinRoyaltyPublicKey, err)) return } - // PKID must map to an existing profile in order for us to give royalties to that coin + // PublicKey must map to an existing profile in order for us to give royalties to that coin profileEntry := utxoView.GetProfileEntryForPublicKey(additionalCoinRoyaltyPublicKeyBytes) if profileEntry == nil || profileEntry.IsDeleted() { _AddBadRequestError(ww, fmt.Sprintf( @@ -702,7 +702,7 @@ func (fes *APIServer) AcceptNFTBid(ww http.ResponseWriter, req *http.Request) { bidderPKID := utxoView.GetPKIDForPublicKey(bidderPublicKeyBytes) if bidderPKID == nil { _AddBadRequestError(ww, fmt.Sprintf( - "AcceptNFTBid: Error could not find PKID for bidder pub key %v", + "AcceptNFTBid: Error could not find PublicKey for bidder pub key %v", requestData.BidderPublicKeyBase58Check)) return } diff --git a/routes/server.go b/routes/server.go index 7a3be715..4f20d496 100644 --- a/routes/server.go +++ b/routes/server.go @@ -413,8 +413,8 @@ type APIServer struct { // VerifiedUsernameToPKIDMap is a map of lowercase usernames to PKIDs representing the current state of // verifications this node is recognizing. VerifiedUsernameToPKIDMap map[string]*lib.PKID - // BlacklistedPKIDMap is a map of PKID to a byte slice representing the PKID of a user as the key and the current - // blacklist state of that user as the key. If a PKID is not present in this map, then the user is NOT blacklisted. + // BlacklistedPKIDMap is a map of PublicKey to a byte slice representing the PublicKey of a user as the key and the current + // blacklist state of that user as the key. If a PublicKey is not present in this map, then the user is NOT blacklisted. BlacklistedPKIDMap map[lib.PKID][]byte // BlacklistedUsernameMap is a map of username to a byte slice representing the username of a user as the key and the current // blacklist state of that user as the key. If a username is not present in this map, then the username is NOT blacklisted. @@ -424,8 +424,8 @@ type APIServer struct { // responding to requests for this node's blacklist. A JSON-encoded response is easier for any language to digest // than a gob-encoded one. BlacklistedResponseMap map[string][]byte - // GraylistedPKIDMap is a map of PKID to a byte slice representing the PKID of a user as the key and the current - // graylist state of that user as the key. If a PKID is not present in this map, then the user is NOT graylisted. + // GraylistedPKIDMap is a map of PublicKey to a byte slice representing the PublicKey of a user as the key and the current + // graylist state of that user as the key. If a PublicKey is not present in this map, then the user is NOT graylisted. GraylistedPKIDMap map[lib.PKID][]byte // GraylistedUsernameMap is a map of username to a byte slice representing the username of a user as the key and the current // graylist state of that user as the key. If a username is not present in this map, then the username is NOT graylisted. @@ -2750,7 +2750,7 @@ func (fes *APIServer) SetGlobalFeedPostHashes(utxoView *lib.UtxoView) { } } -// makePKIDMapJSONEncodable converts a map that has PKID keys into Base58-encoded strings. +// makePKIDMapJSONEncodable converts a map that has PublicKey keys into Base58-encoded strings. // Using gob-encoding when sending responses would make using this API difficult to interact with when using any // language other than go. func (fes *APIServer) makePKIDMapJSONEncodable(restrictedKeysMap map[lib.PKID][]byte) map[string][]byte { diff --git a/routes/transaction.go b/routes/transaction.go index 43ee242a..ab47d2a8 100644 --- a/routes/transaction.go +++ b/routes/transaction.go @@ -1855,7 +1855,7 @@ func (fes *APIServer) BuyOrSellCreatorCoin(ww http.ResponseWriter, req *http.Req var updateUserMetadata bool // TODO: check that user is buying from list of creators included in tutorial - // TODO: Save which creator a user purchased by PKID in user metadata so we can bring them to the same place in the flow + // TODO: Save which creator a user purchased by PublicKey in user metadata so we can bring them to the same place in the flow // TODO: Do we need to save how much they bought for usage in tutorial? if operationType == lib.CreatorCoinOperationTypeBuy && (userMetadata.TutorialStatus == CREATE_PROFILE || userMetadata.TutorialStatus == STARTED) && requestData.CreatorPublicKeyBase58Check != requestData.UpdaterPublicKeyBase58Check { if reflect.DeepEqual(updaterPublicKeyBytes, creatorPublicKeyBytes) { @@ -1864,7 +1864,7 @@ func (fes *APIServer) BuyOrSellCreatorCoin(ww http.ResponseWriter, req *http.Req } creatorPKID := utxoView.GetPKIDForPublicKey(creatorPublicKeyBytes) if creatorPKID == nil { - _AddBadRequestError(ww, fmt.Sprintf("BuyOrSellCreatorCoin: No PKID found for public key: %v", requestData.CreatorPublicKeyBase58Check)) + _AddBadRequestError(ww, fmt.Sprintf("BuyOrSellCreatorCoin: No PublicKey found for public key: %v", requestData.CreatorPublicKeyBase58Check)) return } wellKnownVal, err := fes.GlobalState.Get(GlobalStateKeyWellKnownTutorialCreators(creatorPKID.PKID)) @@ -3426,7 +3426,7 @@ func TransactionSpendingLimitToResponse( } } - // Iterate over the CreatorCoinOperationLimitMap - convert PKID from key into base58Check public key, convert + // Iterate over the CreatorCoinOperationLimitMap - convert PublicKey from key into base58Check public key, convert // CreatorCoinLimitOperation to CreatorCoinLimitOperationString. Fill in the nested maps appropriately. if len(transactionSpendingLimit.CreatorCoinOperationLimitMap) > 0 { transactionSpendingLimitResponse.CreatorCoinOperationLimitMap = make( @@ -3446,7 +3446,7 @@ func TransactionSpendingLimitToResponse( } } - // Iterate over the DAOCoinOperationLimitMap - convert PKID from key into base58Check public key, convert + // Iterate over the DAOCoinOperationLimitMap - convert PublicKey from key into base58Check public key, convert // DAOCoinLimitOperation to DAOCoinLimitOperationString. Fill in the nested maps appropriately. if len(transactionSpendingLimit.DAOCoinOperationLimitMap) > 0 { transactionSpendingLimitResponse.DAOCoinOperationLimitMap = make( @@ -3492,7 +3492,7 @@ func TransactionSpendingLimitToResponse( } } - // Iterate over the DAOCoinLimitOrderLimitMap - convert PKID from key into base58Check public key. + // Iterate over the DAOCoinLimitOrderLimitMap - convert PublicKey from key into base58Check public key. // Fill in the nested maps appropriately. if len(transactionSpendingLimit.DAOCoinLimitOrderLimitMap) > 0 { transactionSpendingLimitResponse.DAOCoinLimitOrderLimitMap = make( @@ -3609,7 +3609,7 @@ func (fes *APIServer) TransactionSpendingLimitFromResponse( } pkid := utxoView.GetPKIDForPublicKey(pkBytes) if pkid == nil || pkid.PKID == nil { - return nil, fmt.Errorf("No PKID found for public key %v", pubKeyBase58Check) + return nil, fmt.Errorf("No PublicKey found for public key %v", pubKeyBase58Check) } creatorPKID = pkid.PKID } @@ -3621,7 +3621,7 @@ func (fes *APIServer) TransactionSpendingLimitFromResponse( for pubKey, operationToCountMap := range transactionSpendingLimitResponse.CreatorCoinOperationLimitMap { creatorPKID, err := getCreatorPKIDForBase58Check(pubKey) if err != nil { - return nil, fmt.Errorf("Error getting PKID for pub key %v", pubKey) + return nil, fmt.Errorf("Error getting PublicKey for pub key %v", pubKey) } for operation, count := range operationToCountMap { transactionSpendingLimit.CreatorCoinOperationLimitMap[lib.MakeCreatorCoinOperationLimitKey( @@ -3635,7 +3635,7 @@ func (fes *APIServer) TransactionSpendingLimitFromResponse( for pubKey, operationToCountMap := range transactionSpendingLimitResponse.DAOCoinOperationLimitMap { creatorPKID, err := getCreatorPKIDForBase58Check(pubKey) if err != nil { - return nil, fmt.Errorf("Error getting PKID for pub key %v", pubKey) + return nil, fmt.Errorf("Error getting PublicKey for pub key %v", pubKey) } for operation, count := range operationToCountMap { transactionSpendingLimit.DAOCoinOperationLimitMap[lib.MakeDAOCoinOperationLimitKey( diff --git a/routes/tutorial.go b/routes/tutorial.go index e335334b..5d403d9a 100644 --- a/routes/tutorial.go +++ b/routes/tutorial.go @@ -83,7 +83,7 @@ func (fes *APIServer) UpdateTutorialStatus(ww http.ResponseWriter, req *http.Req } pkid := utxoView.GetPKIDForPublicKey(CreatorPurchasedInTutorialPublicKeyBytes) if pkid == nil { - _AddBadRequestError(ww, fmt.Sprintf("UpdateTutorialStatus: No PKID found for public key: %v", requestData.CreatorPurchasedInTutorialPublicKey)) + _AddBadRequestError(ww, fmt.Sprintf("UpdateTutorialStatus: No PublicKey found for public key: %v", requestData.CreatorPurchasedInTutorialPublicKey)) return } userMetadata.CreatorPurchasedInTutorialPKID = pkid.PKID @@ -167,7 +167,7 @@ func (fes *APIServer) GetFeaturedCreators(utxoView *lib.UtxoView, responseLimit ii := 0 for len(profileEntryResponses) <= publicKeysUpperBound && ii < len(keys) { dbKeyBytes := keys[ii] - // Chop the PKID out of the db key. + // Chop the PublicKey out of the db key. // The dbKeyBytes are: [One Prefix Byte][btcec.PubKeyBytesLenCompressed] pkidBytes := dbKeyBytes[1:] profileEntry := utxoView.GetProfileEntryForPKID(lib.NewPKID(pkidBytes)) diff --git a/routes/user.go b/routes/user.go index 5e6863aa..6bcad9a9 100644 --- a/routes/user.go +++ b/routes/user.go @@ -236,7 +236,7 @@ func (fes *APIServer) updateUserFieldsStateless(user *User, utxoView *lib.UtxoVi if user.TutorialStatus != COMPLETE && user.TutorialStatus != SKIPPED && userMetadata.CreatorPurchasedInTutorialPKID != nil { tutorialCreatorProfileEntry := utxoView.GetProfileEntryForPKID(userMetadata.CreatorPurchasedInTutorialPKID) if tutorialCreatorProfileEntry == nil { - return fmt.Errorf("updateUserFieldsStateless: Did not find profile entry for PKID for creator purchased in tutorial") + return fmt.Errorf("updateUserFieldsStateless: Did not find profile entry for PublicKey for creator purchased in tutorial") } username := string(tutorialCreatorProfileEntry.Username) user.CreatorPurchasedInTutorialUsername = &username @@ -324,7 +324,7 @@ func (fes *APIServer) GetYouHodlMap(pkid *lib.PKIDEntry, fetchProfiles bool, isD return youHodlMap, nil } -// Convert list of BalanceEntries to a map of hodler / creator PKID to balance entry response. +// Convert list of BalanceEntries to a map of hodler / creator PublicKey to balance entry response. func (fes *APIServer) getMapFromEntries(entries []*lib.BalanceEntry, profiles []*lib.ProfileEntry, useCreatorPKIDAsKey bool, utxoView *lib.UtxoView) map[string]*BalanceEntryResponse { mapYouHodl := map[string]*BalanceEntryResponse{} for ii, entry := range entries { @@ -391,12 +391,12 @@ func (fes *APIServer) GetHodlingsForPublicKey( "GetHodlingsForPublicKey: Error calling GetAugmentedUtxoViewForPublicKey: %v", err) } } - // Get the map of entries this PKID hodls. + // Get the map of entries this PublicKey hodls. youHodlMap, err := fes.GetYouHodlMap(pkid, fetchProfiles, isDAOCoin, utxoView) if err != nil { return nil, nil, err } - // Get the map of the entries hodlings this PKID + // Get the map of the entries hodlings this PublicKey hodlYouMap, err := fes.GetHodlYouMap(pkid, fetchProfiles, isDAOCoin, utxoView) if err != nil { return nil, nil, err @@ -1508,7 +1508,7 @@ func (fes *APIServer) GetHodlersCountForPublicKeys(ww http.ResponseWriter, req * fmt.Sprintf("GetHolderCountForPublicKeys: unable to decode public key - %v: %v", publicKey, err)) return } - // Get PKID and then get holders for PKID + // Get PublicKey and then get holders for PublicKey pkid := utxoView.GetPKIDForPublicKey(pkBytes) balanceEntries, _, err := utxoView.GetHolders(pkid.PKID, false, requestData.IsDAOCoin) if err != nil { diff --git a/routes/verify.go b/routes/verify.go index 97237d85..a76f0e65 100644 --- a/routes/verify.go +++ b/routes/verify.go @@ -881,7 +881,7 @@ func (fes *APIServer) JumioCallback(ww http.ResponseWriter, req *http.Request) { // Verification status verificationStatus := req.FormValue("verificationStatus") - // Get Public key bytes and PKID + // Get Public key bytes and PublicKey if userReference == "" { _AddBadRequestError(ww, fmt.Sprintf("JumioCallback: Public key (customerId) is required")) return @@ -900,7 +900,7 @@ func (fes *APIServer) JumioCallback(ww http.ResponseWriter, req *http.Request) { pkid := utxoView.GetPKIDForPublicKey(publicKeyBytes) if pkid == nil { - _AddBadRequestError(ww, fmt.Sprintf("JumioCallback: No PKID found for public key: %v", userReference)) + _AddBadRequestError(ww, fmt.Sprintf("JumioCallback: No PublicKey found for public key: %v", userReference)) return } @@ -1178,7 +1178,7 @@ func (fes *APIServer) JumioVerifiedHandler(userMetadata *UserMetadata, jumioTran kickbackAmountDeSoNanos := fes.GetReferrerSignUpBonusAmount(signUpBonusMetadata, referralInfo.ReferrerAmountUSDCents) - // Add an index for logging all the PKIDs referred by a single PKID+ReferralHash pair. + // Add an index for logging all the PKIDs referred by a single PublicKey+ReferralHash pair. refereePKID := utxoView.GetPKIDForPublicKey(publicKeyBytes) pkidReferralHashRefereePKIDKey := GlobalStateKeyForPKIDReferralHashRefereePKID(referralInfo.ReferrerPKID, []byte(referralInfo.ReferralHashBase58), refereePKID.PKID) if err = fes.GlobalState.Put(pkidReferralHashRefereePKIDKey, []byte{1}); err != nil { diff --git a/scripts/nodes/n0 b/scripts/nodes/n0 index de75541c..143c9cc5 100755 --- a/scripts/nodes/n0 +++ b/scripts/nodes/n0 @@ -11,7 +11,7 @@ rm /tmp/main.*.log --num-mining-threads=1 \ --txindex=true \ --admin-public-keys=* \ - --state-change-file-path=/tmp/state-changes \ + --state-change-dir=/tmp/state-changes \ --super-admin-public-keys=* \ --miner-public-keys=BC1YLgKZyfgyNntCMXAZYExM8JooYqrYvVsrR8d8XVxorDruYFdq31p \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ diff --git a/scripts/nodes/n0_test b/scripts/nodes/n0_test index e7038307..25e4826c 100755 --- a/scripts/nodes/n0_test +++ b/scripts/nodes/n0_test @@ -36,7 +36,7 @@ rm /tmp/main.*.log --block-producer-seed='essence camp ghost remove document vault ladder swim pupil index apart ring' \ --starter-deso-seed='road congress client market couple bid risk escape artwork rookie artwork food' \ --data-dir=/tmp/n0_test_00000 \ - --state-change-file-path=/tmp/state-changes-test \ + --state-change-dir=/tmp/state-changes-test \ --access-control-allow-origins=http://localhost:4200,http://localhost:80,http://localhost:18002,http://localhost:4201,http://localhost:18001 \ --secure-header-allow-hosts=localhost:4200 \ --secure-header-development=true \ From ba2305bacb3f4018d50ad57c361de9586c140b7b Mon Sep 17 00:00:00 2001 From: superzordon Date: Thu, 14 Sep 2023 18:28:49 -0400 Subject: [PATCH 10/10] Update extra data utils --- routes/extra_data_utils.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/routes/extra_data_utils.go b/routes/extra_data_utils.go index f4679fd7..4915b7e5 100644 --- a/routes/extra_data_utils.go +++ b/routes/extra_data_utils.go @@ -9,6 +9,7 @@ import ( "github.com/golang/glog" "github.com/pkg/errors" "io" + "math" "strconv" "strings" ) @@ -189,11 +190,20 @@ func DecodePubKeyToUint64MapString(bytes []byte, params *lib.DeSoParams, _ *lib. func DecodeTransactionSpendingLimit(spendingBytes []byte, params *lib.DeSoParams, utxoView *lib.UtxoView) string { var transactionSpendingLimit lib.TransactionSpendingLimit - tipHeight, err := lib.GetBlockTipHeight(utxoView.Handle, false) - if err != nil { - glog.Errorf("Error getting block tip height from the db") - return "" + var tipHeight uint64 + var err error + + if utxoView.Handle != nil { + tipHeight, err = lib.GetBlockTipHeight(utxoView.Handle, false) + if err != nil { + glog.Errorf("Error getting block tip height from the db") + return "" + } + } else { + // If we don't have a db handle, we can't get the tip height, so we just set it to the max uint64. + tipHeight = math.MaxUint64 } + // Note: we will have to update this with every migration on transaction spending limits blockHeights := []uint64{ tipHeight,