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

fix: upgrade snapshot.js to 0.8.0 beta.0 #702

Merged
merged 7 commits into from
Oct 27, 2023

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Oct 9, 2023

Upgrade snapshot.js to 0.8.0-beta.0, with ofetch migration.

  • Add try/catch around snapshot.utils function, and return a more meaningful error
  • Return error when space or proposal are not found
  • Return error when voter is blank (ideally, we should check that it's a valid address here)

There's only one file affected: operation/vp.ts

Should also fix #413

Before upgrade, error response

{
  "errors": [
    {
      "message": "Unexpected error value: { code: 500, message: \"unauthorized\", data: {} }",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "vp"
      ]
    }
  ],
  "data": {
    "vp": null
  }
}

After upgrade, error response:

{
  "errors": [
    {
      "message": "request failed",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "vp"
      ]
    }
  ],
  "data": {
    "vp": null
  }
}

Test

Working query

query Vp{
  vp(space: "stgdao.eth", voter:"0x91FD2c8d24767db4Ece7069AA27832ffaf8590f3") {
    vp_state
    vp_by_strategy
  }
}

Failing query

query Vp{
  vp(space: "magicappstore.eth", voter:"0x91FD2c8d24767db4Ece7069AA27832ffaf8590f3") {
    vp_state
    vp_by_strategy
  }
}

@wa0x6e wa0x6e changed the title Upgrade snapshot.js to 0.8.0 beta.0 fix: upgrade snapshot.js to 0.8.0 beta.0 Oct 9, 2023
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (8c7127f) 2.42% compared to head (84368b0) 2.40%.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #702      +/-   ##
=========================================
- Coverage    2.42%   2.40%   -0.03%     
=========================================
  Files          39      39              
  Lines        2020    2039      +19     
  Branches       37      37              
=========================================
  Hits           49      49              
- Misses       1934    1953      +19     
  Partials       37      37              
Files Coverage Δ
src/graphql/operations/vp.ts 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wa0x6e wa0x6e requested a review from ChaituVR October 9, 2023 06:28
@wa0x6e wa0x6e marked this pull request as ready for review October 9, 2023 06:28
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

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

tAck

@wa0x6e wa0x6e merged commit 3a3a3fb into master Oct 27, 2023
4 checks passed
@wa0x6e wa0x6e deleted the upgrade-snapshot.js-to-0.8.0-beta.0 branch October 27, 2023 13:49
wa0x6e added a commit that referenced this pull request Oct 27, 2023
ChaituVR pushed a commit that referenced this pull request Oct 27, 2023
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.

Don't return error object in response
2 participants