chore: Enable Rust sc-verifier microservice by default (#9752)

* chore: Enable Rust sc-verifier microservice by default

* Fix explorer tests

* Fix block_scout_web tests
pull/9774/head
Victor Baranov 8 months ago committed by GitHub
parent 9b99f72a3a
commit b8cac6cae8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      apps/block_scout_web/test/block_scout_web/controllers/api/v2/verification_controller_test.exs
  2. 7
      apps/block_scout_web/test/block_scout_web/features/address_contract_verification_test.exs
  3. 9
      apps/explorer/test/explorer/smart_contract/compiler_version_test.exs
  4. 9
      apps/explorer/test/explorer/smart_contract/solidity/publisher_test.exs
  5. 9
      apps/explorer/test/explorer/smart_contract/solidity/verifier_test.exs
  6. 2
      config/runtime.exs

@ -7,6 +7,15 @@ defmodule BlockScoutWeb.API.V2.VerificationControllerTest do
@moduletag timeout: :infinity @moduletag timeout: :infinity
setup do
configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false)
on_exit(fn ->
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration)
end)
end
describe "/api/v2/smart-contracts/verification/config" do describe "/api/v2/smart-contracts/verification/config" do
test "get cfg", %{conn: conn} do test "get cfg", %{conn: conn} do
request = get(conn, "/api/v2/smart-contracts/verification/config") request = get(conn, "/api/v2/smart-contracts/verification/config")

@ -8,8 +8,15 @@ defmodule BlockScoutWeb.AddressContractVerificationTest do
setup do setup do
bypass = Bypass.open() bypass = Bypass.open()
configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false)
Application.put_env(:explorer, :solc_bin_api_url, "http://localhost:#{bypass.port}") Application.put_env(:explorer, :solc_bin_api_url, "http://localhost:#{bypass.port}")
on_exit(fn ->
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration)
end)
{:ok, bypass: bypass} {:ok, bypass: bypass}
end end

@ -6,6 +6,15 @@ defmodule Explorer.SmartContract.CompilerVersionTest do
alias Explorer.SmartContract.CompilerVersion alias Explorer.SmartContract.CompilerVersion
alias Plug.Conn alias Plug.Conn
setup do
configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false)
on_exit(fn ->
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration)
end)
end
describe "fetch_versions/1" do describe "fetch_versions/1" do
setup do setup do
bypass = Bypass.open() bypass = Bypass.open()

@ -11,6 +11,15 @@ defmodule Explorer.SmartContract.Solidity.PublisherTest do
alias Explorer.{Factory, Repo} alias Explorer.{Factory, Repo}
alias Explorer.SmartContract.Solidity.Publisher alias Explorer.SmartContract.Solidity.Publisher
setup do
configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false)
on_exit(fn ->
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration)
end)
end
describe "publish/2" do describe "publish/2" do
test "with valid data creates a smart_contract" do test "with valid data creates a smart_contract" do
contract_code_info = Factory.contract_code_info_modern_compiler() contract_code_info = Factory.contract_code_info_modern_compiler()

@ -61,6 +61,15 @@ defmodule Explorer.SmartContract.Solidity.VerifierTest do
} }
""" """
setup do
configuration = Application.get_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour)
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, enabled: false)
on_exit(fn ->
Application.put_env(:explorer, Explorer.SmartContract.RustVerifierInterfaceBehaviour, configuration)
end)
end
describe "evaluate_authenticity/2" do describe "evaluate_authenticity/2" do
setup do setup do
{:ok, contract_code_info: Factory.contract_code_info()} {:ok, contract_code_info: Factory.contract_code_info()}

@ -422,7 +422,7 @@ config :explorer, Explorer.ThirdPartyIntegrations.NovesFi,
chain_name: System.get_env("NOVES_FI_CHAIN_NAME"), chain_name: System.get_env("NOVES_FI_CHAIN_NAME"),
api_key: System.get_env("NOVES_FI_API_TOKEN") api_key: System.get_env("NOVES_FI_API_TOKEN")
enabled? = ConfigHelper.parse_bool_env_var("MICROSERVICE_SC_VERIFIER_ENABLED") enabled? = ConfigHelper.parse_bool_env_var("MICROSERVICE_SC_VERIFIER_ENABLED", "true")
# or "eth_bytecode_db" # or "eth_bytecode_db"
type = System.get_env("MICROSERVICE_SC_VERIFIER_TYPE", "sc_verifier") type = System.get_env("MICROSERVICE_SC_VERIFIER_TYPE", "sc_verifier")

Loading…
Cancel
Save