Skip to content

Commit

Permalink
Merge branch 'main' into update-release-process
Browse files Browse the repository at this point in the history
  • Loading branch information
cdivitotawela authored Oct 2, 2024
2 parents 40237cf + db1899c commit 8ec42f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.LogWithMetadata;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;

Expand Down Expand Up @@ -292,6 +293,23 @@ public Optional<Long> getStatus(final DataFetchingEnvironment environment) {
: Optional.of((long) receipt.getStatus()));
}

/**
* Retrieves the revert reason of the transaction, if any.
*
* <p>This method uses the getReceipt method to get the receipt of the transaction. It then checks
* the revert reason of the receipt. It would be an empty Optional for successful transactions.
* Otherwise, it returns an Optional containing the revert reason.
*
* @param environment the data fetching environment.
* @return an Optional containing a Bytes object representing the revert reason of the
* transaction, or an empty Optional .
*/
public Optional<Bytes> getRevertReason(final DataFetchingEnvironment environment) {
return getReceipt(environment)
.map(TransactionReceiptWithMetadata::getReceipt)
.flatMap(TransactionReceipt::getRevertReason);
}

/**
* Retrieves the gas used by the transaction.
*
Expand Down
3 changes: 3 additions & 0 deletions ethereum/api/src/main/resources/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ type Transaction {
BlobVersionedHashes is a set of hash outputs from the blobs in the transaction.
"""
blobVersionedHashes: [Bytes32!]

"""Reason returned when transaction fails."""
revertReason: Bytes
}

"""EIP-4895"""
Expand Down

0 comments on commit 8ec42f3

Please sign in to comment.