XRPLF / xrpl4j

A 100% Java implementation to interact with the XRP Ledger.
ISC License
80 stars 45 forks source link

LedgerResult deserialization: Unmapped AccountSetFlag #514

Open nkramer44 opened 6 months ago

nkramer44 commented 6 months ago

rippled does not seem to validate that AccountSet transactions use valid asf flags. We have logic in AccountSet to try to work around this by having a clearFlagRawValue and setFlagRawValue, and trying to normalize those values into clearFlag and setFlag. The normalization logic checks to see if the raw value is a valid AccountSetFlag by determining if it is less than or equal to the maximum AccountSetFlag value. If it is, it sets the typed field to the mapped value. If it is not, it leaves the typed field empty. This works in most cases, but if an AccountSet transaction gets validated with a ClearFlag or SetFlag value of 11, this logic does not work (11 is reserved for hooks). When the flag is 11, the normalization function incorrectly registers the value as a valid AccountSetFlag and calls AccountSetFlag.forValue() which then throws an exception.

sappenin commented 6 months ago

What should the fix logic be here?