Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ERTP): additional input validation and clean up #3892

Merged
merged 3 commits into from
Nov 6, 2021

Conversation

katelynsills
Copy link
Contributor

@katelynsills katelynsills commented Sep 24, 2021

This PR is the result of doing an evaluation of ERTP for missing input validation. I also did some small large clean up to ensure that the input validation was easy to audit. Namely, NatValues now only accept bigints, lower-case amountMath is removed, and AmountMath methods always follow the order of: brand, value. I removed the looksLike usage to make it clearer when something was actually trying to validate inputs rather than sniff to see what kind of validation to do.

  • @agoric/same-structure is deprecated, so I changed to using @agoric/marshal
  • I removed inconsistent input validation or added comments explaining the difference
  • renamed the ERTP reallocate function to moveAssets for clarity
  • renamed checkForDupes to assertNoDuplicates to fit the standard of using assert for a function that throws
  • improved error messages for common errors

Closes: #3202
Closes: #3867
Closes: #3885
Closes: #3960
Closes: #3089
Closes: #3045

#documentation-branch: 3885-ertp-input-validation
#dapp-card-store-branch: 3885-ertp-input-validation
#dapp-oracle-branch: 3885-ertp-input-validation
#dapp-otc-branch: 3885-ertp-input-validation

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

Review so far. Not done yet.

Leaving aside test files, I only have 6 files to go. My plan is to not review the test files, since the point of my review is to catch input validation issues that the tests may have missed. (None so far! Only stylistic suggestions so far.)

If there is anything in the test files you'd like to call my attention to, please do. Or anywhere else for that matter, in case I miss it.

packages/ERTP/docs/INPUT_VALIDATION.md Outdated Show resolved Hide resolved
packages/ERTP/docs/INPUT_VALIDATION.md Outdated Show resolved Hide resolved
packages/ERTP/docs/INPUT_VALIDATION.md Outdated Show resolved Hide resolved
packages/ERTP/docs/INPUT_VALIDATION.md Outdated Show resolved Hide resolved
packages/ERTP/docs/INPUT_VALIDATION.md Outdated Show resolved Hide resolved
packages/ERTP/src/amountMath.js Show resolved Hide resolved
packages/governance/src/paramManager.js Show resolved Hide resolved
packages/ERTP/src/issuerKit.js Show resolved Hide resolved
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

What's here LGTM. What I still need to do though, before approving, is start again from the external API surface and see if all paths in are covered to my satisfaction.

packages/ERTP/src/displayInfo.js Show resolved Hide resolved
packages/ERTP/src/types.js Outdated Show resolved Hide resolved
packages/marshal/src/assertPassStyleOf.js Outdated Show resolved Hide resolved
packages/zoe/src/contractSupport/ratio.js Outdated Show resolved Hide resolved
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

LGTM!

BREAKING CHANGE: NatValues now only accept bigints, lower-case amountMath is removed, and AmountMath methods always follow the order of: brand, value
@katelynsills katelynsills added the automerge:squash Automatically squash merge label Nov 6, 2021
@mergify mergify bot merged commit 067ea32 into master Nov 6, 2021
@mergify mergify bot deleted the 3885-ertp-input-validation branch November 6, 2021 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment