Transia-RnD / XrplCSharp

A C# library to interact with the XRP Ledger (XRPL) blockchain
Apache License 2.0
13 stars 6 forks source link

Transaction Validation #51

Closed dangell7 closed 1 year ago

dangell7 commented 1 year ago

The transactions in the js/py library include a validation function.

See here for example

We need to add this validation to every transaction.

  1. Write the validation file for the transaction
  2. Connect the validation function to the transaction validation. Main Validation is here

JS

Transaction Validation Main Function:

https://github.com/XRPLF/xrpl.js/blob/984a58e642a4cde09aee320efe195d4e651b7733/packages/xrpl/src/models/transactions/transaction.ts#L99

TrustSet Validation Function:

https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/trustSet.ts#L127

dangell7 commented 1 year ago

For an example we will use the TrustSet Tx.

We already validate below in cs, but in the js function there is a few extra validation methods. The basic process is validate Required/Optional then validate type, then theres some clever validation on some transactions.

https://github.com/Transia-RnD/XrplCSharp/blob/d4473d36ebd148c72631a9dda08dc470d3905676/Base/Xrpl.BinaryCodec/Transactions/TxFormat.cs#L226

I think we should refactor them into one function on the truncation just like they did in JS. So if you can copy what was done in the TxFormat that might speed it up for a few validation checks.

dangell7 commented 1 year ago

https://github.com/Transia-RnD/XrplCSharp/pull/62