From 046a17815489e69b8497e823ae781e60cecdf368 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 10 Jan 2025 18:59:41 -0800 Subject: [PATCH] Add tests for Sonic Mainnet --- calculate.test.js | 66 +++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/calculate.test.js b/calculate.test.js index 470a8d1..7b5ec49 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -984,4 +984,70 @@ suite('Ink Mainnet', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x3eaa9c073038e289accec48bddf2657e1768887e9ce461632d73de82f7c855cb'); }); +}); + +suite('Sonic Mainnet', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x0000000000000000000000000000000000000000", + "stateRoot": "0xa1953bba1bec04a28376140593c2ede9df88d71b13d0f1dbc0fc542b143a9dd9", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "number": "0x0", + "gasLimit": "0x3b9aca00", + "gasUsed": "0x0", + "timestamp": "0x674ba700", + "timestampNano": "0x180ce48127c60000", + "extraData": "0x000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x0000000000000000", + "baseFeePerGas": "0x2540be400", + "epoch": "0x1", + "totalDifficulty": "0x0", + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "blobGasUsed": "0x0", + "excessBlobGas": "0x0", + "transactions": [], + "size": "0x20f", + "uncles": [] + }); + deepStrictEqual(hash, '0x411c75a1b1c2f2f458bcf243e7743d114e0117a4233cc13d91e7efc8fe8b0f3b'); + }); + + test('Block number 3338908', { concurrency: true }, () => { + const { hash } = calculate({ + "parentHash": "0x85a3cd67e6a181eb2213bd858a86e213a204719e68fd2625097ac78bc5e4cf6d", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x0000000000000000000000000000000000000000", + "stateRoot": "0x635928e11a8fad930973e5cd717c7f0b7c1091deb33b4b0ba4cd3a1e274b5fb6", + "transactionsRoot": "0xe66fa960ea6e0fd858a512586180c7e21b5c1ed56d6453172f5d0a7487ed13fa", + "receiptsRoot": "0xac2bea1ed060dfdeeefa261e2db8a06a259535c111884ba539d419f84fde43e7", + "logsBloom": "0x000000000800000000000000000000000000000000100800c0000000000000000000000000000001001000000000400800010000000020000000000000004000004000000000000800000008000000000000000000020000000000000000000000010000000002000000000000000000800000000800120200000010000800880000004000000000000000000000000000000000000000000000000000800000000000000000000000000800000000000420000000000000000001000000000400000202000000000000000000000000000000000000005000000000000000000000000000000000000000000000000240000000000000000000200000004000", + "difficulty": "0x0", + "number": "0x32f29c", + "gasLimit": "0x3b9aca00", + "gasUsed": "0x2dd6e", + "timestamp": "0x6781dd6e", + "timestampNano": "0x181983d440f98f67", + "extraData": "0x3a14c36700000000125deaf1", + "mixHash": "0xb39d2fa5f8285541bc9c9279da3cf35dda029e66cd96f9e80be011d911cd7110", + "nonce": "0x0000000000000000", + "baseFeePerGas": "0x12a05f200", + "epoch": "0x17aa", + "totalDifficulty": "0x0", + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "blobGasUsed": "0x0", + "excessBlobGas": "0x0", + "transactions": [ + "0xaff75da41dc3d773d58ca382b7eaea9256bdd154494a2d56fa77268856bd176b" + ], + "size": "0x812", + "uncles": [] + }); + deepStrictEqual(hash, '0x025bcc859f1ee37d75a0f07ec8fe1466c54715b4d74b39fc92fc911510d4cfc9'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 47cee1e..5eaa76c 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, and Ink Mainnet.

+

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

-- 2.47.3