add txKind to report page

This commit is contained in:
andri lim 2019-01-15 16:18:27 +07:00 committed by zah
parent 6ebe8ef2d4
commit 16cebc469b
3 changed files with 19 additions and 1 deletions

View File

@ -209,7 +209,7 @@ function transactionsRenderer(txId, nimbus, geth) {
}
}
txId = parseInt(txId);
let tx = geth.block.transactions[txId];
let ntx = nimbus.txTraces[txId];
let gtx = geth.txTraces[txId];
@ -231,6 +231,7 @@ function transactionsRenderer(txId, nimbus, geth) {
geth.receipts[txId]
);
$(`<h4>Transaction Kind: ${tx.txKind}</h4>`).appendTo(container);
renderTx(ncr, gcr);
}

View File

@ -153,6 +153,12 @@
of other transactions. In opcode section, the same thing happened, perhaps only the first instruction
with red colored text have the problem, but it will affect the rest of other instructions.
</p>
<p>
In <span class="uk-text-success">Transactions</span> section, you'll see the transaction kind.
It has three kind: <span class="uk-text-warning">Regular, ContractCreation, and ContractCall</span>.
Each kind will help you locate the bug in Nimbus implementation, they have their own proc.
</p>
</div>
</div>
<!-- Help Page -->

View File

@ -130,21 +130,32 @@ proc updateAccount*(address: string, account: JsonNode, blockNumber: Uint256) =
account["storage"][x["key"].getStr] = x["value"]
proc requestPostState*(premix, n: JsonNode, blockNumber: Uint256) =
type
TxKind {.pure.} = enum
Regular
ContractCreation
ContractCall
let txs = n["transactions"]
if txs.len == 0: return
let tracer = jsonTracer(postStateTracer)
for t in txs:
var txKind = TxKind.Regular
let tx = parseTransaction(t)
if tx.isContractCreation: txKind = TxKind.ContractCreation
if hasInternalTx(tx, blockNumber):
let txTrace = requestInternalTx(t["hash"], tracer)
for address, account in txTrace:
updateAccount(address, account, blockNumber)
premix.add account
if not tx.isContractCreation: txKind = TxKind.ContractCall
else:
premix.requestAccount(blockNumber, tx.getRecipient)
premix.requestAccount(blockNumber, tx.getSender)
t["txKind"] = %($txKind)
proc requestPostState*(thisBlock: Block): JsonNode =
let blockNumber = thisBlock.header.blockNumber
var premix = newJArray()