Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
31726b5
perf(indexer): decode each operation's ledger changes once, not once …
aditya1702 Aug 11, 2026
5d7b660
perf(indexer): hash a ledger's transaction envelopes in parallel
aditya1702 Aug 11, 2026
cdf4e2e
perf(processors): gate the strkey type checks on the leading character
aditya1702 Aug 11, 2026
f5eefcb
perf(indexer): collect ContractData changes at process time from the …
aditya1702 Aug 12, 2026
7e17720
perf(types): memoize strkey→BYTEA conversion per batch build
aditya1702 Aug 12, 2026
7702bfc
perf(processors): dedupe participants on raw keys without encoding
aditya1702 Aug 12, 2026
84688dc
perf(indexer): trim fixed allocations in the participants fan-out
aditya1702 Aug 12, 2026
afed807
perf(processors): fold the Soroban participants path into one accumul…
aditya1702 Aug 12, 2026
1270840
perf(data): memoize address conversion across a state_changes COPY
aditya1702 Aug 12, 2026
d0a30c2
perf(data): memoize address conversion in the accounts-link COPYs
aditya1702 Aug 12, 2026
b775083
perf(processors): return the operation source account by value
aditya1702 Aug 12, 2026
98a19d0
perf(processors): share one transaction per operation wrapper
aditya1702 Aug 12, 2026
ba80b23
perf(indexer): assign state-change ordinals without a per-call map
aditya1702 Aug 13, 2026
4cdc1fb
perf(processors): cut per-operation allocation churn on the state-cha…
aditya1702 Aug 13, 2026
e6830d3
perf(processors): memoize asset-to-contract-ID derivation
aditya1702 Aug 13, 2026
ec3681d
test(processors): cover signer and ledger-entry sponsorship effects
aditya1702 Aug 13, 2026
d56a6da
perf(processors): build state changes with a by-value StateChangeBuilder
aditya1702 Aug 13, 2026
0224e69
chore: tidy unused dependency and single-caller test helper params
aditya1702 Aug 13, 2026
8dafd41
perf(processors): compare account changes by field and pool the opera…
aditya1702 Aug 13, 2026
5e2ff12
fix(types): assign state-change ordinals with a counting map
aditya1702 Aug 20, 2026
c2812ea
refactor(processors): collapse the per-host-function participant type…
aditya1702 Aug 20, 2026
28206d0
test(processors): cover the SDK-oracle branches the account compariso…
aditya1702 Aug 20, 2026
af91e9d
perf(indexer): skip ContractData collection for classic transactions
aditya1702 Aug 20, 2026
f6407a2
refactor(processors): serve every asset-to-contract-ID derivation fro…
aditya1702 Aug 20, 2026
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
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/go-playground/validator/v10 v10.27.0
github.com/golang-jwt/jwt/v5 v5.2.3
github.com/google/uuid v1.6.0
github.com/guregu/null v4.0.0+incompatible
github.com/jackc/pgx/v5 v5.7.6
github.com/lib/pq v1.10.9
github.com/pkg/errors v0.9.1
Expand Down
6 changes: 5 additions & 1 deletion internal/data/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func batchCopyAccounts[T any](

// COPY the link table using pgx binary format with native pgtype types. Upstream
// participants handling ensures that account address is not NULL here.
// Participants are deduplicated per parent row upstream, so a busy account
// repeats once per transaction/operation here; the memo collapses that to
// one decode per unique address per batch.
memo := make(types.AddressByteaMemo)
var rows [][]any
for id, addresses := range addressesByID {
ledgerCreatedAt, ok := ledgerCreatedAtByID[id]
Expand All @@ -107,7 +111,7 @@ func batchCopyAccounts[T any](
ledgerCreatedAtPgtype := pgtype.Timestamptz{Time: ledgerCreatedAt, Valid: true}
idPgtype := pgtype.Int8{Int64: id, Valid: true}
for addr := range addresses {
addrBytes, addrErr := types.AddressBytea(addr).Value()
addrBytes, addrErr := memo.Bytes(types.AddressBytea(addr))
if addrErr != nil {
return fmt.Errorf("converting address %s to bytes: %w", addr, addrErr)
}
Expand Down
15 changes: 0 additions & 15 deletions internal/data/query_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,6 @@ func pgtypeInt2FromNullInt16(ni sql.NullInt16) pgtype.Int2 {
return pgtype.Int2{Int16: ni.Int16, Valid: ni.Valid}
}

// pgtypeBytesFromNullAddressBytea converts NullAddressBytea to bytes for BYTEA insert.
func pgtypeBytesFromNullAddressBytea(na types.NullAddressBytea) ([]byte, error) {
if !na.Valid {
return nil, nil
}
val, err := na.Value()
if err != nil {
return nil, fmt.Errorf("converting address to bytes: %w", err)
}
if val == nil {
return nil, nil
}
return val.([]byte), nil
}

// CursorColumn represents a column name and its cursor value for decomposed pagination.
type CursorColumn struct {
Name string
Expand Down
15 changes: 9 additions & 6 deletions internal/data/statechanges.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ func (m *StateChangeModel) BatchCopy(

start := time.Now()

// One memo shared by every row of this COPY, used only from pgx's single row-callback goroutine.
memo := make(types.AddressByteaMemo)

// COPY state_changes using pgx binary format with native pgtype types
copyCount, err := pgxTx.CopyFrom(
ctx,
Expand All @@ -174,29 +177,29 @@ func (m *StateChangeModel) BatchCopy(
sc := stateChanges[i]

// Convert account_id to BYTEA (required field)
accountBytes, err := sc.AccountID.Value()
accountBytes, err := memo.Bytes(sc.AccountID)
if err != nil {
return nil, fmt.Errorf("converting account_id: %w", err)
}

// Convert nullable account_id fields to BYTEA
signerBytes, err := pgtypeBytesFromNullAddressBytea(sc.SignerAccountID)
signerBytes, err := memo.NullBytes(sc.SignerAccountID)
if err != nil {
return nil, fmt.Errorf("converting signer_account_id: %w", err)
}
spenderBytes, err := pgtypeBytesFromNullAddressBytea(sc.SpenderAccountID)
spenderBytes, err := memo.NullBytes(sc.SpenderAccountID)
if err != nil {
return nil, fmt.Errorf("converting spender_account_id: %w", err)
}
creatorBytes, err := pgtypeBytesFromNullAddressBytea(sc.CreatorAccountID)
creatorBytes, err := memo.NullBytes(sc.CreatorAccountID)
if err != nil {
return nil, fmt.Errorf("converting creator_account_id: %w", err)
}
destinationBytes, err := pgtypeBytesFromNullAddressBytea(sc.DestinationAccountID)
destinationBytes, err := memo.NullBytes(sc.DestinationAccountID)
if err != nil {
return nil, fmt.Errorf("converting destination_account_id: %w", err)
}
tokenBytes, err := pgtypeBytesFromNullAddressBytea(sc.TokenID)
tokenBytes, err := memo.NullBytes(sc.TokenID)
if err != nil {
return nil, fmt.Errorf("converting token_id: %w", err)
}
Expand Down
Loading
Loading