Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update lisk-transactions to use encoded data - Closes #5270 #5366

Merged
merged 16 commits into from
May 29, 2020

Conversation

ManuGowda
Copy link
Contributor

@ManuGowda ManuGowda commented May 27, 2020

What was the problem?

This PR resolves #5270

How was it solved?

  • Introduce new transaction schema
  • Remove toJSON, assetToJSON, stringify
  • Expose schema from transactions
  • Update transaction interface adapter to support decoding
  • Update base transaction and custom transactions to support encoding and decoding

How was it tested?

Base automatically changed from 5358-update_crypto_buffer to feature/update_to_use_codec May 28, 2020 08:56
@ManuGowda ManuGowda force-pushed the 5270-encode-decode-transactions branch from d6c8702 to 15a9ea1 Compare May 28, 2020 12:20
@ManuGowda ManuGowda requested a review from shuse2 May 28, 2020 12:20
@ManuGowda ManuGowda force-pushed the 5270-encode-decode-transactions branch from 9886e56 to 08cb5b3 Compare May 28, 2020 14:29
@ManuGowda ManuGowda marked this pull request as ready for review May 28, 2020 14:40
@ManuGowda ManuGowda requested a review from pablitovicente May 28, 2020 14:41
return binaryMessage;
}

// First decode base message and then decode asset
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this done in two steps instead of doing it in one decode() call? I think it might be faster in general to call decode only once if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean, create the whole schema and decode? I followed the LIP, according to LIP we need to decode root message first and then decode asset https://github.com/LiskHQ/lips/blob/master/proposals/lip-0028.md#deserialization

@@ -31,67 +30,30 @@ export interface DelegateAsset {
readonly username: string;
}

export const delegateAssetFormatSchema = {
export const delegateRegistrationAssetSchema = {
$id: 'lisk/delegate-registration-transaction',
Copy link
Contributor

Choose a reason for hiding this comment

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

Not to do in this PR but should I create an issue to hash $id from schemas to avoid having this as the key of the object literal holding the schema cache? (it will work like this but just in case someone uses something different here in the future or in customapps)

@shuse2 shuse2 linked an issue May 29, 2020 that may be closed by this pull request
@shuse2 shuse2 merged commit 682e333 into feature/update_to_use_codec May 29, 2020
@shuse2 shuse2 deleted the 5270-encode-decode-transactions branch May 29, 2020 08:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update lisk-transactions to use encoded data
3 participants