From cdc7114be83e5423e1bb3fefaec097185f09cf86 Mon Sep 17 00:00:00 2001 From: George Date: Mon, 21 Aug 2023 14:27:40 -0700 Subject: [PATCH] Properly set maximum slippage in case of LP overflows (#5000) --- services/horizon/CHANGELOG.md | 11 +++++++++-- .../internal/ingest/processors/trades_processor.go | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 2c1628d440..823078bbc3 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -6,8 +6,15 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased -- The command line flag --remote-captive-core-url has been removed as remote captive core functionality is now deprecated ([4940](https://github.com/stellar/go/pull/4940)). -- Added new command-line flag --network to specify the Stellar network (pubnet or testnet), aiming at simplifying the configuration process by automatically configuring the following parameters based on the chosen network: --history-archive-urls, --network-passphrase, --captive-core-config-path. ([4949](https://github.com/stellar/go/pull/4949)). +### Breaking Changes +- The command line flag `--remote-captive-core-url` has been removed, as remote captive core functionality is now deprecated ([4940](https://github.com/stellar/go/pull/4940)). + +### Added +- Added new command-line flag `--network` to specify the Stellar network (pubnet or testnet), aiming at simplifying the configuration process by automatically configuring the following parameters based on the chosen network: `--history-archive-urls`, `--network-passphrase`, and `--captive-core-config-path` ([4949](https://github.com/stellar/go/pull/4949)). + +### Fixed +- The same slippage calculation from the [`v2.26.1`](#2261) hotfix now properly excludes spikes for smoother trade aggregation plots ([4999](https://github.com/stellar/go/pull/4999)). + ## 2.26.1 diff --git a/services/horizon/internal/ingest/processors/trades_processor.go b/services/horizon/internal/ingest/processors/trades_processor.go index 232f68cfeb..b536b15bc4 100644 --- a/services/horizon/internal/ingest/processors/trades_processor.go +++ b/services/horizon/internal/ingest/processors/trades_processor.go @@ -251,8 +251,8 @@ func (p *TradeProcessor) roundingSlippage( ) if !ok { // Temporary workaround for https://github.com/stellar/go/issues/4203 - // Give strict receives that would underflow here, maximum slippage so - // they get excluded. + // Given strict receives that would underflow here, set maximum + // slippage so they get excluded. roundingSlippageBips = xdr.Int64(math.MaxInt64) } return null.IntFrom(int64(roundingSlippageBips)), nil @@ -267,9 +267,9 @@ func (p *TradeProcessor) roundingSlippage( ) if !ok { // Temporary workaround for https://github.com/stellar/go/issues/4203 - // Given strict receives that would overflow here, minimum slippage + // Given strict sends that would overflow here, set maximum slippage // so they get excluded. - roundingSlippageBips = xdr.Int64(math.MinInt64) + roundingSlippageBips = xdr.Int64(math.MaxInt64) } return null.IntFrom(int64(roundingSlippageBips)), nil default: