Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
396 commits
Select commit Hold shift + click to select a range
704b99d
process trustline changes with full XDR data
aditya1702 Jan 14, 2026
3470542
Remove method to update balances
aditya1702 Jan 14, 2026
8f83a88
Change TrustlineWithFullData to Trustline
aditya1702 Jan 14, 2026
315f10d
Consolidate trustline queries into single GetTrustlines method with JOIN
aditya1702 Jan 14, 2026
d92520b
Remove BatchGetByIDs from trustline_assets
aditya1702 Jan 14, 2026
fdf419a
Simplify TokenCacheReader interface for trustlines
aditya1702 Jan 14, 2026
4257ce2
Update graphql resolver to use new trustline balance calls
aditya1702 Jan 14, 2026
be96290
fix all tests - 1
aditya1702 Jan 14, 2026
7ef3e44
fix tests - 2
aditya1702 Jan 14, 2026
2b6d61a
Fix tests - 3
aditya1702 Jan 14, 2026
bc96c58
remove unused functions
aditya1702 Jan 14, 2026
3c05b56
Add TrustLinesProcessor and integrate into indexer
aditya1702 Jan 14, 2026
ea5de02
Call TrustLinesProcessor and remove StateChangeCategoryTrustline conv…
aditya1702 Jan 14, 2026
10f0b23
Simplify parseTrustline - remove XDR field extraction
aditya1702 Jan 14, 2026
962835b
Remove WithTrustlineXDRFields from StateChangeBuilder
aditya1702 Jan 14, 2026
0ef46fa
Remove trustline XDR fields from StateChange struct
aditya1702 Jan 14, 2026
d9ae3db
fix make check
aditya1702 Jan 14, 2026
667bcd5
remove unused function
aditya1702 Jan 14, 2026
df0e2aa
Update trustlines.go
aditya1702 Jan 14, 2026
d19698c
Add migration for account_native_balances table
aditya1702 Jan 14, 2026
8dcdb6d
Add AccountChange type for native balance tracking
aditya1702 Jan 14, 2026
9b2c5dc
Add AccountsProcessor for native balance tracking
aditya1702 Jan 14, 2026
cf4ca36
Add account changes to IndexerBuffer
aditya1702 Jan 14, 2026
b08bfc1
Wire AccountsProcessor into Indexer with generic interface
aditya1702 Jan 14, 2026
e2afef5
Add NativeBalance type and DB methods to data layer
aditya1702 Jan 14, 2026
2afe938
Add native balance to account tokens
aditya1702 Jan 14, 2026
35c500e
Update ingestion to process account changes
aditya1702 Jan 14, 2026
e633124
Pass account changes through ingestion pipeline
aditya1702 Jan 14, 2026
745f8c5
Update GraphQL resolvers to read native balance from DB
aditya1702 Jan 14, 2026
a7aee8b
fix make check
aditya1702 Jan 14, 2026
24c68ff
remove redundant function to upsert trustlines
aditya1702 Jan 14, 2026
4715086
Merge branch 'calculate-balances-using-changes' into store-native-bal…
aditya1702 Jan 14, 2026
a4b66ef
Update account_tokens.go
aditya1702 Jan 14, 2026
70d22d0
refactor: consolidate contract and trustline batch functions in data …
aditya1702 Jan 14, 2026
a6012b1
refactor: update service layer to use consolidated batch functions
aditya1702 Jan 14, 2026
26487fc
test: update tests for consolidated batch functions
aditya1702 Jan 14, 2026
c0fdaf2
test: update service layer tests for new batch function names
aditya1702 Jan 14, 2026
bf88fcf
remove unused code
aditya1702 Jan 14, 2026
1de9854
Fix failing tests
aditya1702 Jan 14, 2026
20e1e87
Add account_sac_balances table and SACBalanceChange type
aditya1702 Jan 14, 2026
8e6255e
Add SACBalancesProcessor to extract SAC balances from ledger changes
aditya1702 Jan 14, 2026
9099790
Wire SACBalancesProcessor into indexer and add buffer methods
aditya1702 Jan 14, 2026
d900904
Add SACBalance CRUD methods to data layer
aditya1702 Jan 14, 2026
e6b8fbb
Update ProcessTokenChanges to handle SAC balance changes
aditya1702 Jan 14, 2026
06a6721
Update checkpoint population to extract and store SAC balances
aditya1702 Jan 14, 2026
e7f68df
Update GraphQL resolver to read SAC balances from DB
aditya1702 Jan 14, 2026
aa0297f
Store SAC balances while checkpointing
aditya1702 Jan 14, 2026
90715c4
fix make check
aditya1702 Jan 14, 2026
845e62b
fix make check - 2
aditya1702 Jan 14, 2026
5d14675
Use SAC balances from DB
aditya1702 Jan 14, 2026
912f0c1
Use SAC balances from DB - 2
aditya1702 Jan 14, 2026
360d38e
Use ContractBalanceFromContractData function to parse balanc eentry c…
aditya1702 Jan 14, 2026
57d0bf5
Update token_transfer.go
aditya1702 Jan 15, 2026
6c742eb
change TrustLines -> Trustlines
aditya1702 Jan 15, 2026
9c84ccf
Create trustlines_test.go
aditya1702 Jan 15, 2026
ed819f2
Update internal/data/account_tokens.go
aditya1702 Jan 15, 2026
93f7116
Update internal/data/account_tokens.go
aditya1702 Jan 15, 2026
afac0ed
Update internal/data/trustline_assets.go
aditya1702 Jan 15, 2026
26e92fa
Update internal/db/migrations/2025-12-14.0-trustline_assets.sql
aditya1702 Jan 15, 2026
40ea015
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 15, 2026
a06b341
Merge branch 'calculate-balances-using-changes' into store-native-bal…
aditya1702 Jan 15, 2026
6e856dc
Update mocks.go
aditya1702 Jan 15, 2026
c8e54e9
Remove tokenCacheReader interface
aditya1702 Jan 15, 2026
f7389d1
rename files and remove unused method
aditya1702 Jan 15, 2026
9c5e47a
Merge branch 'calculate-balances-using-changes' into store-native-bal…
aditya1702 Jan 15, 2026
8201c58
Add GetNativeBalance method
aditya1702 Jan 15, 2026
55394f8
insert native balances within same batch during checkpoint population
aditya1702 Jan 15, 2026
973bb0e
Add TrustlineBalanceModel for focused trustline balance operations
aditya1702 Jan 15, 2026
d7fa1a7
Add AccountContractTokensModel for focused contract mapping operations
aditya1702 Jan 15, 2026
e40679e
Consolidate migrations: rename table to account_trustline_balances
aditya1702 Jan 15, 2026
35673ae
Update Models struct to use new focused model interfaces
aditya1702 Jan 15, 2026
a0eea75
Split migrations into separate files per model
aditya1702 Jan 15, 2026
0cba06b
Update TokenIngestionService to use new focused models
aditya1702 Jan 15, 2026
1c81707
Update GraphQL resolvers to use new focused models
aditya1702 Jan 15, 2026
872b72d
Update serve.go dependency injection for new model interfaces
aditya1702 Jan 15, 2026
c928381
Update ingest.go to use new model interfaces
aditya1702 Jan 15, 2026
02cd9c6
Update first two test cases to use new model interfaces
aditya1702 Jan 15, 2026
2fae304
Update success test cases (SAC, SEP-41, mixed, contract, trustline V0)
aditya1702 Jan 15, 2026
e83f4dd
Update error and edge case tests to use new model interfaces
aditya1702 Jan 15, 2026
74953e2
Update BalancesByAccountAddresses tests to use new model interfaces
aditya1702 Jan 15, 2026
9e40e7d
Fix error message assertion in partial failure test
aditya1702 Jan 15, 2026
ae99455
Delete old account_tokens.go file (replaced by focused models)
aditya1702 Jan 15, 2026
3e3a427
Delete old account_tokens_test.go (tests for deleted AccountTokensModel)
aditya1702 Jan 15, 2026
32660e4
Update token_ingestion_test.go to use new focused model interfaces
aditya1702 Jan 15, 2026
48b3633
Fix wrapcheck lint error in balance_reader.go
aditya1702 Jan 15, 2026
2b4626b
fix make check
aditya1702 Jan 15, 2026
20e74ef
rename migration files and tables
aditya1702 Jan 15, 2026
99710d5
Update account_contract_tokens.go
aditya1702 Jan 15, 2026
f0c76af
Update trustline_balance.go
aditya1702 Jan 15, 2026
4eaf754
fix typo
aditya1702 Jan 15, 2026
596ca7a
remove unused methods from contract tokens data model
aditya1702 Jan 15, 2026
c4c8b69
fix tests
aditya1702 Jan 15, 2026
713f89b
directly use token changes from buffer
aditya1702 Jan 15, 2026
dbc891c
Add tests for trustline_balances
aditya1702 Jan 15, 2026
651ce2f
Use BatchCopy for inserting new trustlines
aditya1702 Jan 15, 2026
c6a49c8
Integrate proper DB transaction lifecycle during ingestion (#448)
aditya1702 Jan 15, 2026
ac2fa47
Revert "Use BatchCopy for inserting new trustlines"
aditya1702 Jan 15, 2026
c95f36e
Properly process token changes during optimized catchup (#449)
aditya1702 Jan 15, 2026
d52d2ec
Merge main_balances_postgres with PostgreSQL-only storage
aditya1702 Jan 15, 2026
c42a2d4
Remove redis container setup from integration tests
aditya1702 Jan 15, 2026
4a5576a
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 15, 2026
fb3a7da
Update ingest_test.go
aditya1702 Jan 15, 2026
975bcef
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 15, 2026
0edb007
Update ingest_backfill.go
aditya1702 Jan 15, 2026
e8b5dd8
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 15, 2026
8c129dc
Directly call buffer to get trustline and contract changes
aditya1702 Jan 15, 2026
c6e9422
fix make check
aditya1702 Jan 15, 2026
d8b3337
fix failing test
aditya1702 Jan 15, 2026
3fab5a5
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 15, 2026
353b162
Merge calculate-balances-using-changes into store-native-balance
aditya1702 Jan 15, 2026
8a0a37c
Update account_balances_test.go
aditya1702 Jan 15, 2026
7868a7f
Update ingest_backfill.go
aditya1702 Jan 15, 2026
baa47b6
Fix failing tests
aditya1702 Jan 15, 2026
f175e75
Add unit tests for AccountsProcessor
aditya1702 Jan 15, 2026
ca68a5d
Add unit tests for NativeBalanceModel
aditya1702 Jan 15, 2026
490dbbc
Fix NativeBalanceModel test expectations for not-found case
aditya1702 Jan 15, 2026
708a568
store only the latest trustline balance change
aditya1702 Jan 16, 2026
b9ad300
Change token ingestion flow to directly insert without sorting
aditya1702 Jan 16, 2026
d964fce
Update mocks.go
aditya1702 Jan 16, 2026
dfc9689
make check
aditya1702 Jan 16, 2026
2d78bbb
update backfill logic for catchup
aditya1702 Jan 16, 2026
b40a663
merge trustline changes properly
aditya1702 Jan 16, 2026
0d46ae1
merge unique assets and contract ID maps
aditya1702 Jan 16, 2026
ca2e4c1
process batch changes within same txn
aditya1702 Jan 16, 2026
dea1053
Merge calculate-balances-using-changes into store-native-balance
aditya1702 Jan 16, 2026
c5fd0dd
refactor: change accountChanges from slice to map in IndexerBuffer
aditya1702 Jan 16, 2026
845778f
refactor: update IndexerBufferInterface for map-based account changes
aditya1702 Jan 16, 2026
59a5c78
refactor: update ingest_backfill.go for map-based account changes
aditya1702 Jan 16, 2026
ddc0c58
refactor: simplify ProcessTokenChanges for pre-deduplicated account c…
aditya1702 Jan 16, 2026
3b5420d
refactor: update TokenIngestionServiceMock for map-based account changes
aditya1702 Jan 16, 2026
3666981
fix make check
aditya1702 Jan 16, 2026
c7ca787
Add minimum_balance column
aditya1702 Jan 16, 2026
866d7ce
Add minimum balance, buying L, selling L to graphql native balance re…
aditya1702 Jan 16, 2026
cace424
fix make check
aditya1702 Jan 16, 2026
46c9065
Add NativeBalance fragment to GraphQL client queries
aditya1702 Jan 16, 2026
b29189c
Add missing fields to NativeBalance client type
aditya1702 Jan 16, 2026
c5b7263
Fix checkpoint population to calculate MinimumBalance
aditya1702 Jan 16, 2026
77d6e37
Update integration tests to verify native balance updates
aditya1702 Jan 16, 2026
c0a4ac8
Update account_balances_test.go
aditya1702 Jan 16, 2026
a379bec
Merge store-native-balance into store-sep41-balance with SAC balance …
aditya1702 Jan 16, 2026
36d2aa2
Merge branch 'store-native-balance' into store-sep41-balance
aditya1702 Jan 16, 2026
65a2bbe
streamline SAC balance entry processing
aditya1702 Jan 16, 2026
3d9fee9
store all contract tokens at the end during checkpointing
aditya1702 Jan 16, 2026
1ccec34
fix failing tests
aditya1702 Jan 16, 2026
1fdd6e8
update balance resolver to read SAC balances from DB
aditya1702 Jan 16, 2026
2ab56d0
copilot review changes
aditya1702 Jan 16, 2026
e87f854
Update account_balances_test.go
aditya1702 Jan 16, 2026
6a54d5f
fix error comparison
aditya1702 Jan 16, 2026
b1fada6
fix issues - 1
aditya1702 Jan 16, 2026
469ad8f
Use BIGINT for last modified ledger
aditya1702 Jan 16, 2026
b152f69
change last modified ledger to BIGINT
aditya1702 Jan 16, 2026
9855e2d
update table name
aditya1702 Jan 16, 2026
d70ccfd
Add tests for SAC processors
aditya1702 Jan 17, 2026
4fda222
Refactor: Replace GetAllContractIDs with GetExisting for scalability
aditya1702 Jan 19, 2026
5d3ca3f
Remove dead mock methods from TokenCacheWriterMock
aditya1702 Jan 19, 2026
94ec655
Update stale Redis references in test comments and error messages
aditya1702 Jan 19, 2026
e0ebc97
Fix prepareNewContracts call in ingest_backfill.go
aditya1702 Jan 19, 2026
4f47e72
Add deferred FK constraints on account tokens tables
aditya1702 Jan 19, 2026
6d7efba
Merge redis-to-postgres into calculate-balances-using-changes
aditya1702 Jan 19, 2026
d4e393c
Add deferred FK constraints on account tokens tables
aditya1702 Jan 19, 2026
8392d4a
Clean up minor code issues in token ingestion
aditya1702 Jan 19, 2026
8118c64
Update stellar_rpc_config.toml
aditya1702 Jan 19, 2026
36e8e7e
Update backfill_helpers.go
aditya1702 Jan 19, 2026
671a781
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 19, 2026
9ce0d30
Merge branch 'calculate-balances-using-changes' into store-native-bal…
aditya1702 Jan 19, 2026
6adcd48
Use uint32 in graphql for last modified ledger
aditya1702 Jan 19, 2026
77dea34
Merge store-native-balance into store-sep41-balance
aditya1702 Jan 19, 2026
6fcffe8
Add FK constraint to sac_balances table
aditya1702 Jan 19, 2026
9ca90a6
Add error logging in GraphQL balance resolver
aditya1702 Jan 19, 2026
e1772f5
Add buffer test coverage for SAC balance operations
aditya1702 Jan 19, 2026
7953ee3
Add balance validation and define constants for SAC balance fields
aditya1702 Jan 19, 2026
abe267a
Fix test addresses to use valid 56-character format
aditya1702 Jan 19, 2026
a83055e
refactor SAC entries processing
aditya1702 Jan 20, 2026
75c9902
Only insert sep41 token relationships for accounts
aditya1702 Jan 20, 2026
45e1746
Only insert sep41 account token relationships - 2
aditya1702 Jan 20, 2026
47e3d28
Add SACInstanceProcessor to extract SAC contract metadata
aditya1702 Jan 20, 2026
cb3ae04
Add SAC contract tracking to IndexerBuffer
aditya1702 Jan 20, 2026
a30aa40
Wire SACInstanceProcessor in indexer
aditya1702 Jan 20, 2026
0f7591b
change function name
aditya1702 Jan 20, 2026
d44f988
Extend prepareNewContractTokens to include SAC contracts
aditya1702 Jan 20, 2026
9fe307c
Add tests for SACInstanceProcessor
aditya1702 Jan 20, 2026
fdaa8f5
Process SAC instances to extract new assets
aditya1702 Jan 20, 2026
cf75e84
Add proper logging for inserted items in DB
aditya1702 Jan 20, 2026
148603f
Update ingest_live.go
aditya1702 Jan 20, 2026
98b0312
fix failing unit tests
aditya1702 Jan 20, 2026
7d8a110
Update token_ingestion.go
aditya1702 Jan 20, 2026
1c05dc3
Update token_ingestion.go
aditya1702 Jan 20, 2026
ab8c062
fetch missing SAC metadata using RPC
aditya1702 Jan 20, 2026
49cad15
return error for metadata fetching failures
aditya1702 Jan 20, 2026
7957b46
Reduce batch size and set synchronous commit = off
aditya1702 Jan 20, 2026
cb38365
Add loadtest run command for synthetic ledger ingestion
aditya1702 Jan 21, 2026
61684fd
Register loadtest command in root CLI
aditya1702 Jan 21, 2026
131c5e8
Add loadtest runner for synthetic ledger ingestion
aditya1702 Jan 21, 2026
1793631
Add LoadtestLedgerBackend for synthetic ledger ingestion
aditya1702 Jan 21, 2026
a82ce64
Add GetLedgerTransactions and ProcessLedger to indexer package
aditya1702 Jan 21, 2026
d622aaa
Refactor ingest service to use indexer.ProcessLedger
aditya1702 Jan 21, 2026
81e8c9f
Add xdrpp/goxdr dependency for loadtest backend
aditya1702 Jan 21, 2026
e91e0c8
Add wallet_backend_loadtest schema to postgres init
aditya1702 Jan 21, 2026
d318e37
Add load test ledgers data file
aditya1702 Jan 21, 2026
dff6541
fix tests
aditya1702 Jan 21, 2026
31839a2
Add NewTokenIngestionServiceForLoadtest constructor for loadtest runner
aditya1702 Jan 21, 2026
7c4844b
Add SeedDataPath field to loadtest RunConfig
aditya1702 Jan 21, 2026
e275e59
Add loadSeedData function to loadtest runner
aditya1702 Jan 21, 2026
6e83534
Add token change processing to persistLedgerData using TokenIngestion…
aditya1702 Jan 21, 2026
5f3d60d
Update Run() and runIngestionLoop to use TokenIngestionService and se…
aditya1702 Jan 21, 2026
0bf266b
Add --seed-data-path CLI flag to loadtest command
aditya1702 Jan 21, 2026
62b9d1f
Add loadtest seed data SQL file with native XLM SAC contract
aditya1702 Jan 21, 2026
b8a0fe5
Use COPY format for seed data for fast bulk loading
aditya1702 Jan 21, 2026
2cb324b
Use psql to load seed data with COPY format support
aditya1702 Jan 21, 2026
b6a90e3
Update runner.go
aditya1702 Jan 21, 2026
ab1971a
use the last expected ledger to end the loop
aditya1702 Jan 21, 2026
7eb7672
Update docker-compose.yaml
aditya1702 Jan 21, 2026
0471170
fix make check
aditya1702 Jan 21, 2026
6bfc401
Update runner.go
aditya1702 Jan 22, 2026
6e99936
use CopyFromSlice for better type checking
aditya1702 Jan 28, 2026
ca586f7
Merge branch 'redis-to-postgres' into calculate-balances-using-changes
aditya1702 Jan 28, 2026
c677dd7
Use CopyFromSlice for strict checking
aditya1702 Jan 28, 2026
62e3b0e
remove unused network passphrase
aditya1702 Jan 28, 2026
9e5008d
Merge branch 'calculate-balances-using-changes' into store-native-bal…
aditya1702 Jan 28, 2026
e2532e9
remove unused network passphrase
aditya1702 Jan 28, 2026
e615ce5
make check
aditya1702 Jan 28, 2026
c206a1d
Use Greater instead of GreaterOrEqual
aditya1702 Jan 28, 2026
6927bc7
Add assertion for minimum balance
aditya1702 Jan 28, 2026
7175785
Merge branch 'store-native-balance' into store-sep41-balance
aditya1702 Jan 28, 2026
35ee238
use utils isContractAddress function
aditya1702 Jan 28, 2026
2ba6bf1
Update sac_balances.go
aditya1702 Jan 28, 2026
ab6a54d
simplify balance fields extraction for SAC balances
aditya1702 Jan 28, 2026
c258cbd
Merge branch 'store-sep41-balance' into load-test-2
aditya1702 Jan 28, 2026
4a77335
fix review comments - 1
aditya1702 Jan 28, 2026
4c84956
Update runner.go
aditya1702 Jan 28, 2026
d42bd0e
fix make check issues
aditya1702 Jan 28, 2026
084ec12
Use normalized `(accountID, tokenID)` tables for storing account trus…
aditya1702 Jan 28, 2026
1ac7985
Process trustline entry changes and store trustline balances (#452)
aditya1702 Jan 28, 2026
faf853b
Process account entry changes and store XLM balances and minimum XLM …
aditya1702 Jan 28, 2026
45d3e48
Process SAC balance entry changes and store SAC balances (#454)
aditya1702 Jan 28, 2026
7f96022
Update runner.go
aditya1702 Jan 28, 2026
e35a5b3
dont print database URL
aditya1702 Jan 28, 2026
d904c85
Merge branch 'main_balances_postgres' into load-test-2
aditya1702 Jan 28, 2026
655e40b
rearrange test functions
aditya1702 Jan 28, 2026
4596785
Merge branch 'main' into load-test-2
aditya1702 Jan 28, 2026
0c21ca8
Update indexer.go
aditya1702 Jan 28, 2026
ea41ba6
Use latest ledger seq to end the FOR loop
aditya1702 Jan 29, 2026
d319319
Replace result_xdr with fee_charged and result_code in transactions t…
aditya1702 Jan 29, 2026
266a05a
Update tests and client types for fee_charged and result_code fields
aditya1702 Jan 29, 2026
85f5209
Regenerate GraphQL code with feeCharged and resultCode fields
aditya1702 Jan 29, 2026
ab3cccb
Fix XDR field access and update test expectations
aditya1702 Jan 29, 2026
0e2a9fd
Use the SDK functions to get the code and fee charged
aditya1702 Jan 29, 2026
3518140
Fix remaining test SQL INSERT statements for tx3 rows
aditya1702 Jan 30, 2026
51201e1
Add isFeeBump column to transactions table
aditya1702 Jan 30, 2026
ac9d6f8
Merge branch 'main' into result-xdr
aditya1702 Jan 30, 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
6 changes: 3 additions & 3 deletions internal/data/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func TestAccountModelBatchGetByTxHashes(t *testing.T) {
require.NoError(t, err)

// Insert test transactions first
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at) VALUES ($1, 1, 'env1', 'res1', 'meta1', 1, NOW()), ($2, 2, 'env2', 'res2', 'meta2', 2, NOW())", txHash1, txHash2)
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at) VALUES ($1, 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, NOW()), ($2, 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, NOW())", txHash1, txHash2)
require.NoError(t, err)

// Insert test transactions_accounts links
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestAccountModelBatchGetByOperationIDs(t *testing.T) {
require.NoError(t, err)

// Insert test transactions first
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at) VALUES ('tx1', 1, 'env1', 'res1', 'meta1', 1, NOW()), ('tx2', 2, 'env2', 'res2', 'meta2', 2, NOW())")
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at) VALUES ('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, NOW()), ('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, NOW())")
require.NoError(t, err)

// Insert test operations first
Expand Down Expand Up @@ -400,7 +400,7 @@ func TestAccountModelBatchGetByStateChangeIDs(t *testing.T) {
require.NoError(t, err)

// Insert test transactions first
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at) VALUES ('tx1', 1, 'env1', 'res1', 'meta1', 1, NOW()), ('tx2', 2, 'env2', 'res2', 'meta2', 2, NOW())")
_, err = m.DB.ExecContext(ctx, "INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at) VALUES ('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, NOW()), ('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, NOW())")
require.NoError(t, err)

// Insert test operations first
Expand Down
16 changes: 8 additions & 8 deletions internal/data/ingest_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ func Test_IngestStoreModel_GetLedgerGaps(t *testing.T) {
// Insert consecutive ledgers: 100, 101, 102
for i, ledger := range []uint32{100, 101, 102} {
_, err := dbConnectionPool.ExecContext(ctx,
`INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 'res', 'meta', $3, NOW())`,
`INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', $3, NOW())`,
fmt.Sprintf("hash%d", i), i+1, ledger)
require.NoError(t, err)
}
Expand All @@ -245,8 +245,8 @@ func Test_IngestStoreModel_GetLedgerGaps(t *testing.T) {
// Insert ledgers 100 and 105, creating gap 101-104
for i, ledger := range []uint32{100, 105} {
_, err := dbConnectionPool.ExecContext(ctx,
`INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 'res', 'meta', $3, NOW())`,
`INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', $3, NOW())`,
fmt.Sprintf("hash%d", i), i+1, ledger)
require.NoError(t, err)
}
Expand All @@ -261,8 +261,8 @@ func Test_IngestStoreModel_GetLedgerGaps(t *testing.T) {
// Insert ledgers 100, 105, 110, creating gaps 101-104 and 106-109
for i, ledger := range []uint32{100, 105, 110} {
_, err := dbConnectionPool.ExecContext(ctx,
`INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 'res', 'meta', $3, NOW())`,
`INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', $3, NOW())`,
fmt.Sprintf("hash%d", i), i+1, ledger)
require.NoError(t, err)
}
Expand All @@ -278,8 +278,8 @@ func Test_IngestStoreModel_GetLedgerGaps(t *testing.T) {
// Insert ledgers 100 and 102, creating gap of just 101
for i, ledger := range []uint32{100, 102} {
_, err := dbConnectionPool.ExecContext(ctx,
`INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 'res', 'meta', $3, NOW())`,
`INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, $2, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', $3, NOW())`,
fmt.Sprintf("hash%d", i), i+1, ledger)
require.NoError(t, err)
}
Expand Down
94 changes: 51 additions & 43 deletions internal/data/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,23 @@ func Test_OperationModel_BatchInsert(t *testing.T) {
Hash: "tx1",
ToID: 1,
EnvelopeXDR: &envelope1,
ResultXDR: "result1",
FeeCharged: 100,
ResultCode: "TransactionResultCodeTxSuccess",
MetaXDR: &meta1,
LedgerNumber: 1,
LedgerCreatedAt: now,
IsFeeBump: false,
}
tx2 := types.Transaction{
Hash: "tx2",
ToID: 2,
EnvelopeXDR: &envelope2,
ResultXDR: "result2",
FeeCharged: 200,
ResultCode: "TransactionResultCodeTxSuccess",
MetaXDR: &meta2,
LedgerNumber: 2,
LedgerCreatedAt: now,
IsFeeBump: true,
}

// Insert transactions
Expand Down Expand Up @@ -251,19 +255,23 @@ func Test_OperationModel_BatchCopy(t *testing.T) {
Hash: "tx1",
ToID: 1,
EnvelopeXDR: &envelope1,
ResultXDR: "result1",
FeeCharged: 100,
ResultCode: "TransactionResultCodeTxSuccess",
MetaXDR: &meta1,
LedgerNumber: 1,
LedgerCreatedAt: now,
IsFeeBump: false,
}
tx2 := types.Transaction{
Hash: "tx2",
ToID: 2,
EnvelopeXDR: &envelope2,
ResultXDR: "result2",
FeeCharged: 200,
ResultCode: "TransactionResultCodeTxSuccess",
MetaXDR: &meta2,
LedgerNumber: 2,
LedgerCreatedAt: now,
IsFeeBump: true,
}

// Insert transactions
Expand Down Expand Up @@ -417,8 +425,8 @@ func Test_OperationModel_BatchCopy_DuplicateFails(t *testing.T) {

// Create a parent transaction that the operation will reference
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ('tx_for_dup_test', 1, 'env', 'res', 'meta', 1, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES ('tx_for_dup_test', 1, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', 1, $1, false)
`, now)
require.NoError(t, err)

Expand Down Expand Up @@ -498,18 +506,18 @@ func TestOperationModel_GetAll(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1),
('tx3', 3, 'env3', 'res3', 'meta3', 3, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true),
('tx3', 3, 'env3', 300, 'TransactionResultCodeTxSuccess', 'meta3', 3, $1, false)
`, now)
require.NoError(t, err)

// Create test operations
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO operations (id, tx_hash, operation_type, operation_xdr, ledger_number, ledger_created_at)
VALUES
VALUES
(1, 'tx1', 'payment', 'xdr1', 1, $1),
(2, 'tx2', 'create_account', 'xdr2', 2, $1),
(3, 'tx3', 'payment', 'xdr3', 3, $1)
Expand Down Expand Up @@ -545,11 +553,11 @@ func TestOperationModel_BatchGetByTxHashes(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1),
('tx3', 3, 'env3', 'res3', 'meta3', 3, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true),
('tx3', 3, 'env3', 300, 'TransactionResultCodeTxSuccess', 'meta3', 3, $1, false)
`, now)
require.NoError(t, err)

Expand Down Expand Up @@ -733,17 +741,17 @@ func TestOperationModel_BatchGetByTxHash(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true)
`, now)
require.NoError(t, err)

// Create test operations
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO operations (id, tx_hash, operation_type, operation_xdr, ledger_number, ledger_created_at)
VALUES
VALUES
(1, 'tx1', 'payment', 'xdr1', 1, $1),
(2, 'tx2', 'create_account', 'xdr2', 2, $1),
(3, 'tx1', 'payment', 'xdr3', 3, $1)
Expand Down Expand Up @@ -786,18 +794,18 @@ func TestOperationModel_BatchGetByAccountAddresses(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1),
('tx3', 3, 'env3', 'res3', 'meta3', 3, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true),
('tx3', 3, 'env3', 300, 'TransactionResultCodeTxSuccess', 'meta3', 3, $1, false)
`, now)
require.NoError(t, err)

// Create test operations
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO operations (id, tx_hash, operation_type, operation_xdr, ledger_number, ledger_created_at)
VALUES
VALUES
(1, 'tx1', 'payment', 'xdr1', 1, $1),
(2, 'tx2', 'create_account', 'xdr2', 2, $1),
(3, 'tx3', 'payment', 'xdr3', 3, $1)
Expand Down Expand Up @@ -834,17 +842,17 @@ func TestOperationModel_GetByID(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true)
`, now)
require.NoError(t, err)

// Create test operations
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO operations (id, tx_hash, operation_type, operation_xdr, ledger_number, ledger_created_at)
VALUES
VALUES
(1, 'tx1', 'payment', 'xdr1', 1, $1),
(2, 'tx2', 'create_account', 'xdr2', 2, $1)
`, now)
Expand Down Expand Up @@ -897,18 +905,18 @@ func TestOperationModel_BatchGetByStateChangeIDs(t *testing.T) {

// Create test transactions first
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES
('tx1', 1, 'env1', 'res1', 'meta1', 1, $1),
('tx2', 2, 'env2', 'res2', 'meta2', 2, $1),
('tx3', 3, 'env3', 'res3', 'meta3', 3, $1)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES
('tx1', 1, 'env1', 100, 'TransactionResultCodeTxSuccess', 'meta1', 1, $1, false),
('tx2', 2, 'env2', 200, 'TransactionResultCodeTxSuccess', 'meta2', 2, $1, true),
('tx3', 3, 'env3', 300, 'TransactionResultCodeTxSuccess', 'meta3', 3, $1, false)
`, now)
require.NoError(t, err)

// Create test operations
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO operations (id, tx_hash, operation_type, operation_xdr, ledger_number, ledger_created_at)
VALUES
VALUES
(1, 'tx1', 'payment', 'xdr1', 1, $1),
(2, 'tx2', 'create_account', 'xdr2', 2, $1),
(3, 'tx3', 'payment', 'xdr3', 3, $1)
Expand Down Expand Up @@ -965,8 +973,8 @@ func BenchmarkOperationModel_BatchInsert(b *testing.B) {
const txHash = "benchmark_tx_hash"
now := time.Now()
_, err = dbConnectionPool.ExecContext(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, 1, 'env', 'res', 'meta', 1, $2)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES ($1, 1, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', 1, $2, false)
`, txHash, now)
if err != nil {
b.Fatalf("failed to create parent transaction: %v", err)
Expand Down Expand Up @@ -1029,8 +1037,8 @@ func BenchmarkOperationModel_BatchCopy(b *testing.B) {
const txHash = "benchmark_tx_hash"
now := time.Now()
_, err = conn.Exec(ctx, `
INSERT INTO transactions (hash, to_id, envelope_xdr, result_xdr, meta_xdr, ledger_number, ledger_created_at)
VALUES ($1, 1, 'env', 'res', 'meta', 1, $2)
INSERT INTO transactions (hash, to_id, envelope_xdr, fee_charged, result_code, meta_xdr, ledger_number, ledger_created_at, is_fee_bump)
VALUES ($1, 1, 'env', 100, 'TransactionResultCodeTxSuccess', 'meta', 1, $2, false)
`, txHash, now)
if err != nil {
b.Fatalf("failed to create parent transaction: %v", err)
Expand Down
Loading
Loading