fix recurring symbol collision problem

This commit is contained in:
andri lim 2019-03-07 22:53:09 +07:00
parent b303786128
commit e2311d798b
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
7 changed files with 12 additions and 12 deletions

View File

@ -107,7 +107,7 @@ proc persistTransactions*(self: BaseChainDB, blockNumber: BlockNumber, transacti
for idx, tx in transactions:
let
encodedTx = rlp.encode(tx).toRange
txHash = keccak(encodedTx.toOpenArray)
txHash = keccakHash(encodedTx.toOpenArray)
txKey: TransactionKey = (blockNumber, idx)
trie.put(rlp.encode(idx).toRange, encodedTx)
self.db.put(transactionHashToBlockKey(txHash).toOpenArray, rlp.encode(txKey))
@ -127,7 +127,7 @@ iterator getBlockTransactionHashes(self: BaseChainDB, blockHeader: BlockHeader):
## Returns an iterable of the transaction hashes from th block specified
## by the given block header.
for encodedTx in self.getBlockTransactionData(blockHeader.txRoot):
yield keccak(encodedTx.toOpenArray)
yield keccakHash(encodedTx.toOpenArray)
proc getBlockBody*(self: BaseChainDB, blockHash: Hash256, output: var BlockBody): bool =
var header: BlockHeader
@ -247,7 +247,7 @@ proc persistUncles*(self: BaseChainDB, uncles: openarray[BlockHeader]): Hash256
## Persists the list of uncles to the database.
## Returns the uncles hash.
let enc = rlp.encode(uncles)
result = keccak(enc)
result = keccakHash(enc)
self.db.put(genericHashKey(result).toOpenArray, enc)
#proc persistBlockToDb*(self: BaseChainDB; blk: Block): ValidationResult =

View File

@ -115,7 +115,7 @@ proc setStorage*(db: var AccountStateDB,
var
triedb = HexaryTrie(db.trie).db
# slotHash can be obtained from accountTrie.put?
slotHash = keccak(slot.toByteArrayBE)
slotHash = keccakHash(slot.toByteArrayBE)
triedb.put(slotHashToSlotKey(slotHash.data).toOpenArray, rlp.encode(slot))
account.storageRoot = accountTrie.rootHash
@ -165,7 +165,7 @@ proc setCode*(db: AccountStateDB, address: EthAddress, code: ByteRange) =
# also use JournalDB to revert state trie
let
newCodeHash = keccak code.toOpenArray
newCodeHash = keccakHash(code.toOpenArray)
triedb = HexaryTrie(db.trie).db
if code.len != 0:

View File

@ -376,7 +376,7 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) =
for i in 0 ..< blockBody.uncles.len:
rawData[startIdx .. startIdx + 32] = blockBody.uncles[i].hash.data
startIdx += 32
result.sha3Uncles = keccak(rawData)
result.sha3Uncles = keccakHash(rawData)
result.logsBloom = some(header.bloom)
result.transactionsRoot = header.txRoot

View File

@ -14,11 +14,11 @@ template calcTxRoot*(transactions: openArray[Transaction]): Hash256 =
template calcReceiptRoot*(receipts: openArray[Receipt]): Hash256 =
calcRootHash(receipts)
func keccak*(value: openarray[byte]): Hash256 {.inline.} =
func keccakHash*(value: openarray[byte]): Hash256 {.inline.} =
keccak256.digest value
func generateAddress*(address: EthAddress, nonce: AccountNonce): EthAddress =
result[0..19] = keccak(rlp.encodeList(address, nonce)).data.toOpenArray(12, 31)
result[0..19] = keccakHash(rlp.encodeList(address, nonce)).data.toOpenArray(12, 31)
func hash*(b: BlockHeader): Hash256 {.inline.} =
rlpHash(b)

View File

@ -11,7 +11,7 @@ const
proc store(memoryDB: TrieDatabaseRef, branch: JsonNode) =
for p in branch:
let rlp = hexToSeqByte(p.getStr)
let hash = keccak(rlp)
let hash = keccakHash(rlp)
memoryDB.put(hash.data, rlp)
proc parseAddress(address: string): EthAddress =

View File

@ -16,7 +16,7 @@ import
../nimbus/db/[db_chain, state_db]
proc hashLogEntries(logs: seq[Log]): string =
toLowerAscii("0x" & $keccak(rlp.encode(logs)))
toLowerAscii("0x" & $keccakHash(rlp.encode(logs)))
proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus)

View File

@ -17,7 +17,7 @@ import
../nimbus/db/[db_chain, state_db]
proc hashLogEntries(logs: seq[Log]): string =
toLowerAscii("0x" & $keccak(rlp.encode(logs)))
toLowerAscii("0x" & $keccakHash(rlp.encode(logs)))
proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus)
@ -32,7 +32,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
break
let fenv = fixture["env"]
var emptyRlpHash = keccak(rlp.encode(""))
var emptyRlpHash = keccakHash(rlp.encode(""))
let header = BlockHeader(
coinbase: fenv{"currentCoinbase"}.getStr.parseAddress,
difficulty: fromHex(UInt256, fenv{"currentDifficulty"}.getStr),