|
|
@ -6,26 +6,7 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArgumentsTest do |
|
|
|
alias Explorer.Chain.Data |
|
|
|
alias Explorer.Chain.Data |
|
|
|
alias Explorer.SmartContract.Verifier.ConstructorArguments |
|
|
|
alias Explorer.SmartContract.Verifier.ConstructorArguments |
|
|
|
|
|
|
|
|
|
|
|
describe "verify/3" do |
|
|
|
|
|
|
|
test "verifies constructor arguments" do |
|
|
|
|
|
|
|
bytecode = "0x0102030" |
|
|
|
|
|
|
|
constructor_arguments = "0x405" |
|
|
|
|
|
|
|
address = insert(:address) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input = %Data{ |
|
|
|
|
|
|
|
bytes: <<1, 2, 3, 4, 5>> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:transaction |
|
|
|
|
|
|
|
|> insert(created_contract_address_hash: address.hash, input: input) |
|
|
|
|
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert ConstructorArguments.verify(address.hash, bytecode, constructor_arguments) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "veriies constructor constructor arguments with whisper data" do |
|
|
|
test "veriies constructor constructor arguments with whisper data" do |
|
|
|
bytecode = "0x0102035d943c575be8a2aee2bb7737a765fdd2c6e49b74cd2c92ab0fa8e4282d1a75ae0029" |
|
|
|
|
|
|
|
constructor_arguments = "0x0405" |
|
|
|
constructor_arguments = "0x0405" |
|
|
|
address = insert(:address) |
|
|
|
address = insert(:address) |
|
|
|
|
|
|
|
|
|
|
@ -39,6 +20,6 @@ defmodule Explorer.SmartContract.Verifier.ConstructorArgumentsTest do |
|
|
|
|> insert(created_contract_address_hash: address.hash, input: input) |
|
|
|
|> insert(created_contract_address_hash: address.hash, input: input) |
|
|
|
|> with_block() |
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
|
|
|
assert ConstructorArguments.verify(address.hash, bytecode, constructor_arguments) |
|
|
|
assert ConstructorArguments.verify(address.hash, constructor_arguments) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|