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

Subgraph: Exposing data to populate Activity Details for stake operation #330

Merged
merged 31 commits into from
Apr 30, 2024

Conversation

ioay
Copy link
Contributor

@ioay ioay commented Mar 26, 2024

Closes: #269


Subgraph: Activity Details for deposit operation


What was done

  • Handled handleDepositInitialized event
  • Handled handleDepositFinalized event
  • Added entities: [DepositOwner, Deposit, Withdraw, Event] & interface ActivityData
  • Added unit tests
  • Update README.md file
  • Bumped specVersion to 1.0.0 to enable auto pruning

Preview

Screenshot 2024-04-18 at 16 21 21

Additional info

DEVELOPMENT QUERY URL - LATEST VERSION:
https://api.studio.thegraph.com/query/69074/a-test/version/latest⁠

@ioay ioay self-assigned this Mar 26, 2024
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit dba5ce1
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/6630c6cfeff80b000838ac44
😎 Deploy Preview https://deploy-preview-330--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ioay ioay force-pushed the subgraph_activity_details branch 4 times, most recently from 49d7f36 to 79ffcbd Compare March 27, 2024 15:06
@ioay ioay force-pushed the subgraph_activity_details branch 5 times, most recently from a1df225 to fbfc805 Compare April 9, 2024 08:14
@ioay ioay requested a review from r-czajkowski April 10, 2024 12:18
@ioay ioay force-pushed the subgraph_activity_details branch from fbfc805 to 8d44058 Compare April 14, 2024 20:15
@ioay ioay requested a review from nkuba April 14, 2024 20:41
Comment on lines 2 to 3
indexerHints:
prune: auto
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we remove it? Should we keep it or is it unnecessary?

Copy link
Contributor Author

@ioay ioay Apr 16, 2024

Choose a reason for hiding this comment

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

Because indexerHints are not supported prior to 1.0.0. It's throwing an error while deploying locally:
Failed to deploy to Graph node http://localhost:8020/: subgraph resolve error: resolve error: indexerHints are not supported prior to 1.0.0.

We can leave it, but we need to increase the specVersion prop to min. ver: 1.0.0: 742d770

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should set specVersion to the latest to support all features? Ofc non-blocking, just wondering.

@ioay ioay marked this pull request as ready for review April 15, 2024 09:55
@ioay ioay force-pushed the subgraph_activity_details branch from f8dd76c to 7a58df6 Compare April 16, 2024 22:04
@ioay ioay force-pushed the subgraph_activity_details branch from 1ab8386 to 497cdae Compare April 18, 2024 11:16
@ioay ioay requested review from nkuba and r-czajkowski April 24, 2024 13:05
@ioay ioay requested a review from nkuba April 25, 2024 21:48
nkuba
nkuba previously approved these changes Apr 26, 2024
Copy link
Member

@nkuba nkuba left a comment

Choose a reason for hiding this comment

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

LGTM, I'm leaving it for @r-czajkowski for final approval.

Comment on lines 113 to 115
test("Deposit entity should exist", () => {
assert.entityCount("Deposit", 1)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we test a case when the Deposit entity doesn't exist ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we throw an error as we did before? We can test expected errors in subgraph https://thegraph.com/docs/en/developing/unit-testing-framework/#expected-failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

@r-czajkowski r-czajkowski self-requested a review April 26, 2024 14:04
Throw an error when the Deposit entity deosn't exist. We throw an error
just to improve readability of the code. This should never happen
because the graph indexes events chronologically and the deposit can
only be finalized once it has been initialized. This case is possible
when we set the wrong `startBlock` in manifest but we always set the
`startBlock` to block where a given contract was deployed. Cover this
case in unit tests.
We changed the type of the `referral` field to `Int` in 8197d98 so just
for consistency we update it in tests as well.
@r-czajkowski r-czajkowski enabled auto-merge April 30, 2024 10:24
@r-czajkowski r-czajkowski merged commit efcb6ed into main Apr 30, 2024
25 checks passed
@r-czajkowski r-czajkowski deleted the subgraph_activity_details branch April 30, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subgraph: Activity Details for deposit operation
3 participants