From 7143aef6b4b6b1a741e776f0d5d52dc5780b6646 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 16 May 2025 23:14:28 -0700 Subject: [PATCH] Add tests for World Chain --- calculate.test.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/calculate.test.js b/calculate.test.js index ef97420..bf9288e 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -1182,4 +1182,65 @@ suite('Unichain', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x164e6287ac84b922bdecbd4c193b572dd7f1adbac5301e41ec99f9c2dc6b182e'); }); +}); + +suite('World Chain', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x3b9aca00", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x424544524f434b", + "gasLimit": "0x5f5e100", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x24e", + "stateRoot": "0xf52039b756cebe8f83712e49ee012e8e2b2eb6b63fecb9c1b2dff8128ed40725", + "timestamp": "0x667afad7", + "transactions": [], + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x70d316d2e0973b62332ba2e9768dd7854298d7ffe77f0409ffdb8d859f2d3fa3'); + }); + + test('Block number 14063338', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x3b6", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x00000000fa00000002", + "gasLimit": "0x1f78a40", + "gasUsed": "0xa39da2", + "logsBloom": "0x41000802c050510082d102948c4044719e6021100767002b208481205cc89824c25a205146c8810980e006918851007014014d04c1066200816d22c01824325b240a01600100000c88c0400c82e14846f2424c093100082d272b8041804ba084100944010e0b7855640000e848801da4642d20630206a0c61180615a633a1a42100b8130a24a100802117038090208c244004a810561401aa1396822840105924a1030000c29308d00c1044003008c6802dcd041040444001d0a03018480648b0d23e04ea206295505094d0091c218400d02b400a22c71501020d410200032c0f074750203090122040aec086100010a0853198a14c02c640cbdc4081039040c", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x5502ec47d27268b1ee29a88a32139b40d123013c6f67dbf3b7c656034ec3ed60", + "nonce": "0x0000000000000000", + "number": "0xd696ea", + "parentBeaconBlockRoot": "0xe672fd37e3b8377669600011161d4ede22df6ed3585e7c6f8ed75f4b21d71920", + "parentHash": "0xea40f77122f02c45474ede3010009416b46268854091f9780b516fce00da883f", + "receiptsRoot": "0x38d155f16fb01d1d0b94d0a256b784a29878e4a1659981d8ce0936bc4ead4fb9", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0xb070", + "stateRoot": "0x49850687d51e785d1d82de126833aa2a69699cbb14dc087219e190c6bff562f3", + "timestamp": "0x682828ab", + "transactionsRoot": "0x6902c80159b31aa78c72c576fe1ffdfab846144505261d160a67494945e9eaed", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x4a40e4350106d48231b475496346a8499be140d4e911758e83711fac543ee46d'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 286a9f8..4ef22e8 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, Blast, Mantle, Avalanche C-Chain, ZKsync Era, Ink Mainnet, Sonic Mainnet, and Unichain.

+

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, Avalanche C-Chain, ZKsync Era, Ink Mainnet, Sonic Mainnet, Unichain, and World Chain.

-- 2.47.3