Skip to content

Commit

Permalink
services/horizon/internal/ingest/processors: Accommodate eviction of …
Browse files Browse the repository at this point in the history
…soroban ledger entries in asset stats endpoint (#5033)
  • Loading branch information
tamirms authored Nov 17, 2023
1 parent d0c8a91 commit 11e5322
Show file tree
Hide file tree
Showing 30 changed files with 3,296 additions and 1,510 deletions.
2 changes: 2 additions & 0 deletions protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,14 @@ type AssetStat struct {
NumClaimableBalances int32 `json:"num_claimable_balances"`
NumLiquidityPools int32 `json:"num_liquidity_pools"`
NumContracts int32 `json:"num_contracts"`
NumArchivedContracts int32 `json:"num_archived_contracts"`
// Action needed in release: horizon-v3.0.0: deprecated field
Amount string `json:"amount"`
Accounts AssetStatAccounts `json:"accounts"`
ClaimableBalancesAmount string `json:"claimable_balances_amount"`
LiquidityPoolsAmount string `json:"liquidity_pools_amount"`
ContractsAmount string `json:"contracts_amount"`
ArchivedContractsAmount string `json:"archived_contracts_amount"`
Balances AssetStatBalances `json:"balances"`
Flags AccountFlags `json:"flags"`
}
Expand Down
5 changes: 3 additions & 2 deletions services/horizon/docker/captive-core-integration-tests.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
PEER_PORT=11725
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

UNSAFE_QUORUM=true
FAILURE_SAFETY=0

ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

[[VALIDATORS]]
NAME="local_core"
HOME_DOMAIN="core.local"
Expand Down
5 changes: 3 additions & 2 deletions services/horizon/docker/stellar-core-integration-tests.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

NETWORK_PASSPHRASE="Standalone Network ; February 2017"

Expand All @@ -15,11 +14,13 @@ FAILURE_SAFETY=0

DATABASE="postgresql://user=postgres password=mysecretpassword host=core-postgres port=5641 dbname=stellar"

TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true

[QUORUM_SET]
THRESHOLD_PERCENT=100
VALIDATORS=["GD5KD2KEZJIGTC63IGW6UMUSMVUVG5IHG64HUTFWCHVZH2N2IBOQN7PS"]

[HISTORY.vs]
get="cp history/vs/{0} {1}"
put="cp {0} history/vs/{1}"
mkdir="mkdir -p history/vs/{0}"
mkdir="mkdir -p history/vs/{0}"
2 changes: 1 addition & 1 deletion services/horizon/internal/actions/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (handler AssetStatsHandler) validateAssetParams(code, issuer string, pq db2
func (handler AssetStatsHandler) findIssuersForAssets(
ctx context.Context,
historyQ *history.Q,
assetStats []history.ExpAssetStat,
assetStats []history.AssetAndContractStat,
) (map[string]history.AccountEntry, error) {
issuerSet := map[string]bool{}
issuers := []string{}
Expand Down
5 changes: 5 additions & 0 deletions services/horizon/internal/actions/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func TestAssetStats(t *testing.T) {
Amount: "0.0000001",
NumAccounts: usdAssetStat.NumAccounts,
ContractsAmount: "0.0000000",
ArchivedContractsAmount: "0.0000000",
Asset: base.Asset{
Type: "credit_alphanum4",
Code: usdAssetStat.AssetCode,
Expand Down Expand Up @@ -204,6 +205,7 @@ func TestAssetStats(t *testing.T) {
ClaimableBalancesAmount: "0.0000000",
LiquidityPoolsAmount: "0.0000000",
ContractsAmount: "0.0000000",
ArchivedContractsAmount: "0.0000000",
Amount: "0.0000023",
NumAccounts: etherAssetStat.NumAccounts,
Asset: base.Asset{
Expand Down Expand Up @@ -251,6 +253,7 @@ func TestAssetStats(t *testing.T) {
LiquidityPoolsAmount: "0.0000000",
Amount: "0.0000001",
ContractsAmount: "0.0000000",
ArchivedContractsAmount: "0.0000000",
NumAccounts: otherUSDAssetStat.NumAccounts,
Asset: base.Asset{
Type: "credit_alphanum4",
Expand Down Expand Up @@ -299,6 +302,7 @@ func TestAssetStats(t *testing.T) {
LiquidityPoolsAmount: "0.0000000",
Amount: "0.0000111",
ContractsAmount: "0.0000000",
ArchivedContractsAmount: "0.0000000",
NumAccounts: eurAssetStat.NumAccounts,
Asset: base.Asset{
Type: "credit_alphanum4",
Expand Down Expand Up @@ -476,6 +480,7 @@ func TestAssetStatsIssuerDoesNotExist(t *testing.T) {
LiquidityPoolsAmount: "0.0000000",
Amount: "0.0000001",
ContractsAmount: "0.0000000",
ArchivedContractsAmount: "0.0000000",
NumAccounts: usdAssetStat.NumAccounts,
Asset: base.Asset{
Type: "credit_alphanum4",
Expand Down
60 changes: 0 additions & 60 deletions services/horizon/internal/db2/assets/asset_stat.go

This file was deleted.

107 changes: 0 additions & 107 deletions services/horizon/internal/db2/assets/asset_stat_test.go

This file was deleted.

Loading

0 comments on commit 11e5322

Please sign in to comment.