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: upgrade oa and oc-verify #544

Merged
merged 21 commits into from
Sep 1, 2020
Merged

chore: upgrade oa and oc-verify #544

merged 21 commits into from
Sep 1, 2020

Conversation

Nebulis
Copy link
Contributor

@Nebulis Nebulis commented Aug 17, 2020

@Nebulis Nebulis added the WIP Work in progress by the author label Aug 17, 2020
@lgtm-com
Copy link

lgtm-com bot commented Aug 17, 2020

This pull request introduces 2 alerts when merging 4a4acf5 into 59c837d - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class

@Nebulis Nebulis force-pushed the chore/refactor-errors branch 3 times, most recently from ed073c7 to 4fee7bf Compare August 18, 2020 09:54
@Nebulis Nebulis force-pushed the chore/refactor-errors branch from 4fee7bf to 0b980c7 Compare August 18, 2020 10:12
@lgtm-com
Copy link

lgtm-com bot commented Aug 18, 2020

This pull request introduces 1 alert when merging 0b980c7 into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@gjj
Copy link
Contributor

gjj commented Aug 18, 2020

@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2020

This pull request introduces 1 alert when merging 22d1b2e into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2020

This pull request introduces 1 alert when merging 3bcacfc into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@gjj
Copy link
Contributor

gjj commented Aug 19, 2020

OK so I'm done w handling a bad response error returned by Ethers.js (over at Open-Attestation/oa-verify#110)

To test locally

Here's how it looks like. If you want to test,

  1. do so locally with ETHEREUM_PROVIDER=cloudflare NET=mainnet npm run dev
  2. visit https://localhost:3000/?q={"type":"DOCUMENT","payload":{"uri":"https://gist.githubusercontent.com/gjj/1759e1627c562afbdc7a684df23c25de/raw/bbdccc871bcaae8249ad0331942e0b373445e94d/SOR_ALL_2012GCEO2376_00922019-09-02-redacted.opencert","permittedActions":["STORE"]}}
  3. spam browser's back button until you get the 502 bad gateway error

Here's how it'd look like

Untitled

In the case of a 429 rate limit (caused by user who flood the verifier), or a 502 bad gateway (caused by Cloudflare Ethereum Gateway), we don't know for certain that "This certificate is not valid".

My question

@Nebulis I'm not sure if it's conflicting to say both "certificate is not valid" and "unable to connect to the Ethereum network". People might get confused, what do yall think?

If we want to make "This certificate is not valid" dynamic, problem is that it's static currently... might need a few other changes?

@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2020

This pull request introduces 1 alert when merging d4d3662 into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@Nebulis
Copy link
Contributor Author

Nebulis commented Aug 20, 2020

@gjj yeah the label certificate is not valid is problematic here let's change that too

@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 1 alert when merging d4dc403 into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 1 alert when merging 3233cb2 into 6610de1 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@gjj
Copy link
Contributor

gjj commented Aug 24, 2020

For future reference, HTTP-related errors from Ethers: https://github.com/ethers-io/ethers.js/blob/9640e864a68b4a9e84e820f0ceaf1eb56c66715f/packages/web/src.ts/index.ts

Can confirm that missing response is the error message for 429 errors. But bad response is for HTTP status codes < 200 or >= 300

@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 1 alert when merging 5dabb6e into 9e243f3 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 1 alert when merging 4593af3 into 9e243f3 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 1 alert when merging f710b90 into 9e243f3 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

- i'm not sure why, but somehow it was left out?
@lgtm-com
Copy link

lgtm-com bot commented Aug 25, 2020

This pull request introduces 1 alert when merging 9e28d9f into b8ee5c0 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

gjj added 4 commits August 26, 2020 09:56
- also refactored some tests
- removed OpenAttestationDocument from CertificateViewer (bug with eslint, as it's not picking it up)
- also removed extra ' from some test case names
@gjj gjj removed the WIP Work in progress by the author label Aug 31, 2020
- fixed some mistakes in the test inputs
errors.push(TYPES.SERVER_ERROR);
} else if (invalidArgument(verificationStatus)) {
// if the error is because of the merkleRoot, it should already be handled by the DOCUMENT_INTEGRITY fragment
// empty here so that it's not caught by ETHERS_UNHANDLED_ERROR
Copy link
Contributor

@gjj gjj Aug 31, 2020

Choose a reason for hiding this comment

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

@Nebulis ok so previously I discovered that merkleRoots that were invalid (odd length, incorrect length/not 64 chars, contains non-hexcadecimal values) were not handled.

Now that it's handled, we expect it to show "Certificate has been tampered with" instead, and that is handled by DOCUMENT_INTEGRITY instead of DOCUMENT_STATUS. If we don't have this, the cases above will get caught by the else block and thus resulting in the "Unhandled error" message.

Not sure what you think about having this check, but nothing is in here? (It should already be handled by this line https://github.com/OpenCerts/opencerts-website/pull/544/files#diff-ad34607bf39b4b3c4414917cf9b807f8R22)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is for ga right ? at least this could give us mor einformation about what really happened

Copy link
Contributor

Choose a reason for hiding this comment

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

(explained)

</span>
<div className={css["secondary-links"]}>
<span>
<Link href=" ">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will reload the page isnt it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

changed to not use Link. instead, it's now a span element. text-link css class now includes cursor: pointer

@gjj gjj merged commit d9a8038 into master Sep 1, 2020
@gjj gjj deleted the chore/refactor-errors branch September 1, 2020 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants