Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions tools/generate_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def _add_line(line: str) -> None:
# Example line:
# STYPE(STI_UINT32, 2) \
type_hits = re.findall(
r"^ *STYPE\(STI_([^ ]*?) *, *([0-9-]+) *\) *\\?$", sfield_h, re.MULTILINE
r"^ *STYPE\(STI_([^ ]*?)[ \n]*,[ \n]*([0-9-]+)[ \n]*\)[ \n]*\\?$",
sfield_h,
re.MULTILINE,
)
# name-to-value map - needed for SField processing
type_map = {x[0]: x[1] for x in type_hits}
Expand Down Expand Up @@ -204,7 +206,7 @@ def _is_signing_field(t: str, not_signing_field: str) -> str:
# TYPED_SFIELD(sfFee, AMOUNT, 8)
# UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::sMD_Default, SField::notSigning)
sfield_hits = re.findall(
r"^ *[A-Z]*TYPED_SFIELD *\( *sf([^,\n]*),[ \n]*([^, \n]+)[ \n]*,[ \n]*"
r"^ *[A-Z]*TYPED_SFIELD[ \n]*\([ \n]*sf([^,\n]*),[ \n]*([^, \n]+)[ \n]*,[ \n]*"
r"([0-9]+)(,.*?(notSigning))?",
sfield_macro_file,
re.MULTILINE,
Expand Down Expand Up @@ -252,7 +254,8 @@ def _unhex(x: str) -> str:
# Example line:
# LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
lt_hits = re.findall(
r"^ *LEDGER_ENTRY[A-Z_]*\(lt[A-Z_]+ *, *([xX0-9a-fA-F]+) *, *([^,]+), *([^,]+), "
r"^ *LEDGER_ENTRY[A-Z_]*\(lt[A-Z_]+[ \n]*,[ \n]*([xX0-9a-fA-F]+)[ \n]*,[ \n]*"
r"([^,]+),[ \n]*([^,]+), "
r"\({$",
ledger_entries_file,
re.MULTILINE,
Expand All @@ -277,7 +280,8 @@ def _unhex(x: str) -> str:

# Parse TER codes
ter_code_hits = re.findall(
r"^ *((tel|tem|tef|ter|tes|tec)[A-Z_]+)( *= *([0-9-]+))? *,? *(\/\/[^\n]*)?$",
r"^ *((tel|tem|tef|ter|tes|tec)[A-Z_]+)([ \n]*=[ \n]*([0-9-]+))?[ \n]*,?[ \n]*"
r"(\/\/[^\n]*)?$",
ter_h,
re.MULTILINE,
)
Expand Down Expand Up @@ -321,7 +325,7 @@ def _unhex(x: str) -> str:
# Example line:
# TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({
tx_hits = re.findall(
r"^ *TRANSACTION\(tt[A-Z_]+ *,* ([0-9]+) *, *([A-Za-z]+).*$",
r"^ *TRANSACTION\(tt[A-Z_]+[ \n]*,[ \n]*([0-9]+)[ \n]*,[ \n]*([A-Za-z]+).*$",
transactions_file,
re.MULTILINE,
)
Expand Down
27 changes: 24 additions & 3 deletions xrpl/core/binarycodec/definitions/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,16 @@
"type": "UInt32"
}
],
[
"MutableFlags",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 53,
"type": "UInt32"
}
],
[
"IndexNext",
{
Expand Down Expand Up @@ -2130,6 +2140,16 @@
"type": "Number"
}
],
[
"DummyInt32",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 1,
"type": "Int32"
}
],
[
"TransactionMetaData",
{
Expand Down Expand Up @@ -3276,7 +3296,6 @@
"terLAST": -91,
"terNO_ACCOUNT": -96,
"terNO_AMM": -87,
"tedADDRESS_COLLISION": -86,
"terNO_AUTH": -95,
"terNO_LINE": -94,
"terNO_RIPPLE": -90,
Expand Down Expand Up @@ -3342,10 +3361,10 @@
"TicketCreate": 10,
"TrustSet": 20,
"UNLModify": 102,
"VaultCreate": 65,
"VaultClawback": 70,
"VaultDeposit": 68,
"VaultCreate": 65,
"VaultDelete": 67,
"VaultDeposit": 68,
"VaultSet": 66,
"VaultWithdraw": 69,
"XChainAccountCreateCommit": 44,
Expand All @@ -3367,6 +3386,8 @@
"Hash160": 17,
"Hash192": 21,
"Hash256": 5,
"Int32": 10,
"Int64": 11,
Comment on lines +3389 to +3390
Copy link
Collaborator

Choose a reason for hiding this comment

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

I got this comment from coderabbit when I added these two lines in my PR. Is the comment valid and should we remove these two lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not the only SType that isn't included in the codec, if you take a look at the full list. It doesn't matter as long as there are no fields that use the SType (which there aren't).

"Issue": 24,
"LedgerEntry": 10002,
"Metadata": 10004,
Expand Down