Skip to content

[SUBGRAPH] add gasUsed property #1103

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

Closed
benjlevesque opened this issue Oct 3, 2022 · 3 comments · Fixed by #1199
Closed

[SUBGRAPH] add gasUsed property #1103

benjlevesque opened this issue Oct 3, 2022 · 3 comments · Fixed by #1199
Assignees
Labels
Tag: TechDebt Technical debt that needs to be addressed

Comments

@benjlevesque
Copy link

Problem

The subgraph contains information about gasPrice, but not about gasUsed, which makes it harder to compute the price of the transaction.

Possible Solution

This wasn't possible until recently, but is now available on event.receipt.gasUsed docs.

@0xdavinchee
Copy link
Contributor

@benjlevesque I tried this out following the steps listed in here and bumped the versions of graph-cli and graph-ts to the latest versions and even tried installing the alpha versions mentioned here. You can checkout the linked PR to see that the past two builds failed because of an indexing error. The error probably doesn't display there, but I've tested it locally and I get:

graph-node_1  | Oct 17 12:50:34.388 ERRO Subgraph error 1/10, code: SubgraphSyncingFailure, error: Tried to read AssemblyScript value that is 'null'. Suggestion: look into the function that the error happened and add 'log' calls till you find where a 'null' value is being used as non-nullable. It's likely that you're calling a 'graph-ts' function (or operator) with a 'null' value when it doesn't support it.	wasm backtrace:	    0: 0x3759 - <unknown>!src/mappings/host/handleAgreementClassUpdated	 in handler `handleAgreementClassRegistered` at block #4 (4c1316bccd765376b914a522af47ff136a54a32298caba7b6d197aff69d929d2), block_hash: 0x4c1316bccd765376b914a522af47ff136a54a32298caba7b6d197aff69d929d2, block_number: 4, sgd: 1, subgraph_id: QmRKKKFKan7RuxSvCP5wAgFcTfkhN3GQWd8Ac2HZrD5dbP, component: SubgraphInstanceManager

@benjlevesque
Copy link
Author

sorry @0xdavinchee I didn't manage to run the superfluid subgraph (on goerli), so I can't reproduce your issue :/

did you try testing for null before accessing the receipt? maybe with a log you will see what's happening...

   if (receipt) {
        ev.gasUsed = receipt.gasUsed;
    } else {
        log.warning("receipt is null", []);
    }

@0xdavinchee
Copy link
Contributor

sorry @0xdavinchee I didn't manage to run the superfluid subgraph (on goerli), so I can't reproduce your issue :/

did you try testing for null before accessing the receipt? maybe with a log you will see what's happening...

   if (receipt) {
        ev.gasUsed = receipt.gasUsed;
    } else {
        log.warning("receipt is null", []);
    }

Yeah, I think this actually throws when you try to access a property that's null

@hellwolf hellwolf added the Tag: TechDebt Technical debt that needs to be addressed label Nov 21, 2022
@hellwolf hellwolf added this to the [email protected] milestone Nov 21, 2022
@0xdavinchee 0xdavinchee removed a link to a pull request Dec 5, 2022
@0xdavinchee 0xdavinchee linked a pull request Dec 5, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: TechDebt Technical debt that needs to be addressed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants