Skip to content

Commit

Permalink
remove debug information
Browse files Browse the repository at this point in the history
The various roots are not too interesting to observe outside debugging,
hence remove them from the visible UI.
  • Loading branch information
etan-status committed Aug 7, 2023
1 parent d8332cb commit c8072ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 46 deletions.
51 changes: 5 additions & 46 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,10 @@
font-style: normal;
}

pre {
display: inline;
}

a {
text-decoration: none;
}

li.execution {
color: #595959;
}

#mdMaster {
width: 270px;
height: 100vh;
Expand Down Expand Up @@ -106,7 +98,7 @@
<td><span class="fas fa-satellite-dish"></span> <input id="beaconApiBase" value="https://beacon-api.eth-light.xyz" /></td>
</tr>
<tr>
<td><span class="fas fa-cogs"></span> <input id="executionApiBase" value="https://execution-api.eth-light.xyz/v1/mainnet" /></td>
<td><span class="fas fa-cogs"></span> <input id="executionApiBase" value="https://mainnet.infura.io/v3/d0366f5631e045198d9bb487228a6ec7" /></td>
</tr>
<tr>
<td><span class="fas fa-shield-alt"></span> <input id="trustedBlockRoot" value="0x15cf56ebf887ede9cf3fc10a26ec83828628932c100e42c98c84f83da710c863" /></td>
Expand Down Expand Up @@ -143,22 +135,6 @@
</div>
</div>
<div id="selectedTransactionList"></div>
<ul>
<li><pre>beacon.parent_root</pre>: <b><pre id="selectedBeaconParentRoot"></pre></b></li>
<li><pre>beacon.state_root</pre>: <b><pre id="selectedBeaconStateRoot"></pre></b></li>
<li><pre>beacon.body_root</pre>: <b><pre id="selectedBeaconBodyRoot"></pre></b></li>
<li><pre>execution.hash</pre>: <b><pre id="selectedExecutionHash"></pre></b>
<li><pre>execution.parent_hash</pre>: <b><pre id="selectedExecutionParentHash"></pre></b></li>
<li><pre>execution.state_root</pre>: <b><pre id="selectedExecutionStateRoot"></pre></b></li>
<li><pre>execution.receipts_root</pre>: <b><pre id="selectedExecutionReceiptsRoot"></pre></b></li>
<li><pre>execution.logs_bloom</pre>: <b><pre id="selectedExecutionLogsBloom"></pre></b></li>
<li><pre>execution.prev_randao</pre>: <b><pre id="selectedExecutionPrevRandao"></pre></b></li>
<li><pre>execution.extra_data</pre>: <b><pre id="selectedExecutionExtraData"></pre></b></li>
<li><pre>execution.blob_gas_used</pre>: <b><pre id="selectedExecutionBlobGasUsed"></pre></b></li>
<li><pre>execution.excess_blob_gas</pre>: <b><pre id="selectedExecutionExcessBlobGas"></pre></b></li>
<li class="execution"><pre>execution.transactions_root</pre>: <b><pre id="selectedExecutionTransactionsRoot"></pre></b></li>
<li class="execution"><pre>execution.withdrawals_root</pre>: <b><pre id="selectedExecutionWithdrawalsRoot"></pre></b></li>
</ul>
</div>
</div>
<div id="mdDetail">
Expand Down Expand Up @@ -298,6 +274,9 @@
}
return '0.' + afterDecimal;
}
if (afterDecimal === '') {
return beforeDecimal;
}
return beforeDecimal + '.' + afterDecimal;
}

Expand Down Expand Up @@ -447,31 +426,22 @@
'<a href="https://beaconcha.in/validator/' + beaconProposerIndex + '" target="_blank">' +
beaconProposerIndex + '</a>';
const beaconParentRoot = Module._ETHBeaconBlockHeaderGetParentRoot(beacon);
document.getElementById(prefix + 'BeaconParentRoot').innerText = toHexString(beaconParentRoot, 32);
const beaconStateRoot = Module._ETHBeaconBlockHeaderGetStateRoot(beacon);
document.getElementById(prefix + 'BeaconStateRoot').innerText = toHexString(beaconStateRoot, 32);
const beaconBodyRoot = Module._ETHBeaconBlockHeaderGetBodyRoot(beacon);
document.getElementById(prefix + 'BeaconBodyRoot').innerText = toHexString(beaconBodyRoot, 32);

