aboutsummaryrefslogtreecommitdiffstats
path: root/liblll/CompilerState.cpp
diff options
context:
space:
mode:
authorbenjaminion <ben@edginet.org>2017-06-14 05:20:14 +0800
committerbenjaminion <ben@edginet.org>2017-06-14 05:20:14 +0800
commit3299c479b6d8f90a13c6464acc0cb2e7db012ab0 (patch)
treee808847b8c1b31a4cb268fc92c85651015ad45da /liblll/CompilerState.cpp
parentd3f4c97c533b2f64dda9fe7bdf5848f6c8bbb300 (diff)
downloaddexon-solidity-3299c479b6d8f90a13c6464acc0cb2e7db012ab0.tar.gz
dexon-solidity-3299c479b6d8f90a13c6464acc0cb2e7db012ab0.tar.zst
dexon-solidity-3299c479b6d8f90a13c6464acc0cb2e7db012ab0.zip
LLL: fix handling of "sha3" expression
When PR #2317 changed the EVM opcode from SHA3 to KECCAK256 it broke the `(sha3 loc len)` expression in LLL. This PR fixes things while allowing existing code using the sha3 expression (such as the ENS registrar) to continue to compile. I.e. both `(keccak256 loc len)` and `(sha3 loc len)` may be used, and the existing related sha3 macros continue to work. Three end-to-end test cases have been added for kekkac256 and sha3.
Diffstat (limited to 'liblll/CompilerState.cpp')
-rw-r--r--liblll/CompilerState.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp
index 006929e4..b990ecac 100644
--- a/liblll/CompilerState.cpp
+++ b/liblll/CompilerState.cpp
@@ -56,10 +56,10 @@ void CompilerState::populateStandard()
"(def 'msg (to data) { [0]:data (msg allgas to 0 0 32) })"
"(def 'create (value code) { [0]:(msize) (create value @0 (lll code @0)) })"
"(def 'create (code) { [0]:(msize) (create 0 @0 (lll code @0)) })"
+ "(def 'sha3 (loc len) (keccak256 loc len))"
"(def 'sha3 (val) { [0]:val (sha3 0 32) })"
"(def 'sha3pair (a b) { [0]:a [32]:b (sha3 0 64) })"
"(def 'sha3trip (a b c) { [0]:a [32]:b [64]:c (sha3 0 96) })"
- "(def 'keccak256 (loc len) (sha3 loc len))"
"(def 'return (val) { [0]:val (return 0 32) })"
"(def 'returnlll (code) (return 0 (lll code 0)) )"
"(def 'makeperm (name pos) { (def name (sload pos)) (def name (v) (sstore pos v)) } )"