Revert keccak change, get test_opcode to run

This commit is contained in:
Coffepots 2018-04-06 19:29:47 +01:00
parent 59b28cd1b2
commit c66afe18dd
2 changed files with 3 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import
../constants, ../errors, ../computation, ../vm_state, ../types, .. / vm / [stack], ttmath
../constants, ../errors, ../computation, ../vm_state, ../types, .. / vm / [stack]
{.this: computation.}
{.experimental.}
@ -19,6 +19,7 @@ proc timestamp*(computation) =
# TODO: EthTime is an alias of Time, which is a distinct int64 so can't use u256(int64)
# This may have implications for different platforms.
stack.push(vmState.timestamp.uint64.u256)
stack.push(vmState.timestamp.u256)
proc number*(computation) =
stack.push(vmState.blockNumber)

View File

@ -1,18 +1,8 @@
import
nimcrypto, strutils
keccak_tiny, strutils
#[
template keccak*(value: string): string =
$keccak_256(value)
template keccak*(value: cstring): string =
($value).keccak
]#
proc keccak*(value: string): string =
# TODO: Urgent - check this is doing the same thing as above
var k = sha3_256()
k.init
k.update(cast[ptr uint8](value[0].unsafeaddr), value.len.uint)
result = $finish(k)