aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/index.rst9
-rw-r--r--test/libevmasm/Assembler.cpp49
-rw-r--r--test/libjulia/Simplifier.cpp28
3 files changed, 61 insertions, 25 deletions
diff --git a/docs/index.rst b/docs/index.rst
index af27d534..53d44f08 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -127,6 +127,15 @@ Solidity Tools
* `ABI to solidity interface converter <https://gist.github.com/chriseth/8f533d133fa0c15b0d6eaf3ec502c82b>`_
A script for generating contract interfaces from the ABI of a smart contract.
+
+* `Securify <https://securify.ch/>`_
+ Fully automated online static analyzer for smart contracts, providing a security report based on vulnerability patterns.
+
+* `SÅ«rya <https://github.com/ConsenSys/surya/>`_
+ Utility tool for smart contract systems, offering a number of visual outputs and information about the contracts' structure. Also supports querying the function call graph.
+
+* `EVM Lab <https://github.com/ethereum/evmlab/>`_
+ Rich tool package to interact with the EVM. Includes a VM, Etherchain API, and a trace-viewer with gas cost display.
.. note::
Information like variable names, comments, and source code formatting is lost in the compilation process and it is not possible to completely recover the original source code. Decompiling smart contracts to view the original source code might not be possible, or the end result that useful.
diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp
index d79115a0..8992430e 100644
--- a/test/libevmasm/Assembler.cpp
+++ b/test/libevmasm/Assembler.cpp
@@ -41,9 +41,9 @@ namespace test
namespace
{
- void checkCompilation(Assembly const& _asm)
+ void checkCompilation(::dev::eth::Assembly const& _assembly)
{
- LinkerObject output = _asm.assemble();
+ LinkerObject output = _assembly.assemble();
BOOST_CHECK(output.bytecode.size() > 0);
BOOST_CHECK(output.toHex().length() > 0);
}
@@ -53,8 +53,8 @@ BOOST_AUTO_TEST_SUITE(Assembler)
BOOST_AUTO_TEST_CASE(all_assembly_items)
{
- Assembly _asm;
- _asm.setSourceLocation(SourceLocation(1, 3, make_shared<string>("root.asm")));
+ Assembly _assembly;
+ _assembly.setSourceLocation(SourceLocation(1, 3, make_shared<string>("root.asm")));
Assembly _subAsm;
_subAsm.setSourceLocation(SourceLocation(6, 8, make_shared<string>("sub.asm")));
@@ -62,44 +62,45 @@ BOOST_AUTO_TEST_CASE(all_assembly_items)
shared_ptr<Assembly> _subAsmPtr = make_shared<Assembly>(_subAsm);
// Tag
- auto tag = _asm.newTag();
- _asm.append(tag);
+ auto tag = _assembly.newTag();
+ _assembly.append(tag);
// Operation
- _asm.append(u256(1));
- _asm.append(u256(2));
+ _assembly.append(u256(1));
+ _assembly.append(u256(2));
// Push
- _asm.append(Instruction::KECCAK256);
+ _assembly.append(Instruction::KECCAK256);
// PushProgramSize
- _asm.appendProgramSize();
+ _assembly.appendProgramSize();
// PushLibraryAddress
- _asm.appendLibraryAddress("someLibrary");
+ _assembly.appendLibraryAddress("someLibrary");
// PushTag + Operation
- _asm.appendJump(tag);
+ _assembly.appendJump(tag);
// PushString
- _asm.append("Unused feature for pushing string");
+ _assembly.append("Unused feature for pushing string");
// PushData
- _asm.append(bytes{0x1, 0x2, 0x3, 0x4});
+ _assembly.append(bytes{0x1, 0x2, 0x3, 0x4});
// PushSubSize
- auto sub = _asm.appendSubroutine(_subAsmPtr);
+ auto sub = _assembly.appendSubroutine(_subAsmPtr);
// PushSub
- _asm.pushSubroutineOffset(size_t(sub.data()));
+ _assembly.pushSubroutineOffset(size_t(sub.data()));
// PushDeployTimeAddress
- _asm.append(PushDeployTimeAddress);
+ _assembly.append(PushDeployTimeAddress);
// Operation
- _asm.append(Instruction::STOP);
- _asm.appendAuxiliaryDataToEnd(bytes{0x42, 0x66});
- _asm.appendAuxiliaryDataToEnd(bytes{0xee, 0xaa});
+ _assembly.append(Instruction::STOP);
+ _assembly.appendAuxiliaryDataToEnd(bytes{0x42, 0x66});
+ _assembly.appendAuxiliaryDataToEnd(bytes{0xee, 0xaa});
+
+ checkCompilation(_assembly);
- checkCompilation(_asm);
BOOST_CHECK_EQUAL(
- _asm.assemble().toHex(),
+ _assembly.assemble().toHex(),
"5b6001600220606773__someLibrary___________________________"
"6000567f556e75736564206665617475726520666f722070757368696e"
"6720737472696e605f6001605e7300000000000000000000000000000000000000000000"
"fe010203044266eeaa"
);
BOOST_CHECK_EQUAL(
- _asm.assemblyString(),
+ _assembly.assemblyString(),
" /* \"root.asm\":1:3 */\n"
"tag_1:\n"
" keccak256(0x2, 0x1)\n"
@@ -123,7 +124,7 @@ BOOST_AUTO_TEST_CASE(all_assembly_items)
"auxdata: 0x4266eeaa\n"
);
BOOST_CHECK_EQUAL(
- dev::jsonCompactPrint(_asm.assemblyJSON()),
+ dev::jsonCompactPrint(_assembly.assemblyJSON()),
"{\".auxdata\":\"4266eeaa\",\".code\":[{\"begin\":1,\"end\":3,\"name\":\"tag\",\"value\":\"1\"},"
"{\"begin\":1,\"end\":3,\"name\":\"JUMPDEST\"},"
"{\"begin\":1,\"end\":3,\"name\":\"PUSH\",\"value\":\"1\"},"
diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp
index e5b7e0d8..3cc95b7a 100644
--- a/test/libjulia/Simplifier.cpp
+++ b/test/libjulia/Simplifier.cpp
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(mod_and)
);
}
-BOOST_AUTO_TEST_CASE(not_applied)
+BOOST_AUTO_TEST_CASE(not_applied_removes_non_constant_and_not_movable)
{
CHECK(
// The first argument of div is not constant.
@@ -149,4 +149,30 @@ BOOST_AUTO_TEST_CASE(not_applied)
);
}
+BOOST_AUTO_TEST_CASE(not_applied_function_call_different_names)
+{
+ CHECK(
+ "{ function f1() -> a { } function f2() -> b {} let c := sub(f1(), f2()) }",
+ "{ function f1() -> a { } function f2() -> b {} let c := sub(f1(), f2()) }"
+ );
+}
+
+BOOST_AUTO_TEST_CASE(not_applied_function_call_different_arguments)
+{
+ CHECK(
+ "{ function f(a) -> b { } let c := sub(f(0), f(1)) }",
+ "{ function f(a) -> b { } let c := sub(f(0), f(1)) }"
+ );
+}
+
+BOOST_AUTO_TEST_CASE(not_applied_function_call_equality_not_movable)
+{
+ CHECK(
+ // Even if the functions pass the equality check, they are not movable.
+ "{ function f() -> a { } let b := sub(f(), f()) }",
+ "{ function f() -> a { } let b := sub(f(), f()) }"
+ );
+}
+
+
BOOST_AUTO_TEST_SUITE_END()