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

fix: get price boundary logic, remove useless query, enhance ci #144

Merged
merged 14 commits into from
Apr 3, 2023

Conversation

owen-reorg
Copy link
Contributor

@owen-reorg owen-reorg commented Mar 29, 2023

Description

Change the boundary logic for getting the price is SP.

Rationale

Previously GetPriceByTime in SP module will return the latest price less than or equal to the given time.
It may cause a problem that the prices returned are different for a specific time.

Example

There are transactions in one block:

  1. let p1 = get_price(now)
  2. set_price(now, p2)
  3. get_price(now) will return p2, which may be different with p1

We change the boundary logic to make it return the latest price less than(other than less than or equal to) the given time. Thus get_price(now) in step 3 will return p1. And for a specific parameter t in get_price, the result will always be the same.

Changes

Notable changes:

  • get price boundary logic
  • remove an useless query in payment module
  • add a check in ci to ensure that the protobuf generated go files are always submitted together with the protobuf files change

@owen-reorg owen-reorg changed the title fix: get price boundary logic, remove useless AutoSettleRecord query fix: get price boundary logic, remove useless query, enhance ci Mar 29, 2023
Copy link
Contributor

@fynnss fynnss left a comment

Choose a reason for hiding this comment

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

LGTM

Adjust the method of searching prices based on timestamp from [) to (] to address boundary issues.

@owen-reorg owen-reorg added the r4r label Mar 29, 2023
@unclezoro unclezoro merged commit fafcdf1 into develop Apr 3, 2023
@unclezoro unclezoro deleted the fix-price-time branch April 18, 2023 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants