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

Simplify getBytes and getSigningBytes functions of lisk-transactions #9061

Closed
bobanm opened this issue Oct 4, 2023 · 0 comments · Fixed by #9062
Closed

Simplify getBytes and getSigningBytes functions of lisk-transactions #9061

bobanm opened this issue Oct 4, 2023 · 0 comments · Fixed by #9062
Assignees
Milestone

Comments

@bobanm
Copy link
Contributor

bobanm commented Oct 4, 2023

These 2 functions do a very similar thing. There is unnecessary code duplication, not only between these 2 functions, but also inside each of the functions in the way how they encode transaction params.

Also, the code would be more readable if the conditional was inverted to check if params are present and valid, rather than if params are missing or invalid.

@bobanm bobanm self-assigned this Oct 4, 2023
@Madhulearn Madhulearn added this to the Sprint 105 milestone Oct 8, 2023
@Madhulearn Madhulearn modified the milestones: Sprint 105, Sprint 106 Oct 9, 2023
@Madhulearn Madhulearn modified the milestones: Sprint 106, Sprint 107 Oct 24, 2023
shuse2 added a commit that referenced this issue Nov 1, 2023
### What was the problem?

This PR resolves #9061

### How was it solved?

- Extracted common functionality to `encodeParams()` function
- Reverted the conditional for checking if params are valid
- Updated `validateTransaction()` to throws error instead of returning
an error
- Updated `encodeParams()` to default params schema to `emptySchema`

### How was it tested?

All existing tests have passed 👌🏻
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants