From afc7578653df0d7ef61084f90e07c6d474546099 Mon Sep 17 00:00:00 2001 From: pasqu4le Date: Wed, 19 Jun 2019 18:11:12 +0200 Subject: [PATCH 01/11] Reduce transaction status constraint --- CHANGELOG.md | 4 +- .../lib/explorer/chain/transaction.ex | 105 +------------- ...3_reduce_transaction_status_constraint.exs | 132 ++++++++++++++++++ .../test/explorer/chain/import_test.exs | 2 +- 4 files changed, 143 insertions(+), 100 deletions(-) create mode 100644 apps/explorer/priv/repo/migrations/20190619154943_reduce_transaction_status_constraint.exs diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e62d4751..ee068fcc6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,9 @@ - [#2173](https://github.com/poanetwork/blockscout/pull/2173) - handle correctly empty transactions - [#2174](https://github.com/poanetwork/blockscout/pull/2174) - fix reward channel joining - [#2186](https://github.com/poanetwork/blockscout/pull/2186) - fix net version test -- [#2167](https://github.com/poanetwork/blockscout/pull/2168) - feat: document eth rpc api mimicking endpoints +- [#2167](https://github.com/poanetwork/blockscout/pull/2168) - feat: document eth rpc api mimicking endpoints +- [#2198](https://github.com/poanetwork/blockscout/pull/2198) - reduce transaction status constraint +- [#2198](https://github.com/poanetwork/blockscout/pull/2198) - reduce transaction status and error constraint ### Chore - [#2127](https://github.com/poanetwork/blockscout/pull/2127) - use previouse chromedriver version diff --git a/apps/explorer/lib/explorer/chain/transaction.ex b/apps/explorer/lib/explorer/chain/transaction.ex index 19f04dee2d..3b109504eb 100644 --- a/apps/explorer/lib/explorer/chain/transaction.ex +++ b/apps/explorer/lib/explorer/chain/transaction.ex @@ -247,7 +247,7 @@ defmodule Explorer.Chain.Transaction do end @doc """ - A pending transaction has neither `block_hash` nor an `index` + A pending transaction does not have a `block_hash` iex> changeset = Explorer.Chain.Transaction.changeset( ...> %Transaction{}, @@ -267,42 +267,6 @@ defmodule Explorer.Chain.Transaction do iex> changeset.valid? true - A pending transaction (which is indicated by not having a `block_hash`) can't have `block_number`, - `cumulative_gas_used`, `gas_used`, or `index`. - - iex> changeset = Explorer.Chain.Transaction.changeset( - ...> %Transaction{}, - ...> %{ - ...> from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> block_number: 34, - ...> cumulative_gas_used: 0, - ...> gas: 4700000, - ...> gas_price: 100000000000, - ...> gas_used: 4600000, - ...> hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - ...> index: 0, - ...> input: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> nonce: 0, - ...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75, - ...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3, - ...> status: :ok, - ...> v: 0x8d, - ...> value: 0 - ...> } - ...> ) - iex> changeset.valid? - false - iex> Keyword.get_values(changeset.errors, :block_number) - [{"can't be set when the transaction is pending", []}] - iex> Keyword.get_values(changeset.errors, :cumulative_gas_used) - [{"can't be set when the transaction is pending", []}] - iex> Keyword.get_values(changeset.errors, :gas_used) - [{"can't be set when the transaction is pending", []}] - iex> Keyword.get_values(changeset.errors, :index) - [{"can't be set when the transaction is pending", []}] - iex> Keyword.get_values(changeset.errors, :status) - [{"can't be set when the transaction is pending", []}] - A collated transaction MUST have an `index` so its position in the `block` is known and the `cumulative_gas_used` ane `gas_used` to know its fees. @@ -359,35 +323,6 @@ defmodule Explorer.Chain.Transaction do iex> changeset.valid? true - Once the `internal_transactions_indexed_at` is set, both pre- and post-Byzantium transactions will be able to know - their status, so if `internal_transaction_indexed_at` is set, `status` is required. - - iex> changeset = Explorer.Chain.Transaction.changeset( - ...> %Transaction{}, - ...> %{ - ...> block_hash: "0xe52d77084cab13a4e724162bcd8c6028e5ecfaa04d091ee476e96b9958ed6b47", - ...> block_number: 34, - ...> cumulative_gas_used: 0, - ...> from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca", - ...> gas: 4700000, - ...> gas_price: 100000000000, - ...> gas_used: 4600000, - ...> hash: "0x3a3eb134e6792ce9403ea4188e5e79693de9e4c94e499db132be086400da79e6", - ...> index: 0, - ...> input: "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820a9c628775efbfbc17477a472413c01ee9b33881f550c59d21bee9928835c854b0029", - ...> internal_transactions_indexed_at: DateTime.utc_now(), - ...> nonce: 0, - ...> r: 0xAD3733DF250C87556335FFE46C23E34DBAFFDE93097EF92F52C88632A40F0C75, - ...> s: 0x72caddc0371451a58de2ca6ab64e0f586ccdb9465ff54e1c82564940e89291e3, - ...> v: 0x8d, - ...> value: 0 - ...> } - ...> ) - iex> changeset.valid? - false - iex> Keyword.get_values(changeset.errors, :status) - [{"can't be blank when the internal transactions have been fetched", []}] - The `error` can only be set with a specific error message when `status` is `:error` iex> changeset = Explorer.Chain.Transaction.changeset( @@ -445,10 +380,9 @@ defmodule Explorer.Chain.Transaction do transaction |> cast(attrs, @required_attrs ++ @optional_attrs) |> validate_required(@required_attrs) - |> validate_collated_or_pending() + |> validate_collated() |> validate_error() |> validate_status() - |> check_pending() |> check_collated() |> check_error() |> check_status() @@ -592,29 +526,17 @@ defmodule Explorer.Chain.Transaction do {collated_field, :"collated_#{collated_field}}"} end) - @pending_fields_with_check @collated_fields - @pending_fields_with_validation @collated_fields ++ ~w(internal_transaction_indexed_at status)a - @pending_message "can't be set when the transaction is pending" - @pending_field_to_check Enum.into(@pending_fields_with_check, %{}, fn pending_field -> - {pending_field, :"pending_#{pending_field}}"} - end) - defp check_collated(%Changeset{} = changeset) do check_constraints(changeset, @collated_field_to_check, @collated_message) end - defp check_pending(%Changeset{} = changeset) do - check_constraints(changeset, @pending_field_to_check, @pending_message) - end - @error_message "can't be set when status is not :error" defp check_error(%Changeset{} = changeset) do check_constraint(changeset, :error, message: @error_message, name: :error) - changeset end - @status_message "can't be blank when the internal transactions have been fetched" + @status_message "can't be set when the block_hash is unknown" defp check_status(%Changeset{} = changeset) do check_constraint(changeset, :status, message: @status_message, name: :status) @@ -632,22 +554,10 @@ defmodule Explorer.Chain.Transaction do end) end - defp validate_collated_or_pending(%Changeset{} = changeset) do + defp validate_collated(%Changeset{} = changeset) do case Changeset.get_field(changeset, :block_hash) do - nil -> validate_collated_or_pending(changeset, @pending_fields_with_validation, &validate_pending/2) - %Hash{} -> validate_collated_or_pending(changeset, @collated_fields, &validate_collated/2) - end - end - - defp validate_collated_or_pending(%Changeset{} = changeset, fields, field_validator) - when is_list(fields) and is_function(field_validator, 2) do - Enum.reduce(fields, changeset, field_validator) - end - - defp validate_pending(field, %Changeset{} = changeset) when is_atom(field) do - case Changeset.get_field(changeset, field) do + %Hash{} -> Enum.reduce(@collated_fields, changeset, &validate_collated/2) nil -> changeset - _ -> Changeset.add_error(changeset, field, @pending_message) end end @@ -667,9 +577,8 @@ defmodule Explorer.Chain.Transaction do end defp validate_status(%Changeset{} = changeset) do - # all other errors on status are handled by validate_pending - if Changeset.get_field(changeset, :internal_transactions_indexed_at) != nil and - Changeset.get_field(changeset, :status) == nil do + if Changeset.get_field(changeset, :block_hash) == nil and + Changeset.get_field(changeset, :status) != nil do Changeset.add_error(changeset, :status, @status_message) else changeset diff --git a/apps/explorer/priv/repo/migrations/20190619154943_reduce_transaction_status_constraint.exs b/apps/explorer/priv/repo/migrations/20190619154943_reduce_transaction_status_constraint.exs new file mode 100644 index 0000000000..4964bc4250 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190619154943_reduce_transaction_status_constraint.exs @@ -0,0 +1,132 @@ +defmodule Explorer.Repo.Migrations.ReduceTransactionStatusConstraint do + use Ecto.Migration + + def up do + drop( + constraint( + :transactions, + :status + ) + ) + + create( + constraint( + :transactions, + :status, + # NOTE: all checks on status are lifted except those regarding block_hash + # This is because of block invalidation, that causes transactions to be + # refetched while previous internal transactions still exist + check: """ + (block_hash IS NULL AND status IS NULL) OR + (block_hash IS NOT NULL) OR + (status = 0 and error = 'dropped/replaced') + """ + ) + ) + + drop( + constraint( + :transactions, + :error + ) + ) + + create( + constraint( + :transactions, + :error, + # NOTE: all checks on error are lifted except when status is not 0, for + # the same reasons as above + check: """ + (status = 0) OR + (status != 0 AND error IS NULL) + """ + ) + ) + end + + def down do + drop( + constraint( + :transactions, + :status + ) + ) + + create( + constraint( + :transactions, + :status, + # 0 - NULL + # 1 - NOT NULL + # + # | block_hash | internal_transactions_indexed_at | status | OK | description + # |------------|----------------------------------|--------|----|------------ + # | 0 | 0 | 0 | 1 | pending + # | 0 | 0 | 1 | 0 | pending with status + # | 0 | 1 | 0 | 0 | pending with internal transactions + # | 0 | 1 | 1 | 0 | pending with internal transactions and status + # | 1 | 0 | 0 | 1 | pre-byzantium collated transaction without internal transactions + # | 1 | 0 | 1 | 1 | post-byzantium collated transaction without internal transactions + # | 1 | 1 | 0 | 0 | pre-byzantium collated transaction with internal transaction without status + # | 1 | 1 | 1 | 1 | pre- or post-byzantium collated transaction with internal transactions and status + # + # [Karnaugh map](https://en.wikipedia.org/wiki/Karnaugh_map) + # b \ is | 00 | 01 | 11 | 10 | + # -------|----|----|----|----| + # 0 | 1 | 0 | 0 | 0 | + # 1 | 1 | 1 | 1 | 0 | + # + # Simplification: ¬i·¬s + b·¬i + b·s + check: """ + (internal_transactions_indexed_at IS NULL AND status IS NULL) OR + (block_hash IS NOT NULL AND internal_transactions_indexed_at IS NULL) OR + (block_hash IS NOT NULL AND status IS NOT NULL) OR + (status = 0 and error = 'dropped/replaced') + """ + ) + ) + + drop( + constraint( + :transactions, + :error + ) + ) + + create( + constraint( + :transactions, + :error, + # | status | internal_transactions_indexed_at | error | OK | description + # |--------|----------------------------------|----------|------------|------------ + # | NULL | NULL | NULL | TRUE | pending or pre-byzantium collated + # | NULL | NULL | NOT NULL | FALSE | error cannot be known before internal transactions are indexed + # | NULL | NOT NULL | NULL | DON'T CARE | handled by `status` check + # | NULL | NOT NULL | NOT NULL | FALSE | error cannot be set unless status is known to be error (`0`) + # | 0 | NULL | NULL | TRUE | post-byzantium before internal transactions indexed + # | 0 | NULL | NOT NULL | FALSE | error cannot be set unless internal transactions are indexed + # | 0 | NOT NULL | NULL | FALSE | error MUST be set when status is error + # | 0 | NOT NULL | NOT NULL | TRUE | error is set when status is error + # | 1 | NULL | NULL | TRUE | post-byzantium before internal transactions indexed + # | 1 | NULL | NOT NULL | FALSE | error cannot be set when status is ok + # | 1 | NOT NULL | NULL | TRUE | error is not set when status is ok + # | 1 | NOT NULL | NOT NULL | FALSE | error cannot be set when status is ok + # + # Karnaugh map + # s \ ie | NULL, NULL | NULL, NOT NULL | NOT NULL, NOT NULL | NOT NULL, NULL | + # -------|------------|----------------|--------------------|----------------| + # NULL | TRUE | FALSE | FALSE | DON'T CARE | + # 0 | TRUE | FALSE | TRUE | FALSE | + # 1 | TRUE | FALSE | FALSE | TRUE | + # + check: """ + (internal_transactions_indexed_at IS NULL AND error IS NULL) OR + (status = 0 AND internal_transactions_indexed_at IS NOT NULL AND error IS NOT NULL) OR + (status != 0 AND internal_transactions_indexed_at IS NOT NULL AND error IS NULL) OR + (status = 0 and error = 'dropped/replaced') + """ + ) + ) + end +end diff --git a/apps/explorer/test/explorer/chain/import_test.exs b/apps/explorer/test/explorer/chain/import_test.exs index 5bff700dcb..dd3bbf1aec 100644 --- a/apps/explorer/test/explorer/chain/import_test.exs +++ b/apps/explorer/test/explorer/chain/import_test.exs @@ -573,7 +573,7 @@ defmodule Explorer.Chain.ImportTest do transaction = :transaction - |> insert(error: nil, internal_transactions_indexed_at: nil, status: nil, from_address: from_address, status: 0) + |> insert(error: nil, internal_transactions_indexed_at: nil, status: nil, from_address: from_address) |> with_block(block, status: :error) internal_transacton = From 44f245ade0ee63c5131897716f38ad5e1557db5e Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 12:22:06 +0300 Subject: [PATCH 02/11] save additional validation fields to smart contract --- ...ddress_contract_verification_controller.ex | 9 +-------- .../new.html.eex | 4 ++-- .../lib/explorer/chain/smart_contract.ex | 19 +++++++++++++++++-- .../lib/explorer/smart_contract/publisher.ex | 2 ++ ...5085852_add_additional_contract_fields.exs | 10 ++++++++++ 5 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex index 8f35dcaa86..3e0c79acc4 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex @@ -25,16 +25,9 @@ defmodule BlockScoutWeb.AddressContractVerificationController do %{ "address_id" => address_hash_string, "smart_contract" => smart_contract, - "external_libraries" => external_libraries, - "evm_version" => evm_version, - "optimization" => optimization + "external_libraries" => external_libraries } ) do - smart_sontact_with_evm_version = - smart_contract - |> Map.put("evm_version", evm_version["evm_version"]) - |> Map.put("optimization_runs", parse_optimization_runs(optimization)) - case Publisher.publish(address_hash_string, smart_sontact_with_evm_version, external_libraries) do {:ok, _smart_contract} -> redirect(conn, to: address_contract_path(conn, :index, address_hash_string)) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex index 212264d445..7214af2eee 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification/new.html.eex @@ -44,7 +44,7 @@
<%= label :evm_version, :evm_version, gettext("EVM Version") %>
- <%= select :evm_version, :evm_version, @evm_versions, class: "form-control border-rounded", selected: "petersburg", "aria-describedby": "evm-version-help-block" %> + <%= select f, :evm_version, @evm_versions, class: "form-control border-rounded", selected: "petersburg", "aria-describedby": "evm-version-help-block" %>
The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version. EVM version details.
@@ -76,7 +76,7 @@
<%= label f, :name, gettext("Optimization runs") %>
- <%= text_input :optimization, :runs, value: 200, class: "form-control border-rounded", "aria-describedby": "optimization-runs-help-block", "data-test": "optimization-runs" %> + <%= text_input f, :optimization_runs, value: 200, class: "form-control border-rounded", "aria-describedby": "optimization-runs-help-block", "data-test": "optimization-runs" %>
diff --git a/apps/explorer/lib/explorer/chain/smart_contract.ex b/apps/explorer/lib/explorer/chain/smart_contract.ex index 937c1d422f..1cd9accfff 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract.ex @@ -198,6 +198,9 @@ defmodule Explorer.Chain.SmartContract do compiler_version: String.t(), optimization: boolean, contract_source_code: String.t(), + constructor_arguments: String.t() | nil, + evm_version: String.t() | nil, + optimization_runs: non_neg_integer() | nil, abi: [function_description] } @@ -207,6 +210,8 @@ defmodule Explorer.Chain.SmartContract do field(:optimization, :boolean) field(:contract_source_code, :string) field(:constructor_arguments, :string) + field(:evm_version, :string) + field(:optimization_runs, :integer) field(:abi, {:array, :map}) has_many( @@ -239,7 +244,9 @@ defmodule Explorer.Chain.SmartContract do :contract_source_code, :address_hash, :abi, - :constructor_arguments + :constructor_arguments, + :evm_version, + :optimization_runs ]) |> validate_required([:name, :compiler_version, :optimization, :contract_source_code, :abi, :address_hash]) |> unique_constraint(:address_hash) @@ -248,7 +255,15 @@ defmodule Explorer.Chain.SmartContract do def invalid_contract_changeset(%__MODULE__{} = smart_contract, attrs, error) do smart_contract - |> cast(attrs, [:name, :compiler_version, :optimization, :contract_source_code, :address_hash]) + |> cast(attrs, [ + :name, + :compiler_version, + :optimization, + :contract_source_code, + :address_hash, + :evm_version, + :optimization_runs + ]) |> validate_required([:name, :compiler_version, :optimization, :address_hash]) |> add_error(:contract_source_code, error_message(error)) end diff --git a/apps/explorer/lib/explorer/smart_contract/publisher.ex b/apps/explorer/lib/explorer/smart_contract/publisher.ex index 4cc4d4f0a1..55ea5c4e6d 100644 --- a/apps/explorer/lib/explorer/smart_contract/publisher.ex +++ b/apps/explorer/lib/explorer/smart_contract/publisher.ex @@ -68,6 +68,8 @@ defmodule Explorer.SmartContract.Publisher do address_hash: address_hash, name: params["name"], compiler_version: params["compiler_version"], + evm_version: params["evm_version"], + optimization_runs: params["optimization_runs"], optimization: params["optimization"], contract_source_code: params["contract_source_code"], constructor_arguments: clean_constructor_arguments, diff --git a/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs b/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs new file mode 100644 index 0000000000..7d1ab98bea --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs @@ -0,0 +1,10 @@ +defmodule Explorer.Repo.Migrations.AddAdditionalContractFields do + use Ecto.Migration + + def change do + alter table(:smart_contracts) do + add(:optimization_runs, :integer, null: true) + add(:evm_version, :string, null: true) + end + end +end From 5281f5a1b4864288fce4a32f16a49aaa9f3e4bc1 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 12:25:08 +0300 Subject: [PATCH 03/11] cast constructor arguments --- apps/explorer/lib/explorer/chain/smart_contract.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/chain/smart_contract.ex b/apps/explorer/lib/explorer/chain/smart_contract.ex index 1cd9accfff..2f6fd741af 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract.ex @@ -262,7 +262,8 @@ defmodule Explorer.Chain.SmartContract do :contract_source_code, :address_hash, :evm_version, - :optimization_runs + :optimization_runs, + :constructor_arguments ]) |> validate_required([:name, :compiler_version, :optimization, :address_hash]) |> add_error(:contract_source_code, error_message(error)) From ae90d762fd5b3936df260a32eb8a28454bba592c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 12:33:50 +0300 Subject: [PATCH 04/11] fix typo --- .../controllers/address_contract_verification_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex index 3e0c79acc4..dad0ebaeaf 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex @@ -28,7 +28,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do "external_libraries" => external_libraries } ) do - case Publisher.publish(address_hash_string, smart_sontact_with_evm_version, external_libraries) do + case Publisher.publish(address_hash_string, smart_contract, external_libraries) do {:ok, _smart_contract} -> redirect(conn, to: address_contract_path(conn, :index, address_hash_string)) From 41dd6b9ec27a17458ff4fc3a3e5217d6deae0fd2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 14:32:47 +0300 Subject: [PATCH 05/11] show new fields in the interface --- .../templates/address_contract/index.html.eex | 20 ++++++++++++++++++- .../smart_contract/solidity/code_compiler.ex | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex index abacec4b61..6a328a6705 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex @@ -30,10 +30,28 @@
<%= gettext "Compiler version" %>
<%= @address.smart_contract.compiler_version %>
+ <%= if @address.smart_contract.evm_version do %> +
+
<%= gettext "EVM Version" %>
+
<%= @address.smart_contract.evm_version %>
+
+ <% end %>
<%= gettext "Optimization enabled" %>
<%= format_optimization_text(@address.smart_contract.optimization) %>
+ <%= if @address.smart_contract.optimization && @address.smart_contract.optimization_runs do %> +
+
<%= gettext "Optimization runs" %>
+
<%= @address.smart_contract.optimization_runs %>
+
+ <% end %> + <%= if @address.smart_contract.constructor_arguments do %> +
+
<%= gettext "Constructor arguments" %>
+
<%= @address.smart_contract.constructor_arguments %>
+
+ <% end %>
@@ -64,7 +82,7 @@ <% end %>
<%= case contract_creation_code do %> - <% {:selfdestructed, transaction_init} -> %> + <% {:selfdestructed, transaction_init} -> %>

