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

Backfill fee stats data to make the client compatible with horizon 1.X and 0.X. #2290

Merged

Conversation

abuiles
Copy link
Contributor

@abuiles abuiles commented Feb 19, 2020

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've updated the relevant CHANGELOG (here for Horizon) if
    needed with deprecations, added features, breaking changes, and DB schema changes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

Make the client compatible with fee stats data from Horizon 1.X or 0.X.

Why

There are a couple of breaking changes in the Horizon response which we are handling in horizonclient 2.0 in a backward compatibility manner, for example, being able to read a number or a string in some of the response fields. It allows a smooth transition between the new and old versions of Horizon.

This PR follows the same approach for fee stats, Horizon is dropping all the _accepted_fee fields in fee_stats but instead of adding this breaking change in the next release of the client, we'll make it backward compatible, so people can still use p99_accepted_fields in their code and have time to upgrade up to horizonclient 3.0.

Known limitations

[TODO or N/A]

Copy link
Member

@ire-and-curses ire-and-curses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about the tests - probably I'm misunderstanding something

@@ -1363,19 +1363,37 @@ var feesResponse = `{
"last_ledger": "22606298",
"last_ledger_base_fee": "100",
"ledger_capacity_usage": "0.97",
"min_accepted_fee": "130",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these fields be kept, not removed? These are the ones being backfilled right, so we'd expect them in the response, wouldn't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ire-and-curses no, they are being removed from the response and then we backfill from the values in max_fee -- but the backfill doesn't happen in the response but inside the FeeStat struct which is what we do here
https://github.com/stellar/go/pull/2290/files#diff-a12e7e90b7de9b52aa97a8dca1ea276cR324

@abuiles abuiles merged commit 1a06a6f into stellar:release-horizonclient-v2.1.0 Feb 20, 2020
@abuiles abuiles deleted the backfill-accepted-fees branch February 20, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants