aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-22 06:55:26 +0800
committerGitHub <noreply@github.com>2017-06-22 06:55:26 +0800
commit3094e777486c40c91c6cf3432ad60f29b9ada484 (patch)
tree1b6f4c5f3df7eba1715a5ac69ca63ef42440b130
parent176f8f903a9b3f4d83b5aaf2a04094a1bf6f4cd7 (diff)
parent35bf91407ea03a8fabbfe7e312720dd90945d1a4 (diff)
downloaddexon-solidity-3094e777486c40c91c6cf3432ad60f29b9ada484.tar.gz
dexon-solidity-3094e777486c40c91c6cf3432ad60f29b9ada484.tar.zst
dexon-solidity-3094e777486c40c91c6cf3432ad60f29b9ada484.zip
Merge pull request #2417 from benjaminion/lll-relabel-ecrecover-macro
LLL: Correctly label arguments to ecrecover built-in macro.
-rw-r--r--liblll/CompilerState.cpp2
-rw-r--r--test/liblll/EndToEndTest.cpp19
2 files changed, 20 insertions, 1 deletions
diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp
index c22242a3..c76ef655 100644
--- a/liblll/CompilerState.cpp
+++ b/liblll/CompilerState.cpp
@@ -65,7 +65,7 @@ void CompilerState::populateStandard()
"(def 'makeperm (name pos) { (def name (sload pos)) (def name (v) (sstore pos v)) } )"
"(def 'permcount 0)"
"(def 'perm (name) { (makeperm name permcount) (def 'permcount (+ permcount 1)) } )"
- "(def 'ecrecover (r s v hash) { [0] r [32] s [64] v [96] hash (msg allgas 1 0 0 128) })"
+ "(def 'ecrecover (hash v r s) { [0] hash [32] v [64] r [96] s (msg allgas 1 0 0 128) })"
"(def 'sha256 (data datasize) (msg allgas 2 0 data datasize))"
"(def 'ripemd160 (data datasize) (msg allgas 3 0 data datasize))"
"(def 'sha256 (val) { [0]:val (sha256 0 32) })"
diff --git a/test/liblll/EndToEndTest.cpp b/test/liblll/EndToEndTest.cpp
index 3928ff45..3668038d 100644
--- a/test/liblll/EndToEndTest.cpp
+++ b/test/liblll/EndToEndTest.cpp
@@ -328,6 +328,25 @@ BOOST_AUTO_TEST_CASE(sha3_one_arg)
fromHex("b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6")));
}
+BOOST_AUTO_TEST_CASE(ecrecover)
+{
+ char const* sourceCode = R"(
+ (returnlll
+ (return
+ (ecrecover
+ ; Hash of 'hello world'
+ 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad
+ ; v = 1 + 27
+ 0x1c
+ ; r
+ 0xdebaaa0cddb321b2dcaaf846d39605de7b97e77ba6106587855b9106cb104215
+ ; s
+ 0x61a22d94fa8b8a687ff9c911c844d1c016d1a685a9166858f9c7c1bc85128aca)))
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFallback() == encodeArgs(fromHex("0x8743523d96a1b2cbe0c6909653a56da18ed484af")));
+}
+
BOOST_AUTO_TEST_CASE(shift_left)
{
char const* sourceCode = R"(