-
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 (#21) * add docs and dockerfile for portable blockscout rapid development * account for cases where eth api says tx that exhausted block gas meter succeeded
- Loading branch information
Showing
5 changed files
with
159 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
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,57 @@ | ||
# Raw version representing v5.3.1-beta | ||
ARG BLOCKSCOUT_VERSION=5.3.1 | ||
|
||
# | ||
# The backend-builder uses the official exlixir docker image that contains | ||
# Elixir, Erlang, compatiable OTP version, and mix. | ||
# | ||
FROM elixir:1.14-otp-25 as backend-builder | ||
ARG BLOCKSCOUT_VERSION | ||
|
||
WORKDIR /src | ||
|
||
# All elixir dependencies are already installed | ||
# We only need git to clone and apply patches | ||
RUN apt-get update \ | ||
&& apt-get install -y git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# COPY patches first, since we want to apply after clone, but before compiling | ||
# This does force a re-clone if there are patch changes, but also reduces our layers. | ||
# | ||
COPY ./patches /src/patches | ||
|
||
# The order of the below steps must be kept the same | ||
# | ||
# Clone the blockscout repository | ||
RUN git clone --depth 1 --branch v${BLOCKSCOUT_VERSION}-beta https://github.com/blockscout/blockscout.git | ||
WORKDIR blockscout | ||
# apply patches | ||
RUN git apply /src/patches/*.patch | ||
RUN mix local.hex --force | ||
RUN mix local.rebar --force | ||
# install prod dependencies | ||
RUN mix deps.get | ||
# compile minimal production optimized version of application | ||
RUN mix compile | ||
# The order of the above steps must be kept the same | ||
# | ||
|
||
WORKDIR /src | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | ||
apt-get install -y nodejs \ | ||
build-essential && \ | ||
node --version && \ | ||
npm --version | ||
# Build the user interface (block_scout_web/assets) and then install the solc npm package (explorer) | ||
RUN cd blockscout/apps/block_scout_web/assets \ | ||
&& npm install \ | ||
&& NODE_ENV=prod npm run deploy \ | ||
&& cd ../../explorer \ | ||
&& npm install | ||
|
||
WORKDIR /src/blockscout | ||
|
||
# | ||
CMD tail -f /dev/null |
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 |