Ethereum Transaction Receipts in Event Handlers#3373
Merged
Conversation
6149468 to
1c0b6af
Compare
This was referenced Mar 23, 2022
tilacog
commented
Mar 24, 2022
evaporei
suggested changes
Mar 28, 2022
evaporei
reviewed
Mar 29, 2022
Contributor
|
Another couple of things:
|
Contributor
Author
The Draft status is related to the dependent PRs not being merged, but I can change it now since we already started the review process. |
and implement the follwing traits for them: - AscType - ToAscObj - AscIndexId
Refactors the `blocks_with_triggers` function to also collect transaction receipts for Log triggers.
In this commit we stop calling `fetch_receipts_from_ethereum_client` and use `fetch_transaction_receipts_with_retry` instead, so we can take advantage of both its retry scheme and transaction receipt resolution mechanism. Calling this latest function requires block hashes, so we had to move from a `Vec<TxnHash>` to a `Map<BlockHash,Vec<TxnHash>`.
Some assertions were supposed to be negated.
…Event_0_0_7` Also changed the implementation of `ToAscObj` to use a `Option<Receipt>` instead of a `Receipt`, since `AscPtr`s can be nullable.
for the Log type
2905297 to
2008afa
Compare
Contributor
Author
|
Rebased with latest |
This was referenced Apr 1, 2022
|
You are my hero @tilacog |
|
Add |
Contributor
|
hi @creaink this is an issue with deployments to the Hosted Service, we are investigating and expect to resolve soon, sorry for the trouble |
Merged
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows Ethereum event handlers to access the receipt for the transaction which emitted it.
To support this, we introduce:
specVersion: 0.0.6apiVersion: 0.0.71. Usage in Mappings
An event handler will receive an
Eventcontaining a receipt whenever it is declared in the subgraph manifest with the newreceipt: truekey, which is optional and defaults to false.Inside the handler function, the receipt can be accessed in the
Event.receiptfield.When the
receiptkey is set tofalseor omitted in the manifest, anullvalue will be returned instead.2. New runtime data types
AscEthereumEventWithReceiptEventplus a non-nullablereceiptfield, containing [B]AscEthereumTransactionReceiptlogsfield with an array of [C], containing all the logs for the associated transaction.AscEthereumLogDepending on the subgraph manifest configuration, the runtime will receive either an
AscEthereumEventor anAscEthereumEventWithReceipt.3. Receipt Ingestion
Transaction receipts will be collected inside the
blocks_with_triggersfunction (which is used byPoolingBlockStream) only when anEthereumLogFilterrequires them.4. Affected Structs and Enums
The following items were updated with optional fields to accommodate data for receipt themselves and their requirement flags :
MappingEventHandlergot a newreceipt: boolfield which defaults to false when deserializing, to account for omissions in the subgraph manifest.EthereumLogFilter: its inner Graph data structure was updated so its edges represent the requirement of a receipt. The originalHashSet<EventSignature>of wildcard events was also updated to aHashMap<EventSignature, bool>to reflect that same aspect.EthereumTrigger::Logvariant got a secondOption<web3::TransactionReceipt>fieldMappingTrigger::Logvariant got a newreceipt: Option<web3::TransactionReceipt>fieldTodo:
apiVersionEthereumLogFilterget_transaction_receipts_for_transaction_hashesfunctiongraph-tsandgraph-clireleased (see "Dependencies" below)Resolves #3218
Dependencies
This PR depends on:
TransactionReceiptandLoggraph-ts#260