-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
account for cases where eth api says tx that exhausted block gas mete…
…r succeeded
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
blockscout/patches/0004-loosen-internal-tx-call-validation-constraints.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/apps/explorer/lib/explorer/chain/internal_transaction.ex b/apps/explorer/lib/explorer/chain/internal_transaction.ex | ||
index c86bfa699f..1b2d0cbac6 100644 | ||
--- a/apps/explorer/lib/explorer/chain/internal_transaction.ex | ||
+++ b/apps/explorer/lib/explorer/chain/internal_transaction.ex | ||
@@ -3,6 +3,8 @@ defmodule Explorer.Chain.InternalTransaction do | ||
|
||
use Explorer.Schema | ||
|
||
+ require Logger | ||
+ | ||
alias Explorer.Chain.{Address, Block, Data, Gas, Hash, PendingBlockOperation, Transaction, Wei} | ||
alias Explorer.Chain.InternalTransaction.{Action, CallType, Result, Type} | ||
|
||
@@ -502,7 +504,16 @@ defmodule Explorer.Chain.InternalTransaction do | ||
# Validates that :call `type` changeset either has an `error` or both `gas_used` and `output` | ||
defp validate_call_error_or_result(changeset) do | ||
case get_field(changeset, :error) do | ||
- nil -> validate_required(changeset, [:gas_used, :output], message: "can't be blank for successful call") | ||
+ nil -> | ||
+ if get_field(changeset, :gas_used) == nil && get_field(changeset, :output) == nil do | ||
+ changeset |> | ||
+ IO.inspect() |> | ||
+ Ecto.Changeset.change( | ||
+ error: "execution reverted" | ||
+ ) | ||
+ else | ||
+ validate_required(changeset, [:gas_used, :output], message: "can't be blank for successful call") | ||
+ end | ||
_ -> validate_disallowed(changeset, [:output], message: "can't be present for failed call") | ||
end | ||
end |