-
Notifications
You must be signed in to change notification settings - Fork 87
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 a mix up with AccountSet flags #524
Conversation
Why is this PR necessary? |
Nice catch! I am in favor of the tf flags and |
I think the current implementation is confusing and faulty. Let me showcase this by example (code taken from unit tests) actual = models.AccountSet(
account=ACCOUNT,
flags=models.AccountSetFlagInterface(
asf_account_tx_id=True,
asf_authorized_nftoken_minter=True,
asf_default_ripple=True,
asf_deposit_auth=True,
asf_disable_master=True,
asf_disallow_xrp=True,
asf_global_freeze=True,
asf_no_freeze=True,
asf_require_auth=True,
asf_require_dest=True,
),
) As outlined before there are two kinds of AccountSet flags, the The above code has several issues:
|
I think the In regards to naming. Currently the pattern used throughout the library for naming flags seems to be tx name + 'Flag'. For example:
Following that would result in:
The only drawback/consideration would have to be that we are "switching" the flags that were defined in |
Assuming this PR moves forward eventually, I will have to make some changes:
|
@rikublock would you be able to make those changes now? @mvadari do you have an opinion on the enum names? |
I like these names and agree with the logic. |
I'll take a look at it this week. |
As a rough plan of action, I think these changes should be included in xrpl-py 2.0, so I'll take it as an action item today/tomorrow to get the xrpl-py 2.0 branch up to date so we can point it at that branch without a lot of unrelated changes appearing in the changelog :) |
I added the outstanding changes and fixes. I also split the commits to make each individual change easier to understand/review.
Sounds good. I agree, it might be best to include this in a major release as the PR contains somewhat breaking changes. |
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.
LGTM - one last thing though could you add a note in the HISTORY.md file about the changes? (I'd recommend including both the name change & bug fix as separate bullets so it's very clear to future readers that there's something they have to do to update)
Note: AccountSetAsfFlags are not bit-field flags and therefore do not require a FlagInterface. At most one asf flag can be set per transaction.
@rikublock Ah, didn't realize you were changing things at the moment - I just was rebasing to try to fix the merge conflicts. It seems I have included all the above commits in the final version. Are there any other changes you were hoping to make before we merge it? |
I think I may have misinterpreted the Git history - if there are changes we need to make we can do a follow up PR :) |
@JST5000 As far as I am concerned this PR included all the necessary changes. |
* rename AccountSetFlag -> AccountSetAsfFlags * add AccountSetFlag enum to represent transaction flags Note: AccountSetAsfFlags are not bit-field flags and therefore do not require a FlagInterface. At most one asf flag can be set per transaction.
* rename AccountSetFlag -> AccountSetAsfFlags * add AccountSetFlag enum to represent transaction flags Note: AccountSetAsfFlags are not bit-field flags and therefore do not require a FlagInterface. At most one asf flag can be set per transaction.
* rename AccountSetFlag -> AccountSetAsfFlags * add AccountSetFlag enum to represent transaction flags Note: AccountSetAsfFlags are not bit-field flags and therefore do not require a FlagInterface. At most one asf flag can be set per transaction.
High Level Overview of Change
asf
flags (this could be considered a breaking change)AccountSetTfFlagAccountSetFlag (name adjusted, see discussion below); defines transactiontf
flagstf
flagsContext of Change
AccountSet
has two types of flags.SetFlag
/ClearFlag
field, limited to one per transactionFlags
field, multiple possible (bit-flags)(
AccountSetAsfFlag
are not bit-field flags and therefore do not require aFlagInterface
)Reference:
Similar to the implementation found in the xrpl.js framework, this PR creates an enum for each type of flag.
Type of Change
Test Plan
poetry run poe test_unit