mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 22:04:52 +00:00
Use new memrange and nim rlp
This commit is contained in:
parent
41ffbc4049
commit
b7d949eec2
@ -5,7 +5,7 @@ import
|
||||
# rlpFields UInt256, table
|
||||
|
||||
type
|
||||
TypeHint* {.pure.} = enum UInt256, Bytes, Any
|
||||
TypeHint* {.pure.} = enum UInt256, Bytes, Any # TODO Bytes is in conflict with nim-rlp Bytes = seq[byte]
|
||||
EthTime* = Time
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ proc setStorage*(db: var AccountStateDB, address: string, slot: UInt256, value:
|
||||
# TODO fix
|
||||
if value > 0:
|
||||
let encodedValue = rlp.encode(value)
|
||||
storage[slotAsKey] = encodedValue.bytes[encodedValue.ibegin..<encodedValue.iend]
|
||||
storage[slotAsKey] = encodedValue.decode(Bytes)
|
||||
else:
|
||||
storage.del(slotAsKey)
|
||||
#storage[slotAsKey] = value
|
||||
@ -91,9 +91,7 @@ proc getStorage*(db: var AccountStateDB, address: string, slot: UInt256): (UInt2
|
||||
var storage = db.db
|
||||
if storage.hasKey(slotAsKey):
|
||||
#result = storage[slotAsKey]
|
||||
var encodedValue = storage[slotAsKey]
|
||||
var r = rlpFromBytes(encodedValue.initBytesRange)
|
||||
result = (r.read(Bytes).bigEndianToInt, true)
|
||||
result = (storage[slotAsKey].bigEndianToInt, true)
|
||||
else:
|
||||
result = (0.u256, false)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user