|
|
|
@ -181,7 +181,7 @@ defmodule Explorer.SmartContract.VerifierTest do |
|
|
|
|
swarm_source = "3c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b" |
|
|
|
|
|
|
|
|
|
bytecode = |
|
|
|
|
"0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820" |
|
|
|
|
"0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600" |
|
|
|
|
|
|
|
|
|
assert bytecode == Verifier.extract_bytecode(code) |
|
|
|
|
assert bytecode != code |
|
|
|
@ -189,5 +189,21 @@ defmodule Explorer.SmartContract.VerifierTest do |
|
|
|
|
assert String.contains?(bytecode, "0029") == false |
|
|
|
|
assert String.contains?(bytecode, swarm_source) == false |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "extracts everything to the left of the swarm hash" do |
|
|
|
|
code = |
|
|
|
|
"0x608060405234801561001057600080fd5b5060df80610010029f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058203c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b0029" |
|
|
|
|
|
|
|
|
|
swarm_source = "3c381c1b48b38d050c54d7ef296ecd411040e19420dfec94772b9c49ae106a0b" |
|
|
|
|
|
|
|
|
|
bytecode = |
|
|
|
|
"0x608060405234801561001057600080fd5b5060df80610010029f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600" |
|
|
|
|
|
|
|
|
|
assert bytecode == Verifier.extract_bytecode(code) |
|
|
|
|
assert bytecode != code |
|
|
|
|
assert String.contains?(code, bytecode) == true |
|
|
|
|
assert String.contains?(bytecode, "0029") == true |
|
|
|
|
assert String.contains?(bytecode, swarm_source) == false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|