forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 230
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 several bugs in fee system #426
Merged
dexX7
merged 4 commits into
OmniLayer:omnicore-0.0.10
from
zathras-crypto:0.0.11-2-Z-FixFees
Nov 13, 2016
Merged
Fix several bugs in fee system #426
dexX7
merged 4 commits into
OmniLayer:omnicore-0.0.10
from
zathras-crypto:0.0.11-2-Z-FixFees
Nov 13, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Notes: The following shows a sell for 2000 Indiv for 1.0 Div. The original offer "matches" : [ { "txid" : "da18e6d80b8340d8f872ff14ff002ab645552760d12060e7e50d62d6a20539ee", "block" : 126, "address" : "mpwugZU3hfVkQzBumVNAkqB3cJKkpNxotJ", "amountsold" : "1999", "amountreceived" : "1.00000000", "tradingfee" : "0.00000001" } ], "block" : 125, The new offer (the liquidity taker): "matches" : [ { "txid" : "4812b0389017b479d3fa8a0674d5b7403d07cd6a0d11d4133eb281816a91d7a8", "block" : 126, "address" : "mpwugZU3hfVkQzBumVNAkqB3cJKkpNxotJ", "amountsold" : "1.00000000", "amountreceived" : "1999" } ], "block" : 126, This has the following bugs: * Trading fee incorrectly appears in original offer matches when they did not pay any fee * Trading fee does not appear in liquidity taking offer matches when they did pay a fee * Trading fee shows incorrect divisibility * Amount sold attribute in the original offers matches array shows 1999 sold, when in fact 2000 were sold This commit squashes these issues with an update to getMatchingTrades. Afterwards the same test gives results: The original offer: "matches" : [ { "txid" : "612baeb13daf43fa3e9c5e46b736f7b07d1d395c3b2a578befa4060d037c2594", "block" : 126, "address" : "mta18HMfntLhXHWezu4Nuc4Wzsxw2aDxKv", "amountsold" : "2000", "amountreceived" : "1.00000000", "tradingfee" : "0.00000000" } ], "block" : 125, The new offer (the liquidity taker): "matches" : [ { "txid" : "0214cf43bed73cb6432f9ecc103421ed33ec1c49d2005e01d180b38811f6a87f", "block" : 126, "address" : "mta18HMfntLhXHWezu4Nuc4Wzsxw2aDxKv", "amountsold" : "1.00000000", "amountreceived" : "1999", "tradingfee" : "1" } ], "block" : 126,
Updates to the test script (will follow later) now check that OMNI pair trades are free. Prior to this change the results were: Testing a trade against self where the first token is OMNI * Executing the trade * Verifiying the results # Checking no fee was taken... * Checking the original trade matches to confirm trading fee was 0...PASS * Checking the new trade matches to confirm trading fee was 0...FAIL (result:1) * Checking the fee cache is empty for property 1...PASS * Checking the fee cache is empty for property 3...FAIL (result:1) * Checking the trading address didn't lose any #1 tokens after trade...PASS * Checking the trading address didn't lose any #3 tokens after trade...FAIL (result:9999999) After this change, the same test provides the following results: Testing a trade against self where the first token is OMNI * Executing the trade * Verifiying the results # Checking no fee was taken... * Checking the original trade matches to confirm trading fee was 0...PASS * Checking the new trade matches to confirm trading fee was 0...PASS * Checking the fee cache is empty for property 1...PASS * Checking the fee cache is empty for property 3...PASS * Checking the trading address didn't lose any #1 tokens after trade...PASS * Checking the trading address didn't lose any #3 tokens after trade...PASS
Note: Previous script tested for fees by trading Omni tokens which should have been free. This updated script checks that Omni based trades are indeed free, activates all pair trading and updates the property handling for the fee tests.
Note: bypass used to run test script only, not appropriate for mainnet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes several bugs in the fee system, specifically:
My own output of the updated test script is below for those who don't want to recompile with dev Omni disabled.
Feedback welcomed :)
Thanks
Z