<%= gettext "Contract Creation Code" %>


diff --git a/apps/explorer/lib/explorer/chain/smart_contract.ex b/apps/explorer/lib/explorer/chain/smart_contract.ex index 2f6fd741af..9dee6b147e 100644 --- a/apps/explorer/lib/explorer/chain/smart_contract.ex +++ b/apps/explorer/lib/explorer/chain/smart_contract.ex @@ -212,6 +212,7 @@ defmodule Explorer.Chain.SmartContract do field(:constructor_arguments, :string) field(:evm_version, :string) field(:optimization_runs, :integer) + field(:external_libraries, :map) field(:abi, {:array, :map}) has_many( @@ -246,7 +247,8 @@ defmodule Explorer.Chain.SmartContract do :abi, :constructor_arguments, :evm_version, - :optimization_runs + :optimization_runs, + :external_libraries ]) |> validate_required([:name, :compiler_version, :optimization, :contract_source_code, :abi, :address_hash]) |> unique_constraint(:address_hash) diff --git a/apps/explorer/lib/explorer/smart_contract/publisher.ex b/apps/explorer/lib/explorer/smart_contract/publisher.ex index 55ea5c4e6d..702b45976d 100644 --- a/apps/explorer/lib/explorer/smart_contract/publisher.ex +++ b/apps/explorer/lib/explorer/smart_contract/publisher.ex @@ -73,6 +73,7 @@ defmodule Explorer.SmartContract.Publisher do optimization: params["optimization"], contract_source_code: params["contract_source_code"], constructor_arguments: clean_constructor_arguments, + external_libaries: params["external_libraries"], abi: abi } end diff --git a/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs b/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs index 7d1ab98bea..031593905a 100644 --- a/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs +++ b/apps/explorer/priv/repo/migrations/20190625085852_add_additional_contract_fields.exs @@ -5,6 +5,7 @@ defmodule Explorer.Repo.Migrations.AddAdditionalContractFields do alter table(:smart_contracts) do add(:optimization_runs, :integer, null: true) add(:evm_version, :string, null: true) + add(:external_libraries, :jsonb, null: true) end end end From 781f7b132eef4f7d5432597c56410f63ddd8d7c7 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 15:32:21 +0300 Subject: [PATCH 07/11] add CHANGELOG entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b671d7539..24c30e0d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#2151](https://github.com/poanetwork/blockscout/pull/2151) - hide dropdown menu then other networks list is empty - [#2191](https://github.com/poanetwork/blockscout/pull/2191) - allow to configure token metadata update interval - [#2146](https://github.com/poanetwork/blockscout/pull/2146) - feat: add eth_getLogs rpc endpoint +- [#2235](https://github.com/poanetwork/blockscout/pull/2235) - save and show additional validation fields to smart contract ### Fixes - [#2229](https://github.com/poanetwork/blockscout/pull/2229) - gap issue between qr and copy button in token transfers, top cards width and height issue @@ -44,7 +45,7 @@ - [#2173](https://github.com/poanetwork/blockscout/pull/2173) - handle correctly empty transactions - [#2174](https://github.com/poanetwork/blockscout/pull/2174) - fix reward channel joining - [#2186](https://github.com/poanetwork/blockscout/pull/2186) - fix net version test -- [#2167](https://github.com/poanetwork/blockscout/pull/2168) - feat: document eth rpc api mimicking endpoints +- [#2167](https://github.com/poanetwork/blockscout/pull/2168) - feat: document eth rpc api mimicking endpoints ### Chore - [#2127](https://github.com/poanetwork/blockscout/pull/2127) - use previouse chromedriver version From 6f79e7ed6d920b3aab767990cf9645c4f3c25a6c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 15:38:23 +0300 Subject: [PATCH 08/11] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 34 +++++++---- .../priv/gettext/en/LC_MESSAGES/default.po | 58 +++++++++++-------- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 3482a7c9f9..20e1ec5da8 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -257,7 +257,7 @@ msgid "Connection Lost, click to load newer validations" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:53 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 msgid "Contract ABI" msgstr "" @@ -295,7 +295,7 @@ msgid "Contract name:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_contract/index.html.eex:70 msgid "Contract source code" msgstr "" @@ -576,7 +576,7 @@ msgid "OUT" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:34 +#: lib/block_scout_web/templates/address_contract/index.html.eex:40 msgid "Optimization enabled" msgstr "" @@ -1404,17 +1404,17 @@ msgid "Support" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:55 +#: lib/block_scout_web/templates/address_contract/index.html.eex:84 msgid "Copy ABI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:71 +#: lib/block_scout_web/templates/address_contract/index.html.eex:100 msgid "Copy Contract Creation Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:43 +#: lib/block_scout_web/templates/address_contract/index.html.eex:72 msgid "Copy Source Code" msgstr "" @@ -1486,6 +1486,7 @@ msgid "Search by address, token symbol name, transaction hash, or block number" msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:35 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:45 msgid "EVM Version" msgstr "" @@ -1516,6 +1517,7 @@ msgid "Decompiler version" msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:45 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 msgid "Optimization runs" msgstr "" @@ -1592,27 +1594,27 @@ msgid "Block Details" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:83 +#: lib/block_scout_web/templates/address_contract/index.html.eex:112 msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:69 +#: lib/block_scout_web/templates/address_contract/index.html.eex:98 msgid "Contract Creation Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:75 +#: lib/block_scout_web/templates/address_contract/index.html.eex:104 msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:85 +#: lib/block_scout_web/templates/address_contract/index.html.eex:114 msgid "Copy Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract/index.html.eex:105 msgid "Displaying the init data provided of the creating transaction." msgstr "" @@ -1748,3 +1750,13 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 msgid "here." msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +msgid "Constructor arguments" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:58 +msgid "External libraries" +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index a78a1ce9e8..f1da6594f6 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -105,7 +105,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/index.html.eex:4 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:59 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:60 msgid "Addresses" msgstr "" @@ -210,8 +210,8 @@ msgstr "" #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/overview.html.eex:144 #: lib/block_scout_web/templates/address/overview.html.eex:152 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:115 msgid "Close" msgstr "" @@ -257,7 +257,7 @@ msgid "Connection Lost, click to load newer validations" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:53 +#: lib/block_scout_web/templates/address_contract/index.html.eex:82 msgid "Contract ABI" msgstr "" @@ -295,7 +295,7 @@ msgid "Contract name:" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:41 +#: lib/block_scout_web/templates/address_contract/index.html.eex:70 msgid "Contract source code" msgstr "" @@ -576,7 +576,7 @@ msgid "OUT" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:34 +#: lib/block_scout_web/templates/address_contract/index.html.eex:40 msgid "Optimization enabled" msgstr "" @@ -626,8 +626,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:143 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:35 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 msgid "QR Code" msgstr "" @@ -684,7 +684,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/overview.html.eex:34 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:37 msgid "Show QR Code" msgstr "" @@ -834,7 +834,7 @@ msgid "Total Difficulty" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:75 msgid "Total Supply" msgstr "" @@ -881,7 +881,7 @@ msgid "Transactions sent" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:60 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:61 msgid "Transfers" msgstr "" @@ -943,7 +943,7 @@ msgid "Verify & publish" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:54 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:55 msgid "View Contract" msgstr "" @@ -1048,7 +1048,7 @@ msgid "Self-Destruct" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:62 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:63 msgid "Decimals" msgstr "" @@ -1404,17 +1404,17 @@ msgid "Support" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:55 +#: lib/block_scout_web/templates/address_contract/index.html.eex:84 msgid "Copy ABI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:71 +#: lib/block_scout_web/templates/address_contract/index.html.eex:100 msgid "Copy Contract Creation Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:43 +#: lib/block_scout_web/templates/address_contract/index.html.eex:72 msgid "Copy Source Code" msgstr "" @@ -1486,6 +1486,7 @@ msgid "Search by address, token symbol name, transaction hash, or block number" msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:35 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:45 msgid "EVM Version" msgstr "" @@ -1516,6 +1517,7 @@ msgid "Decompiler version" msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:45 #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77 msgid "Optimization runs" msgstr "" @@ -1592,27 +1594,27 @@ msgid "Block Details" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:83 +#: lib/block_scout_web/templates/address_contract/index.html.eex:112 msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:69 +#: lib/block_scout_web/templates/address_contract/index.html.eex:98 msgid "Contract Creation Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:75 +#: lib/block_scout_web/templates/address_contract/index.html.eex:104 msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:85 +#: lib/block_scout_web/templates/address_contract/index.html.eex:114 msgid "Copy Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:76 +#: lib/block_scout_web/templates/address_contract/index.html.eex:105 msgid "Displaying the init data provided of the creating transaction." msgstr "" @@ -1714,7 +1716,7 @@ msgstr "" msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 msgid "ETH RPC API Documentation" msgstr "" @@ -1744,7 +1746,17 @@ msgstr "" msgid "custom RPC" msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 msgid "here." msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +msgid "Constructor arguments" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:58 +msgid "External libraries" +msgstr "" From 608749cc9c7e0b7f4da1fe0509eb8f1a85ce4178 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 16:12:59 +0300 Subject: [PATCH 09/11] fix tests --- .../smart_contract/solidity/code_compiler.ex | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index fd151c5cf0..b6dd4c39cf 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -70,7 +70,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do compiler_version = Keyword.fetch!(params, :compiler_version) code = Keyword.fetch!(params, :code) optimize = Keyword.fetch!(params, :optimize) - optimization_runs = params |> Keyword.get(:optimization_runs, "200") + optimization_runs = optimization_runs(params) evm_version = Keyword.get(params, :evm_version, List.last(allowed_evm_versions())) external_libs = Keyword.get(params, :external_libs, %{}) @@ -162,4 +162,14 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do defp optimize_value(true), do: "1" defp optimize_value("true"), do: "1" + + defp optimization_runs(params) do + value = params |> Keyword.get(:optimization_runs, "200") + + if is_binary(value) do + value + else + "#{value}" + end + end end From a91412345a7a9fcc3317421f45eb5e0c9fcfe388 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 28 Jun 2019 11:42:15 +0300 Subject: [PATCH 10/11] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 60 +++++++++++++++- .../priv/gettext/en/LC_MESSAGES/default.po | 70 +++++++++++++++++-- .../smart_contract/solidity/code_compiler.ex | 3 +- 3 files changed, 124 insertions(+), 9 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index ba05459dd7..afdf427f4c 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1740,4 +1740,62 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 msgid "here." -msgstr "" \ No newline at end of file +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 +#: lib/block_scout_web/templates/address_token/index.html.eex:26 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:72 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33 +msgid "CSV" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:11 +msgid "Change Network" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +msgid "Constructor arguments" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:44 +msgid "ERC-20 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:45 +msgid "ERC-721 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:58 +msgid "External libraries" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:24 +msgid "Favorites" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:12 +msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:22 +msgid "Mainnet" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:18 +msgid "Search network" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:23 +msgid "Testnet" +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index a3263ff321..f44892c8a3 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -112,7 +112,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:27 #: lib/block_scout_web/templates/address_transaction/index.html.eex:23 -#: lib/block_scout_web/templates/layout/_network_selector.html.eex:20 +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:21 #: lib/block_scout_web/views/address_internal_transaction_view.ex:8 #: lib/block_scout_web/views/address_transaction_view.ex:8 msgid "All" @@ -734,7 +734,7 @@ msgid "There are no token transfers for this address." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:19 +#: lib/block_scout_web/templates/address_token/index.html.eex:18 msgid "There are no tokens for this address." msgstr "" @@ -812,7 +812,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:8 -#: lib/block_scout_web/templates/address_token/index.html.eex:9 +#: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/views/address_view.ex:304 msgid "Tokens" @@ -1209,7 +1209,7 @@ msgstr "" #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_logs/index.html.eex:21 -#: lib/block_scout_web/templates/address_token/index.html.eex:14 +#: lib/block_scout_web/templates/address_token/index.html.eex:13 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:59 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 @@ -1717,7 +1717,7 @@ msgstr "" msgid "However, in general, the" msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 msgid "There is no decompilded contracts for this address." msgstr "" @@ -1740,4 +1740,62 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 msgid "here." -msgstr "" \ No newline at end of file +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 +#: lib/block_scout_web/templates/address_token/index.html.eex:26 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:72 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33 +msgid "CSV" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:11 +msgid "Change Network" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +msgid "Constructor arguments" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:44 +msgid "ERC-20 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:45 +msgid "ERC-721 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:58 +msgid "External libraries" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:24 +msgid "Favorites" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:12 +msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:22 +msgid "Mainnet" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:18 +msgid "Search network" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:23 +msgid "Testnet" +msgstr "" diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index 41b0839726..c5c1b01930 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -171,9 +171,8 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do else "#{value}" end - end - + defp create_source_file(source) do {:ok, path} = Briefly.create() From 58f26d5d6484573fc0aa245d1eb58d828fc226da Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 1 Jul 2019 17:42:35 +0300 Subject: [PATCH 11/11] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 4 +- .../priv/gettext/en/LC_MESSAGES/default.po | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 25b3bc3e90..299470899a 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1743,10 +1743,8 @@ msgid "here." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 #: lib/block_scout_web/templates/address_token/index.html.eex:26 #: lib/block_scout_web/templates/address_transaction/index.html.eex:72 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33 msgid "CSV" msgstr "" @@ -1798,4 +1796,4 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_network_selector.html.eex:23 msgid "Testnet" -msgstr "" \ No newline at end of file +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 8da291e235..0b57411dd1 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -1742,6 +1742,58 @@ msgstr "" msgid "here." msgstr "" +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:26 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:72 +msgid "CSV" +msgstr "" + +#, elixir-format #: lib/block_scout_web/templates/layout/_network_selector.html.eex:11 msgid "Change Network" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:51 +msgid "Constructor arguments" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:44 +msgid "ERC-20 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/views/transaction_view.ex:45 +msgid "ERC-721 " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:58 +msgid "External libraries" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:24 +msgid "Favorites" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:12 +msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:22 +msgid "Mainnet" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:18 +msgid "Search network" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_network_selector.html.eex:23 +msgid "Testnet" +msgstr ""