From c99e038f493d7c362542e3dda6f9f0ff1c4d435a Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Wed, 18 Dec 2024 22:11:17 -0800 Subject: [PATCH] Add tests for Ink Mainnet --- calculate.test.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/calculate.test.js b/calculate.test.js index 8aefa9b..470a8d1 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -924,4 +924,64 @@ suite('ZKsync Era', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x6db9bcfdef7c293cc31465cd1dfcae27c9bd01fb6e2d8f246a544ea02b5f1527'); }); +}); + +suite('Ink Mainnet', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x3b9aca00", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x", + "gasLimit": "0x1c9c380", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x247", + "stateRoot": "0xade3966d0c8786ea34248899b5f3d9e6b7209083290e67d9372e41d4ebc994da", + "timestamp": "0x6753162b", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x23a2658170ba70d014ba0d0d2709f8fbfe2fa660cd868c5f282f991eecbe38ee'); + }); + + test('Block number 1090110', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0xfc", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x", + "gasLimit": "0x1c9c380", + "gasUsed": "0x34873", + "logsBloom": "0x00200000000000000008000080000000000000000000000000040000000000000000000000000000000000108000008000000000400000000000000000201000000000040000400000000008001000200000000000400000000000000000000000000000000000080000000000000000000000000000040000000010000000000000000000000000000000000000000000000000002000080000004000000000020000000000000000800000000000000000000000008000000000000000000000000002200000000000000000000000000000000000009000000002000000000010000020000000000000000000000000000000000000000000000000004000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x5c4c32dbf5fccc22e464e19a636847ff4c81aff336f4637c518deb3206baf46a", + "nonce": "0x0000000000000000", + "number": "0x10a23e", + "parentBeaconBlockRoot": "0xf72c7d8061a4ef2f1f8238b2e88a41eea0d56b647f0c3dffb849c8865923b062", + "parentHash": "0x3300c542dd459a48d1f24c7d2408dad31f21db2264811f751858fad04adf6585", + "receiptsRoot": "0x5477ec7d592c013159dee1f3634d38b9a5594e518cc80cbc8b2ef91a03a84907", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x4c1", + "stateRoot": "0x8454a574af2e8ba56f4d48f4910cfd11bcf419d30ff9af2a10304d99ac31f94a", + "timestamp": "0x6763b869", + "transactionsRoot": "0x8d11b3bcad4de44a0436234d48d255a2b32a8750d394b617c4db91acfa4a179c", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x3eaa9c073038e289accec48bddf2657e1768887e9ce461632d73de82f7c855cb'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index fe5e331..3e6a104 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, and ZKsync Era.

+

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, and Ink Mainnet.

-- 2.47.3