improve method not implemented message of AbstractChainDB

previous message only shows method not implemented,
but the method name is missing. now the message including method name
This commit is contained in:
jangko 2022-08-22 14:19:25 +07:00 committed by andri lim
parent 3a0afa4aa2
commit 9f1d5ef1a0
1 changed files with 21 additions and 21 deletions

View File

@ -7,7 +7,7 @@ from stew/objects
import checkedEnumAssign import checkedEnumAssign
export export
stint, read, append, KeccakHash, rlp, options stint, read, append, KeccakHash, rlp, options, hash.`$`
type type
Hash256* = MDigest[256] Hash256* = MDigest[256]
@ -626,8 +626,8 @@ proc rlpHash*[T](v: T): Hash256 =
func blockHash*(h: BlockHeader): KeccakHash {.inline.} = rlpHash(h) func blockHash*(h: BlockHeader): KeccakHash {.inline.} = rlpHash(h)
proc notImplemented = proc notImplemented(name: string) =
debug "Method not implemented" debug "Method not implemented", meth = name
template hasData*(b: Blob): bool = b.len > 0 template hasData*(b: Blob): bool = b.len > 0
template hasData*(r: EthResourceRefs): bool = r != nil template hasData*(r: EthResourceRefs): bool = r != nil
@ -638,11 +638,11 @@ template deref*(r: EthResourceRefs): auto = r[]
method genesisHash*(db: AbstractChainDB): KeccakHash method genesisHash*(db: AbstractChainDB): KeccakHash
{.base, gcsafe, raises: [Defect].} = {.base, gcsafe, raises: [Defect].} =
notImplemented() notImplemented("genesisHash")
method getBlockHeader*(db: AbstractChainDB, b: HashOrNum, method getBlockHeader*(db: AbstractChainDB, b: HashOrNum,
output: var BlockHeader): bool {.base, gcsafe, raises: [RlpError, Defect].} = output: var BlockHeader): bool {.base, gcsafe, raises: [RlpError, Defect].} =
notImplemented() notImplemented("getBlockHeader")
proc getBlockHeader*(db: AbstractChainDB, hash: KeccakHash): BlockHeaderRef {.gcsafe.} = proc getBlockHeader*(db: AbstractChainDB, hash: KeccakHash): BlockHeaderRef {.gcsafe.} =
new result new result
@ -660,56 +660,56 @@ proc getBlockHeader*(db: AbstractChainDB, b: BlockNumber): BlockHeaderRef {.gcsa
# `CanonicalHeadNotFound`. It would probably be better to use Result. # `CanonicalHeadNotFound`. It would probably be better to use Result.
method getBestBlockHeader*(self: AbstractChainDB): BlockHeader method getBestBlockHeader*(self: AbstractChainDB): BlockHeader
{.base, gcsafe, raises: [RlpError, CatchableError, Defect].} = {.base, gcsafe, raises: [RlpError, CatchableError, Defect].} =
notImplemented() notImplemented("getBestBlockHeader")
method getSuccessorHeader*(db: AbstractChainDB, h: BlockHeader, method getSuccessorHeader*(db: AbstractChainDB, h: BlockHeader,
output: var BlockHeader, skip = 0'u): bool output: var BlockHeader, skip = 0'u): bool
{.base, gcsafe, raises: [RlpError, Defect].} = {.base, gcsafe, raises: [RlpError, Defect].} =
notImplemented() notImplemented("getSuccessorHeader")
method getAncestorHeader*(db: AbstractChainDB, h: BlockHeader, method getAncestorHeader*(db: AbstractChainDB, h: BlockHeader,
output: var BlockHeader, skip = 0'u): bool output: var BlockHeader, skip = 0'u): bool
{.base, gcsafe, raises: [RlpError, Defect].} = {.base, gcsafe, raises: [RlpError, Defect].} =
notImplemented() notImplemented("getAncestorHeader")
method getBlockBody*(db: AbstractChainDB, blockHash: KeccakHash): BlockBodyRef method getBlockBody*(db: AbstractChainDB, blockHash: KeccakHash): BlockBodyRef
{.base, gcsafe, raises: [Defect].} = {.base, gcsafe, raises: [Defect].} =
notImplemented() notImplemented("getBlockBody")
method getReceipt*(db: AbstractChainDB, hash: KeccakHash): ReceiptRef {.base, gcsafe.} = method getReceipt*(db: AbstractChainDB, hash: KeccakHash): ReceiptRef {.base, gcsafe.} =
notImplemented() notImplemented("getReceipt")
method getTrieDB*(db: AbstractChainDB): TrieDatabaseRef method getTrieDB*(db: AbstractChainDB): TrieDatabaseRef
{.base, gcsafe, raises: [Defect].} = {.base, gcsafe, raises: [Defect].} =
notImplemented() notImplemented("getTrieDB")
method getCodeByHash*(db: AbstractChainDB, hash: KeccakHash): Blob {.base, gcsafe.} = method getCodeByHash*(db: AbstractChainDB, hash: KeccakHash): Blob {.base, gcsafe.} =
notImplemented() notImplemented("getCodeByHash")
method getSetting*(db: AbstractChainDB, key: string): seq[byte] {.base, gcsafe.} = method getSetting*(db: AbstractChainDB, key: string): seq[byte] {.base, gcsafe.} =
notImplemented() notImplemented("getSetting")
method setSetting*(db: AbstractChainDB, key: string, val: openArray[byte]) {.base, gcsafe.} = method setSetting*(db: AbstractChainDB, key: string, val: openArray[byte]) {.base, gcsafe.} =
notImplemented() notImplemented("setSetting")
method getHeaderProof*(db: AbstractChainDB, req: ProofRequest): Blob {.base, gcsafe.} = method getHeaderProof*(db: AbstractChainDB, req: ProofRequest): Blob {.base, gcsafe.} =
notImplemented() notImplemented("getHeaderProof")
method getProof*(db: AbstractChainDB, req: ProofRequest): Blob {.base, gcsafe.} = method getProof*(db: AbstractChainDB, req: ProofRequest): Blob {.base, gcsafe.} =
notImplemented() notImplemented("getProof")
method getHelperTrieProof*(db: AbstractChainDB, req: HelperTrieProofRequest): Blob {.base, gcsafe.} = method getHelperTrieProof*(db: AbstractChainDB, req: HelperTrieProofRequest): Blob {.base, gcsafe.} =
notImplemented() notImplemented("getHelperTrieProof")
method getTransactionStatus*(db: AbstractChainDB, txHash: KeccakHash): TransactionStatusMsg {.base, gcsafe.} = method getTransactionStatus*(db: AbstractChainDB, txHash: KeccakHash): TransactionStatusMsg {.base, gcsafe.} =
notImplemented() notImplemented("getTransactionStatus")
method addTransactions*(db: AbstractChainDB, transactions: openArray[Transaction]) {.base, gcsafe.} = method addTransactions*(db: AbstractChainDB, transactions: openArray[Transaction]) {.base, gcsafe.} =
notImplemented() notImplemented("addTransactions")
method persistBlocks*(db: AbstractChainDB, headers: openArray[BlockHeader], bodies: openArray[BlockBody]): ValidationResult {.base, gcsafe.} = method persistBlocks*(db: AbstractChainDB, headers: openArray[BlockHeader], bodies: openArray[BlockBody]): ValidationResult {.base, gcsafe.} =
notImplemented() notImplemented("persistBlocks")
method getForkId*(db: AbstractChainDB, n: BlockNumber): ForkID {.base, gcsafe.} = method getForkId*(db: AbstractChainDB, n: BlockNumber): ForkID {.base, gcsafe.} =
# EIP 2364/2124 # EIP 2364/2124
notImplemented() notImplemented("getForkId")