From f81c1c995feeed5ba21a0b94b21f9d405e5ed04d Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sun, 2 Jun 2024 21:40:40 -0700 Subject: [PATCH] Add test cases for Linea and Scroll --- calculate.test.js | 99 +++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/calculate.test.js b/calculate.test.js index 16c57d2..9d60026 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -428,4 +428,103 @@ suite('Arbitrum One', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x99bd65dac0a210326cfd76cebccddbbefd28f9ee71215aff018448ffb1b1ba21'); }); +}); + +suite('Linea', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x8", + "difficulty": "0x1", + "extraData": "0x00000000000000000000000000000000000000000000000000000000000000008f81e2e3f8b46467523463835f965ffe476e1c9e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x3a2c940", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x274", + "stateRoot": "0x716659ad8045834538750b4c0885b6759b6b096e14a0ccda4e301e49de97987f", + "timestamp": "0x6391bff3", + "totalDifficulty": "0x1", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0xb6762a65689107b2326364aefc18f94cda413209fab35c00d4af51eaa20ffbc6'); + }); + + test('Block number 5113562', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x7", + "difficulty": "0x2", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000947bdb87f5b4f08ea559561d6ff1e046c07f8ca2afc7c8dca357a91b94bacf28154774632d0a407d088c27ba8b6e5bd8ee0b74cbc4fa77de0ece325614c24a8401", + "gasLimit": "0x3a2c940", + "gasUsed": "0x2dff14", + "hash": "0x99d44a5727bc27b72bb5ca020c3ee2f5998101a727bc79bd917a752e8df97da6", + "logsBloom": "0x0c800000301100201000000800a46020400001000404439040000008020086048800043499008085220010240002800128003d420b00a003021d081004a84000040000081c4000c80041034812009000102000004041081000040020800000040011210222001000008007a1201a1800000000a10214062000a00110c4082400001000100500034000903094022002280e00004148800d082024840428000880224101880680200cb011002000100002000010008000210c00200520a00000a23810810600008001421008c00110920000001002810a00400808000e0048209000700c002800001000201284220052b40c2010247007424a2000004480804000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x4e06da", + "parentHash": "0x9d288d63a04859e50c070b98a3301721e604087c8136dbe648b863c237313127", + "receiptsRoot": "0xae21fc203fe09c0d9daa4460556539167db78b117c22d97cd3fb7fc0e0797aac", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x2b47", + "stateRoot": "0x7c82f3a63078757e1335c30f377494b06dc94bf068096ddeef1ddfbff9f69fff", + "timestamp": "0x665d47bd", + "totalDifficulty": "0x9c0db5", + "transactionsRoot": "0x6a31e036410978175ed51ee0e06e6a148d766cde417067026f728099b8e2e2ab" + }); + deepStrictEqual(hash, '0x99d44a5727bc27b72bb5ca020c3ee2f5998101a727bc79bd917a752e8df97da6'); + }); +}); + +suite('Scroll', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "difficulty": "0x1", + "extraData": "0x4c61206573746f6e7465636f206573746173206d616c6665726d6974612e0000d2acf5d16a983db0d909d9d761b8337fabd6cbd10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x989680", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x272", + "stateRoot": "0x08d535cc60f40af5dd3b31e0998d7567c2d568b224bed2ba26070aeb078d1339", + "timestamp": "0x6524e860", + "totalDifficulty": "0x1", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0xbbc05efd412b7cd47a2ed0e5ddfcf87af251e414ea4c801d78b6784513180a80'); + }); + + test('Block number 6228986', { concurrency: true }, () => { + const { hash } = calculate({ + "difficulty": "0x2", + "extraData": "0xd883050311846765746888676f312e32302e31856c696e75780000000000000019c1a1b06e943e2dd76f05cc1adeeaf4e47b5ddd518110dd7d53bea42e1a2b6016c4d3eb45eb45fe8c9a46c8b908edd1ad0d2041f01018d9556abfe92985a3e500", + "gasLimit": "0x989680", + "gasUsed": "0xa9988", + "logsBloom": "0x00021000000400010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000008000000010000000000000000000000000000000000080000020000000000000000000808000004000000000000000010000000048080000000000000004000000000000000000000000000000000000000000000422000000000000000001000004000800000080040000000000000000000000000000003000000000000000400000000080000000010000000000000000020000010080000000000000040000000000000000000000000000000200000000008", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x5f0bfa", + "parentHash": "0x864919dcf2dff0433676cb5919ee81cfd118f041d7e1a2c557c3c9e3e9df28d2", + "receiptsRoot": "0x29c03f1cb2be91909c68fa90dfff7e762562a5e94a4af6b35a79d6114b21d410", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0xedd", + "stateRoot": "0x29e371e3126d81fe9848b0dc147d75ab7b4d04c43388817ec12bf89eda567b62", + "timestamp": "0x665d48c5", + "totalDifficulty": "0xbe17f5", + "transactionsRoot": "0xc18609378f2ccc7dfa09802117d69a297de7ecc4958d9be16233c007724ccb70" + }); + deepStrictEqual(hash, '0x78b3afc8c6aa55628242a8298d7e0cb5cf4a3892d20051556e6cbeaa03ed590a'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 6cf7cd2..5478459 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, 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, and Avalanche C-Chain.

-- 2.47.3