Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Remove data guards and validation from transaction builders #1951

Closed
faustbrian opened this issue May 20, 2020 · 0 comments
Closed

Remove data guards and validation from transaction builders #1951

faustbrian opened this issue May 20, 2020 · 0 comments
Labels
Type: Refactor The pull request improves or enhances an existing implementation.
Milestone

Comments

@faustbrian
Copy link
Contributor

faustbrian commented May 20, 2020

if (!store.getters["session/network"].constants.aip11) {
    throw new Error("AIP-11 transaction not supported on network");
}

const staticFee = store.getters["transaction/staticFee"](TRANSACTION_TYPES.GROUP_2.BUSINESS_UPDATE, 2);
if (!isAdvancedFee && fee.gt(staticFee)) {
    throw new Error(`Business Update fee should be smaller than ${staticFee}`);
}

Transaction builders are currently partially responsible to protect themselves against invalid data. This isn't really their job because things like malformed data, invalid fees or them being called while it should not be possible are things that should be taken care of before they are even called.

This will be partially resolved by the usage of the Platform SDK but the wallets will still be responsible for validating user input.

@faustbrian faustbrian added the Type: Refactor The pull request improves or enhances an existing implementation. label May 20, 2020
@faustbrian faustbrian added this to the 3.0.0 milestone May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Refactor The pull request improves or enhances an existing implementation.
Projects
None yet
Development

No branches or pull requests

1 participant