-
Notifications
You must be signed in to change notification settings - Fork 996
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
Ethereum Transaction Receipts in Event Handlers #3373
Conversation
6149468
to
1c0b6af
Compare
Another couple of things:
|
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
Rebased with latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
You are my hero @tilacog |
Add |
hi @creaink this is an issue with deployments to the Hosted Service, we are investigating and expect to resolve soon, sorry for the trouble |
This PR allows Ethereum event handlers to access the receipt for the transaction which emitted it.
To support this, we introduce:
specVersion: 0.0.6
apiVersion: 0.0.7
1. Usage in Mappings
An event handler will receive an
Event
containing a receipt whenever it is declared in the subgraph manifest with the newreceipt: true
key, which is optional and defaults to false.Inside the handler function, the receipt can be accessed in the
Event.receipt
field.When the
receipt
key is set tofalse
or omitted in the manifest, anull
value will be returned instead.2. New runtime data types
AscEthereumEventWithReceipt
Event
plus a non-nullablereceipt
field, containing [B]AscEthereumTransactionReceipt
logs
field with an array of [C], containing all the logs for the associated transaction.AscEthereumLog
Depending on the subgraph manifest configuration, the runtime will receive either an
AscEthereumEvent
or anAscEthereumEventWithReceipt
.3. Receipt Ingestion
Transaction receipts will be collected inside the
blocks_with_triggers
function (which is used byPoolingBlockStream
) only when anEthereumLogFilter
requires them.4. Affected Structs and Enums
The following items were updated with optional fields to accommodate data for receipt themselves and their requirement flags :
MappingEventHandler
got a newreceipt: bool
field 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::Log
variant got a secondOption<web3::TransactionReceipt>
fieldMappingTrigger::Log
variant got a newreceipt: Option<web3::TransactionReceipt>
fieldTodo:
apiVersion
EthereumLogFilter
get_transaction_receipts_for_transaction_hashes
functiongraph-ts
andgraph-cli
released (see "Dependencies" below)Resolves #3218
Dependencies
This PR depends on:
TransactionReceipt
andLog
graph-ts#260