]> git.ardis.lu - block-hash-calculator/commitdiff
Add tests for Sonic Mainnet
authorArdis Lu <ardisglu@gmail.com>
Sat, 11 Jan 2025 02:59:41 +0000 (18:59 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sat, 11 Jan 2025 02:59:41 +0000 (18:59 -0800)
calculate.test.js
index.html

index 470a8d1064d3ea6a90a717580505eef43efdcee5..7b5ec49af68025d13d83be180ff9aa248cbf5bc3 100644 (file)
@@ -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
index 47cee1ed783b17baba9fa1ae353a07d3c76a72b2..5eaa76c67bb990ddb9afaeffb7ec4336e11022c8 100644 (file)
@@ -25,7 +25,7 @@
   <main>
     <h1>Block Hash Calculator</h1>
     <a href="https://github.com/ardislu/block-hash-calculator/">GitHub</a>
-    <p>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.</p>
+    <p>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.</p>
     <form>
       <label for="num">Block number</label>
       <input id="num" name="num" type="number" min="0" placeholder="12345678" required>
This page took 0.041647 seconds and 4 git commands to generate.