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

feat: allow cert caching if local storage is defined #437

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

joshLong145
Copy link

Description

Changes a conditional check for storing AMD SEV SNP certificates in localstorage to now check if the api is available rather than doing a check for a browser environment. this will allow for caching in local storage in non browser environments if the api is available.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

A new connection e2e test has been added which defines a localstorage provider and checks that certs have been cached after connect finishes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Collaborator

@Ansonhkg Ansonhkg left a comment

Choose a reason for hiding this comment

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

Nice! e2e seems to be failing though with your cert test

❌ 1 test(s) failed
-------------------
- [1] Error happened in /home/runner/work/js-sdk/js-sdk/e2e-nodejs/group-connection/test-connection-cert-caching.mjs, see below for details 👇 
Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xBC7F8d7864002b6629Ab49781D5199C8dD1DDcE1","data":"0x43cb0a0e","accessList":null}, error={"reason":"missing response","code":"SERVER_ERROR","requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xbc7f8d7864002b6629ab49781d5199c8dd1ddce1\",\"data\":\"0x43cb0a0e\"},\"latest\"],\"id\":45,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","serverError":{"errno":-104,"code":"ECONNRESET","syscall":"read"},"url":"https://chain-rpc.litprotocol.com/http"}, code=CALL_EXCEPTION, version=providers/5.7.2)

@joshLong145
Copy link
Author

Nice! e2e seems to be failing though with your cert test

❌ 1 test(s) failed
-------------------
- [1] Error happened in /home/runner/work/js-sdk/js-sdk/e2e-nodejs/group-connection/test-connection-cert-caching.mjs, see below for details 👇 
Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xBC7F8d7864002b6629Ab49781D5199C8dD1DDcE1","data":"0x43cb0a0e","accessList":null}, error={"reason":"missing response","code":"SERVER_ERROR","requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xbc7f8d7864002b6629ab49781d5199c8dd1ddce1\",\"data\":\"0x43cb0a0e\"},\"latest\"],\"id\":45,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","serverError":{"errno":-104,"code":"ECONNRESET","syscall":"read"},"url":"https://chain-rpc.litprotocol.com/http"}, code=CALL_EXCEPTION, version=providers/5.7.2)

Did a re run of that job since the error looked to be an rpc timeout issue. The e2e tests now pass.

@joshLong145 joshLong145 requested a review from Ansonhkg April 24, 2024 15:13
Ansonhkg
Ansonhkg previously approved these changes Apr 24, 2024
Copy link
Collaborator

@Ansonhkg Ansonhkg left a comment

Choose a reason for hiding this comment

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

lgtm

@joshLong145 joshLong145 changed the title feat: allow certt caching if local storage is defined feat: allow cert caching if local storage is defined Apr 24, 2024
Copy link
Collaborator

@glitch003 glitch003 left a comment

Choose a reason for hiding this comment

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

looks good - just the one change in the test so that when we start supporting Genoa, or if the AMD URL path changes, the test doesn't break.

@joshLong145
Copy link
Author

@glitch003
Can you re review?

@joshLong145 joshLong145 merged commit 58c6bbf into master Apr 26, 2024
4 checks passed
@joshLong145 joshLong145 deleted the feat/cache-amd-certs-in-node-env branch April 26, 2024 22:28
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.

3 participants