const executionHash = Module._ETHLightClientHeaderCopyExecutionHash(header, cfg);
const executionHashString = toHexString(executionHash, 32);
document.getElementById(prefix + 'ExecutionHash').innerText = executionHashString;
Module._ETHRootDestroy(executionHash);
const execution = Module._ETHLightClientHeaderGetExecution(header);
const executionParentHash = Module._ETHExecutionPayloadHeaderGetParentHash(execution);
document.getElementById(prefix + 'ExecutionParentHash').innerText = toHexString(executionParentHash, 32);
const executionFeeRecipient = Module._ETHExecutionPayloadHeaderGetFeeRecipient(execution);
document.getElementById(prefix + 'ExecutionFeeRecipient').innerHTML =
'<a href="https://etherscan.io/address/' + toHexString(executionFeeRecipient, 20) + '#mine" target="_blank">' +
toHexString(executionFeeRecipient, 20) + '</a>';
const executionStateRoot = Module._ETHExecutionPayloadHeaderGetStateRoot(execution);
document.getElementById(prefix + 'ExecutionStateRoot').innerText = toHexString(executionStateRoot, 32);
const executionReceiptsRoot = Module._ETHExecutionPayloadHeaderGetReceiptsRoot(execution);
document.getElementById(prefix + 'ExecutionReceiptsRoot').innerText = toHexString(executionReceiptsRoot, 32);
const executionLogsBloom = Module._ETHExecutionPayloadHeaderGetLogsBloom(execution);
document.getElementById(prefix + 'ExecutionLogsBloom').innerText = toHexString(executionLogsBloom, 256);
const executionPrevRandao = Module._ETHExecutionPayloadHeaderGetPrevRandao(execution);
document.getElementById(prefix + 'ExecutionPrevRandao').innerText = toHexString(executionPrevRandao, 32);
const executionBlockNumber = Module._ETHExecutionPayloadHeaderGetBlockNumber(execution);
document.getElementById(prefix + 'ExecutionBlockNumber').innerHTML =
'<a href="https://etherscan.io/block/' + executionHashString + '" target="_blank">' +
Expand All @@ -485,30 +455,21 @@
document.getElementById(prefix + 'ExecutionTimestamp').innerText = toDateString(executionTimestamp);
const executionExtraDataBytes = Module._ETHExecutionPayloadHeaderGetExtraDataBytes(execution);
const numExecutionExtraDataBytes = Module._ETHExecutionPayloadHeaderGetNumExtraDataBytes(execution);
document.getElementById(prefix + 'ExecutionExtraData').innerText = toHexString(executionExtraDataBytes, numExecutionExtraDataBytes);
const executionBaseFeePerGas = Module._ETHExecutionPayloadHeaderGetBaseFeePerGas(execution);
document.getElementById(prefix + 'ExecutionBaseFeePerGas').innerText = toGweiString(executionBaseFeePerGas, 32) + ' Gwei';
const executionBlobGasUsed = Module._ETHExecutionPayloadHeaderGetBlobGasUsed(execution);
document.getElementById(prefix + 'ExecutionBlobGasUsed').innerText = executionBlobGasUsed;
const executionExcessBlobGas = Module._ETHExecutionPayloadHeaderGetExcessBlobGas(execution);
document.getElementById(prefix + 'ExecutionExcessBlobGas').innerText = executionExcessBlobGas;

function fillExecutionInfo() {
if (executionHash == zeroHash) {
document.getElementById(prefix + 'ExecutionTransactionsRoot').innerText = zeroHash;
document.getElementById(prefix + 'ExecutionWithdrawalsRoot').innerText = zeroHash;
document.getElementById(prefix + 'TransactionList').innerHTML = '';
} else {
document.getElementById(prefix + 'ExecutionTransactionsRoot').innerText = '';
document.getElementById(prefix + 'ExecutionWithdrawalsRoot').innerText = '';
document.getElementById(prefix + 'TransactionList').innerHTML = '';

const executionBlockFut = fetchExecutionBlock(header);
executionBlockFut.then((executionBlock) => {
if (document.getElementById(prefix + 'BeaconRoot').dataset.beaconRoot !== beaconRoot) return;
if (!executionBlock) {
document.getElementById(prefix + 'ExecutionTransactionsRoot').innerText = 'Error';
document.getElementById(prefix + 'ExecutionWithdrawalsRoot').innerText = 'Error';
document.getElementById(prefix + 'TransactionList').innerHTML =
'<div class="headerMaster">' +
' <div class="headerMasterBeaconRoot">Failed to validate transactions</div>' +
Expand All @@ -528,9 +489,7 @@

const [executionBlockHeader, transactions] = executionBlock;
const executionTransactionsRoot = Module._ETHExecutionBlockHeaderGetTransactionsRoot(executionBlockHeader);
document.getElementById(prefix + 'ExecutionTransactionsRoot').innerText = toHexString(executionTransactionsRoot, 32);
const executionWithdrawalsRoot = Module._ETHExecutionBlockHeaderGetWithdrawalsRoot(executionBlockHeader);
document.getElementById(prefix + 'ExecutionWithdrawalsRoot').innerText = toHexString(executionWithdrawalsRoot, 32);

const numTransactions = Module._ETHTransactionsGetCount(transactions);
document.getElementById(prefix + 'TransactionList').innerHTML = '';
Expand All @@ -551,7 +510,7 @@
const transactionIsCreatingContract = Module._ETHTransactionIsCreatingContract(transaction);
const transactionTo = Module._ETHTransactionGetTo(transaction);
const transactionValue = Module._ETHTransactionGetValue(transaction);
const transactionInputBytes = Module._ETHTransactionGetBytes(transaction, numTransactionInputBytesPtr);
const transactionInputBytes = Module._ETHTransactionGetInputBytes(transaction, numTransactionInputBytesPtr);
const numTransactionInputBytes = Module.HEAPU32[numTransactionInputBytesPtr >>> 2];
const transactionBytes = Module._ETHTransactionGetBytes(transaction, numTransactionBytesPtr);
const transactionBytesString = toHexString(transactionBytes, Module.HEAPU32[numTransactionBytesPtr >>> 2]);
Expand Down
Binary file modified libnimbus_lc.wasm
Binary file not shown.

0 comments on commit c8072ff

Please sign in to comment.