From: Ardis Lu Date: Tue, 21 May 2024 06:59:23 +0000 (-0700) Subject: Add Arbitrum One test cases X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=5830b3b89d4b15d419301c488208de16ff210b76;p=block-hash-calculator Add Arbitrum One test cases --- diff --git a/calculate.test.js b/calculate.test.js index 0bcbffe..16c57d2 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -147,7 +147,6 @@ suite('Polygon PoS', { concurrency: true }, () => { "extraData": "0x", "gasLimit": "0x989680", "gasUsed": "0x0", - "hash": "", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "miner": "0x0000000000000000000000000000000000000000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -380,4 +379,53 @@ suite('Avalanche C-Chain', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x7909846e3b1756942e59a49632122454c0748f9787eed03025f4a99efacffe92'); }); +}); + +suite('Arbitrum One', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "difficulty": "0x0", + "extraData": "0x", + "gasLimit": "0x112a8800", + "gasUsed": "0x0", + "l1BlockNumber": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x0", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x7ee576b35482195fc49205cec9af72ce14f003b9ae69f6ba0faef4514be8b442'); + }); + + test('Block number 213451496', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x989680", + "difficulty": "0x1", + "extraData": "0xa21eb7b366864a6eb65bc07cbb611d39c14e668c86c7b40abea49ee634098d59", + "gasLimit": "0x4000000000000", + "gasUsed": "0x96adb", + "l1BlockNumber": "0x12fe752", + "logsBloom": "0x00000080000000000000000800000000000100000400004000000000000000020000000000000000000000010000000000240021000000000000000000200100006011000400000400008008000000000005000000000000012004000000000000000008020000000080008000000800000000000000100000000010000000000000040000000000004000000000000000901000008000000000000000000018020000020000a0000000000000000000000200000000000000040000000000000040a002000000008000200000000000000000000000000000000000000020000410000000000000000000400000200030000400040000000000800001800000", + "miner": "0xa4b000000000000000000073657175656e636572", + "mixHash": "0x000000000001d15500000000012fe75200000000000000140000000000000000", + "nonce": "0x0000000000173e7b", + "number": "0xcb902e8", + "parentHash": "0x06e67f93508a32acdb9a039c2964e69d3b4dc2d55f31219e7c394482a16ecb7e", + "receiptsRoot": "0xdce9c9a7108cd7def2839fe70d2e70bdf917b8a7d4bde7c4a559343559a0c0a6", + "sendCount": "0x1d155", + "sendRoot": "0xa21eb7b366864a6eb65bc07cbb611d39c14e668c86c7b40abea49ee634098d59", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot": "0xcf3c50bda9496c16f4389f5f32f4d34ae2bf20d92c03c42a7d6456ac1cc97965", + "timestamp": "0x664c4537", + "transactionsRoot": "0x27c6f78f76b39c712bdae46a5c7b56b63a33f52431516730d60e94e26573098a" + }); + deepStrictEqual(hash, '0x99bd65dac0a210326cfd76cebccddbbefd28f9ee71215aff018448ffb1b1ba21'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index bf59391..4d8dac3 100644 --- a/index.html +++ b/index.html @@ -109,7 +109,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, 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, and Avalanche C-Chain.