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

Eval: Prefetching for heartbeat transactions #6182

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
},
"/v2/accounts/{address}": {
"get": {
"description": "Given a specific account public key, this call returns the accounts status, balance and spendable amounts",
"description": "Given a specific account public key, this call returns the account's status, balance and spendable amounts",
"tags": [
"public",
"nonparticipating"
Expand Down
2 changes: 1 addition & 1 deletion daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,7 @@
},
"/v2/accounts/{address}": {
"get": {
"description": "Given a specific account public key, this call returns the accounts status, balance and spendable amounts",
"description": "Given a specific account public key, this call returns the account's status, balance and spendable amounts",
"operationId": "AccountInformation",
"parameters": [
{
Expand Down
188 changes: 94 additions & 94 deletions daemon/algod/api/server/v2/generated/nonparticipating/public/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions data/transactions/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (tx Header) Alive(tc TxnContext) error {

// MatchAddress checks if the transaction touches a given address.
func (tx Transaction) MatchAddress(addr basics.Address, spec SpecialAddresses) bool {
return slices.Contains(tx.RelevantAddrs(spec), addr)
return slices.Contains(tx.relevantAddrs(spec), addr)
}

var errKeyregTxnFirstVotingRoundGreaterThanLastVotingRound = errors.New("transaction first voting round need to be less than its last voting round")
Expand Down Expand Up @@ -714,9 +714,8 @@ func (tx Header) Last() basics.Round {
return tx.LastValid
}

// RelevantAddrs returns the addresses whose balance records this transaction will need to access.
// The header's default is to return just the sender and the fee sink.
func (tx Transaction) RelevantAddrs(spec SpecialAddresses) []basics.Address {
// relevantAddrs returns the addresses whose balance records this transaction will need to access.
func (tx Transaction) relevantAddrs(spec SpecialAddresses) []basics.Address {
addrs := []basics.Address{tx.Sender, spec.FeeSink}

switch tx.Type {
Expand All @@ -733,6 +732,8 @@ func (tx Transaction) RelevantAddrs(spec SpecialAddresses) []basics.Address {
if !tx.AssetTransferTxnFields.AssetSender.IsZero() {
addrs = append(addrs, tx.AssetTransferTxnFields.AssetSender)
}
case protocol.HeartbeatTx:
addrs = append(addrs, tx.HeartbeatTxnFields.HbAddress)
}

return addrs
Expand Down
4 changes: 3 additions & 1 deletion ledger/eval/prefetcher/prefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ func (p *accountPrefetcher) prefetch(ctx context.Context) {
// since they might be non-used arbitrary values

case protocol.StateProofTx:
case protocol.KeyRegistrationTx:
case protocol.KeyRegistrationTx: // No extra accounts besides the sender
case protocol.HeartbeatTx:
loadAccountsAddAccountTask(&stxn.Txn.HbAddress, task, accountTasks, queue)
}

// If you add new addresses here, also add them in getTxnAddresses().
Expand Down
Loading
Loading