|
15 | 15 | eth/common/eth_types_rlp, |
16 | 16 | stint, stew/[byteutils], |
17 | 17 | json_serialization, chronicles, |
18 | | - json_serialization/stew/results, |
| 18 | + json_serialization/pkg/results, |
| 19 | + json_serialization/std/tables, |
19 | 20 | json_serialization/lexer, |
20 | 21 | ./[genesis_alloc, hardforks] |
21 | 22 |
|
@@ -674,3 +675,29 @@ func `==`*(a, b: ChainConfig): bool = |
674 | 675 | if a.isNil and not b.isNil: return false |
675 | 676 | if not a.isNil and b.isNil: return false |
676 | 677 | a[] == b[] |
| 678 | + |
| 679 | +template toLog(it: Genesis): auto = |
| 680 | + # Avoid logging entire genesis allocation table |
| 681 | + ( |
| 682 | + nonce: it.nonce, |
| 683 | + timestamp: it.timestamp, |
| 684 | + extraData: it.extraData, |
| 685 | + gasLimit: it.gasLimit, |
| 686 | + difficulty: it.difficulty, |
| 687 | + mixHash: it.mixHash, |
| 688 | + coinbase: it.coinbase, |
| 689 | + alloc: it.alloc.len, |
| 690 | + number: it.number, |
| 691 | + gasUser: it.gasUser, |
| 692 | + parentHash: it.parentHash, |
| 693 | + baseFeePerGas: it.baseFeePerGas, |
| 694 | + blobGasUsed: it.blobGasUsed, |
| 695 | + excessBlobGas: it.excessBlobGas, |
| 696 | + parentBeaconBlockRoot: it.parentBeaconBlockRoot, |
| 697 | + ) |
| 698 | + |
| 699 | +# TODO formatIt doesn't work for nested Json objects |
| 700 | +chronicles.formatIt(Genesis): |
| 701 | + toLog(it) |
| 702 | +proc writeValue*(w: var JsonWriter, value: Genesis) {.raises: [IOError].} = |
| 703 | + w.writeValue(toLog(value)) |
0 commit comments