Get test_opcode to run
This commit is contained in:
parent
ea94447d48
commit
4e1755a0bf
|
@ -1,5 +1,5 @@
|
||||||
import
|
import
|
||||||
../constants, ../errors, ../computation, ../vm_state, ../types, .. / vm / [stack]
|
../constants, ../errors, ../computation, ../vm_state, ../types, .. / vm / [stack], ttmath
|
||||||
|
|
||||||
{.this: computation.}
|
{.this: computation.}
|
||||||
{.experimental.}
|
{.experimental.}
|
||||||
|
@ -16,7 +16,7 @@ proc coinbase*(computation) =
|
||||||
stack.push(vmState.coinbase)
|
stack.push(vmState.coinbase)
|
||||||
|
|
||||||
proc timestamp*(computation) =
|
proc timestamp*(computation) =
|
||||||
stack.push(vmState.timestamp.u256)
|
stack.push(vmState.timestamp.uint64.u256) # TODO: EthTime (from Time) is distinct
|
||||||
|
|
||||||
proc number*(computation) =
|
proc number*(computation) =
|
||||||
stack.push(vmState.blockNumber)
|
stack.push(vmState.blockNumber)
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
import
|
import
|
||||||
keccak_tiny, strutils
|
nimcrypto, strutils
|
||||||
|
|
||||||
|
#[
|
||||||
template keccak*(value: string): string =
|
template keccak*(value: string): string =
|
||||||
$keccak_256(value)
|
$keccak_256(value)
|
||||||
|
|
||||||
template keccak*(value: cstring): string =
|
template keccak*(value: cstring): string =
|
||||||
($value).keccak
|
($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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue