From 6717e49746ecb14f7135f3ef8f8c7ca57def4c42 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Thu, 13 Jun 2024 23:07:22 -0700 Subject: [PATCH] Add test cases for Blast and Mantle --- calculate.test.js | 110 ++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/calculate.test.js b/calculate.test.js index 9d60026..b15f22f 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -527,4 +527,114 @@ suite('Scroll', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x78b3afc8c6aa55628242a8298d7e0cb5cf4a3892d20051556e6cbeaa03ed590a'); }); +}); + +suite('Blast', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x3b9aca00", + "difficulty": "0x0", + "extraData": "0x424544524f434b", + "gasLimit": "0x1c9c380", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x22b", + "stateRoot": "0xb47ebef1f65d4c8e9fb61ff915cde0e875f9384d54fb5ea75ec907600156f183", + "timestamp": "0x65da5e57", + "totalDifficulty": "0x0", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0xb689b35ef29d0bec5816938e0e52683c7257d2e325420ea69b739a2be4754b89'); + }); + + test('Block number 4766974', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x67dcd84", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x", + "gasLimit": "0x1c9c380", + "gasUsed": "0x613bf4", + "logsBloom": "0x06200499441008000e9034408200000000188000002308400ca0d2000800002491a088860800008008c221100404000045329a0c21707000600a138030208002612625002404070800c800082045102000010004024822000200221e80814d0000800009262b0410200880c010408811000a015008940401040914584889004800220100aa086010080c00dc0005205090810803002122c800214240504020040680010000804020020081c0a01a0100a00020001000080800882060082c9181020c0c2208081001011048284c00820a08000004040450988a60520b624021240210c0004400800029001190400c200240e00161480918468008c08100089000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x2469371d5b6559a91eec9ffebaf00dbb9f49f61400172b9c57f5024923244e2e", + "nonce": "0x0000000000000000", + "number": "0x48bcfe", + "parentBeaconBlockRoot": "0x8398bba6ef4d175173e892a6d91ad094ee383f060e8f7649448aff97c440963f", + "parentHash": "0xbb682e8a0b6dca973bc44db2ea72590cd871bce3e783277b941806db641de462", + "receiptsRoot": "0xe7226c4c090fccb021021eddcc3698b61b10f0ebaedda2c720e999ee119fa5f7", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x3ba4", + "stateRoot": "0x4aaa216afe16ebb21304bee9d8abe5d293a71054e71bc408c8b15b26366443c9", + "timestamp": "0x666bd853", + "totalDifficulty": "0x0", + "transactionsRoot": "0xd1e3b2da095890fc335c8bd79e0e139d0ffa1b42e0ccabd51ae5bfd88680a0be", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0xb3e21dd13672a3fee8c2d2d3ddefe698acb16ecb3338dab87931e44b7375f0d6'); + }); +}); + +suite('Mantle', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "difficulty": "0x1", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000000000b36a00872baf079426e012cf5cd2a74e8b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x1c9c380", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x26f", + "stateRoot": "0xac371455b575be8956659aeb5c984ae7fbc7834f933d5807dddd79d850eb75b4", + "timestamp": "0x0", + "totalDifficulty": "0x1", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [] + }); + deepStrictEqual(hash, '0x0a0eb32c4b024b28da5bf83356f7987c1b0612bbfbc9156186c59c834bfcd013'); + }); + + test('Block number 65106856', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x1312d00", + "difficulty": "0x0", + "extraData": "0x", + "gasLimit": "0x2e90edd000", + "gasUsed": "0x1da7d1dbb", + "logsBloom": "0x4420000000040000000000088000000000204000001100880000110400000180010000110000000080001000100200010001000000000410004802000024000084000000054009000310000802040122800000800804300400000002000000000000000100000000100400018000004100000400000122000000001000000000000000008000010000080200004000000000000400008408200820c08800000002004000080000000a000040000000002002000001002021001100100000028000000022040000808000000040000000000000000004005840000008000040000036200000081000010800801000000000000040000082002016800000100008", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x392c0b4a8c24e13ad2199c93960c6e5e8b6056ef0196cf3237706ecd80cc0473", + "nonce": "0x0000000000000000", + "number": "0x3e173a8", + "parentHash": "0x139dbf02d5b04291f84443af2dca6dedbb37a0784a5b481c9e802b0dd0d5516d", + "receiptsRoot": "0x6ad7edc75ef51ae896db5e1a5a32a1cf9ba0cf13483b575210f5fad72d20d965", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x186c", + "stateRoot": "0x2d0f60c0d4540ace109d389d6b97943b8be497ce635a3576d9f3f47b25f8d306", + "timestamp": "0x666bd958", + "totalDifficulty": "0x0", + "transactionsRoot": "0x180077d656aa60d2c1d14fd478c5c2dc3cae215ac615ec16d8099859494ffb38", + "uncles": [] + }); + deepStrictEqual(hash, '0xdbb55afccea16c87d5c53e7139744eff0f290aa463b163c0118fffc389d33b1f'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 5478459..f358760 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@

Block Hash Calculator

GitHub -

Enter a block number and a JSON-RPC provider below to recalculate the block's hash from its header fields. Known supported networks: Ethereum, Polygon PoS, BNB Chain, OP Mainnet, Base, Arbitrum One, Linea, Scroll, and Avalanche C-Chain.

+

Enter a block number and a JSON-RPC provider below to recalculate the block's hash from its header fields. Known supported networks: Ethereum, Polygon PoS, BNB Chain, OP Mainnet, Base, Arbitrum One, Linea, Scroll, Blast, Mantle, and Avalanche C-Chain.

-- 2.47.3