Conversation
1f4aedd to
22d44cb
Compare
|
Need to add the limit check (10 < L < 400) on all requests with limit as param. Could move the logic from account_lines into a helped method and call that in all places? |
Not all functions that have a limit have the same bounds, e.g. crawl shards 1<= l <= 3, account nfts 20 <= l <= 400 Functions that take a limit also explicitly state that invalid values are changed to the closest valid value. Is it really necessary to validate the values when the ledger will accept and correct invalid values? |
|
Ahh fairs if they will be different for others. It's just that some with the same bounds have been validated and some not (e.g. account_channels and account_lines). Unless i'm mistaken. Does account_lines not need that limit validation then? |
|
I don't know of any method where an invalid limit will return with an error |
There was a problem hiding this comment.
do we need to check for NFTokenID not empty?
There was a problem hiding this comment.
check for pub key not empty and potentially that it's base58 encoded?
There was a problem hiding this comment.
Channel id is 64 char hex string, worth checking for the validate?
XRP amount looks like a required parameter.
also a check for “The request must specify exactly one of secret, seed, seed_hex, or passphrase.”
There was a problem hiding this comment.
I implemented XRPAmount as an integer, so if it is not set it would be 0 which would be valid
There was a problem hiding this comment.
Looks like these are required:
- XRP Amount
- Channel id (64 char hex string)
- Public key (hex or base58 string)
- Signature (hex string)
There was a problem hiding this comment.
XRP Amount same as above, 0 is valid
There was a problem hiding this comment.
should we check if ledger_hash is provided that it's a 20 byte hex string?
| if a.Account == "" { | ||
| return errors.New("no account ID specified") | ||
| func (r *AccountChannelsRequest) Validate() error { | ||
| if err := r.Account.Validate(); err != nil { |
There was a problem hiding this comment.
in the validate method there is still a
// TODO checksum
does that need adding still?
There was a problem hiding this comment.
yeah, I have not added any intricacies for checking valid values for thinks like addresses, keys or object IDs with encoded fields
| return "account_lines" | ||
| } | ||
|
|
||
| func (r *AccountLinesRequest) Validate() error { |
There was a problem hiding this comment.
Need to also run the account.Validate on the 'peer' parameter if it is present
|
|
||
| return nil | ||
| } | ||
|
|
There was a problem hiding this comment.
Do we need to add the 'amm' and 'nft_page' options too? They're not in the request struct so may have been recently added
There was a problem hiding this comment.
AMM does not appear to be getting approved too soon
we can do AMM support once it is reaching final stages of approval into rippled
|
|
||
| if r.RippleState != nil { | ||
| setCount++ | ||
| if err := r.Offer.Validate(); err != nil { |
There was a problem hiding this comment.
should this be r.rippleState.Validate() ?
|
|
||
| func (*DirectoryEntryReq) Validate() error { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
should this have the logic for: requires either dir_root or owner as a sub-field
|
|
||
| func (*TicketEntryReq) LedgerEntryRequestField() {} | ||
|
|
||
| func (r *TicketEntryReq) Validate() error { |
There was a problem hiding this comment.
Number also required here I think
| } | ||
|
|
||
| func (*TxRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
Think we need to validate transaction is not empty here?
| } | ||
|
|
||
| func (*TransactionEntryRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
Again, do we not need to validate the tx_hash is not empty here?
| } | ||
|
|
||
| func (*SubmitMultisignedRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
Need to validate on the tx_json as it's required. Think just a nil check would be ok here without getting into the json itself?
| } | ||
|
|
||
| func (*SubmitRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
Need to check tx_blob as it's required
There was a problem hiding this comment.
Ohhhh I've just thought - are these going to be validated differently? We need to build out our submit methods but these will build out the tx_blob anyway, so won't need to validate on it?
There was a problem hiding this comment.
We can have this request constructed by a helper method that would validate the transaction during construction
This request should probably still validate that the blob is at least set
| } | ||
|
|
||
| func (*WalletProposeRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
key_type is a required param
Need to add the logic for:
You must provide at most one of the following fields: passphrase, seed, or seed_hex
So cannot have more than one of them.
There was a problem hiding this comment.
Or ir does say you can run it with no params to create a random seed, so maybe don't need the required check on key_type
| return "download_shard" | ||
| } | ||
|
|
||
| func (*DownloadShardRequest) Validate() error { |
There was a problem hiding this comment.
should we assert on shards not being nil? Bit stupid if user does send empty tho
| } | ||
|
|
||
| func (*ConnectRequest) Validate() error { | ||
| return nil |
| } | ||
|
|
||
| func (*PeerReservationAddRequest) Validate() error { | ||
| return nil |
There was a problem hiding this comment.
public_key is a required field. Also should be base58 encoded, so should we do a check on that? Not sure yet how will talk to Josh
| return "peer_reservations_del" | ||
| } | ||
|
|
||
| func (*PeerReservationDelRequest) Validate() error { |
There was a problem hiding this comment.
Again need to think how we do a check on the public_key
| return "get_counts" | ||
| } | ||
|
|
||
| func (*GetCountsRequest) Validate() error { |
There was a problem hiding this comment.
not sure if min_count is really required or not
There was a problem hiding this comment.
Does this cover these cases?:
Provide the seed in the secret field and omit the key_type field. This value can be formatted as an XRP Ledger [base58](https://xrpl.org/base58-encodings.html) seed, RFC-1751, hexadecimal, or as a string passphrase. (secp256k1 keys only) Provide a key_type value and exactly one of seed, seed_hex, or passphrase. Omit the secret field. (Not supported by the commandline syntax.)
There was a problem hiding this comment.
I currently don't do any validation of string format
There was a problem hiding this comment.
Fee and Sequence must be provided in the tx_json object and also signingpubkey must be provided with an empty string as the value. Can we do this in validate func?
Also below is similar to sign_request:
`You must provide exactly 1 field with the secret key, which can be either of the following:
Provide a secret value and omit the key_type field. This value can be formatted as an XRP Ledger base58 seed, RFC-1751, hexadecimal, or as a string passphrase. (secp256k1 keys only)
Provide a key_type value and exactly one of seed, seed_hex, or passphrase. Omit the secret field. (Not supported by the commandline syntax.)`
No description provided.