blockset-corp / walletkit

MIT License
80 stars 46 forks source link

CORE-1189: Extend WKTransferSubmitError #393

Closed EBGToo closed 2 years ago

EBGToo commented 3 years ago

This extends the public interface of WKTransferSubmitErrorType and WKTransferIncludeStatusType which are used in WKTransferState.

Also extends WKClientErrorType and the Swift/Java interface for SystemClientError and SystemClientSubmitError to determine error states from Blockset queries. The query error responses are 'mapped' to the WKTransfer* errors.

EBGToo commented 3 years ago

@DrewCarlson, @brd-jwheeler Marking this ready to review. I've not seen data from Blockset yet; if issues arise we'll fix as they occur.

Small App changes are required related to Transaction confirmation and submission. They'll show as compiler errors upon App compilation and adjustment should be obvious.

EBGToo commented 2 years ago

Tested this on iOS and Android by injecting Ethereum Transaction Errors (zeroed out the nonce, gas Price to zero, gas Limit to zero, signature vrs.s to zero, and initial 4 bytes in the serialization to zero). Expected Blockset status to reflect the errors. Deployed an updated Blockset to 'pre-prod'; pointed query.createTransaction (aka 'submit') to 'pre-prod' and then created flawed transactions.

All errors were reported correctly, from WalletKit and then through iOS/Android... with the exception of gas Price to zero - apparently Ethereum Nodes quietly accept that.

None of these errors, except nonce-too-low, are realistic WalletKit errors. But injecting them was useful for 'WK -> Blockset -> WK' end-to-end testing.

The PR is for a merge to develop. Likely that develop does not make it to master. Sigh.

Requires minimal iOS/Android changes for the new SubmitError, IncludeError, etc. All compiler flagged.