-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fixInnerObjTemplate
: Add STObject constructor to explicitly set inner object template
#4906
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #4906 +/- ##
===========================================
- Coverage 61.50% 61.47% -0.04%
===========================================
Files 797 797
Lines 70132 70156 +24
Branches 36245 36261 +16
===========================================
- Hits 43137 43127 -10
- Misses 19756 19786 +30
- Partials 7239 7243 +4 ☔ View full report in Codecov by Sentry. |
* Add comment to InnerObjectFormats * Use if initializer in makeInnerObject() * Add assert to STObject::set()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. One optional comment to consider.
After talking with some people, we would like to see a 2.0.2 for this fix that gets pushed ASAP. Waiting for 2.1.0 seems too long IMHO. Departing AMM and putting up an AMMv2 seems the best way forward to avoid another XLS20d situation. |
* Create AuctionSlot on AMMCreate and update on AMMDeposit * Add assert to check for AuctionSlot
There is another update. Please re-review. Thanks. |
* Remove comments * Refactor amendment changed code
* Change STObject::set() arg to rvalue ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Why don't we just make these fields Also you stated Isn't this exactly what default behavior is supposed to be? Thanks |
Changing the field's style is risky and it's a lot more code changes.
|
Ah I see thank you |
* Refactor auction slot amendment creation on initialize * Update a comment in amm test utils
Suggested commit message:
|
fixInnerObjTemplate
: Add STObject constructor to explicitly set inner object template
|
Add `STObject` constructor to explicitly set the inner object template. This allows certain AMM transactions to apply in the same ledger: There is no issue if the trading fee is greater than or equal to 0.01%. If the trading fee is less than 0.01%, then: - After AMM create, AMM transactions must wait for one ledger to close (3-5 seconds). - After one ledger is validated, all AMM transactions succeed, as appropriate, except for AMMVote. - The first AMMVote which votes for a 0 trading fee in a ledger will succeed. Subsequent AMMVote transactions which vote for a 0 trading fee will wait for the next ledger (3-5 seconds). This behavior repeats for each ledger. This has no effect on the ultimate correctness of AMM. This amendment will allow the transactions described above to succeed as expected, even if the trading fee is 0 and the transactions are applied within one ledger (block).
High Level Overview of Change
Add an
STObject
constructor overload that includes an additional bool argument to set the inner object template. Set the argument to true if the constructed object is an inner object and if thefixInnerObjTemplate
amendment is enabled.Context of Change
Currently, the inner object template is not set upon object creation. If the object contains an
soeDEFAULT
field, and this field is initially set to the default value, accessing the field results intefEXCEPTION
error. Conversely, if the top object'ssoeDEFAULT
field, initially set to the default value, is accessed, it returns the default value since top objects have the template set during construction. This fix aims to make the inner object behavior consistent with the top object behavior. The inner object must be explicitly constructed, as described in the summary, for this fix to work.Currently, two
AMM
fields,sfTradingFee
andsfDiscountedFee
, included in the inner objectssfVoteEntry
andsfAuctionSlot
respectively, are declared assoeDEFAULT
fields. This fix employs the newSTObject
constructor when constructing inner objects that include these fields.Type of Change
.gitignore
, formatting, dropping support for older tooling)Test Plan
AMM
unit-test is extended with a test, which demonstrates the behavior before and after this fix.