From: Ardis Lu Date: Thu, 8 Aug 2024 06:22:43 +0000 (-0700) Subject: Add tests for opBNB and Polygon zkEVM X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=b8587e17efc207fa5a26fc81fe330024c719bc2d;p=block-hash-calculator Add tests for opBNB and Polygon zkEVM --- diff --git a/calculate.test.js b/calculate.test.js index b15f22f..f1ca8a1 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -637,4 +637,111 @@ suite('Mantle', { concurrency: true }, () => { }); deepStrictEqual(hash, '0xdbb55afccea16c87d5c53e7139744eff0f290aa463b163c0118fffc389d33b1f'); }); +}); + +suite('opBNB', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x5f5e100", + "difficulty": "0x0", + "extraData": "0x424544524f434b", + "gasLimit": "0x5f5e100", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x209", + "stateRoot": "0x5cc58a1a68cd28d08567d090b124cb59e14667d1f71534995bca4802b827bf2c", + "timestamp": "0x64d61cfb", + "totalDifficulty": "0x0", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [] + }); + deepStrictEqual(hash, '0x4dd61178c8b0f01670c231597e7bcb368e84545acd46d940a896d6a791dd6df4'); + }); + + test('Block number 31343630', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x8", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x", + "gasLimit": "0x5f5e100", + "gasUsed": "0x1ae592", + "logsBloom": "0x04108020000000504010004201000230010007c000000300010000004000042040100014000000008200000400000080000000004011040001400042802ce00040000000100000208020040a311000000024c500001500400000001091025000040204050220000800080000010008001000a0200041380000f080100000004800000000000a280880000008000410010a000000000000000002084041020000201000488002000002080900401804022407000000100060100440008000000001004002004001028000008400000000000000002008200100002000000060000000000201010000000804021488002020060810008c20000000480240081000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x1de440e", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0xe0d04d083181fe6d3dac83a57e80215b90e18ca8db15b912a88e8ca5642f6981", + "receiptsRoot": "0x7a3287ed55337026028633db43786c172b1ac67f484a1dcfc8808ac66d792e6d", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x2415", + "stateRoot": "0x9b180382a73bbd7ee3b45bdc3868db413c1b3d68ff7cd88ba7c23ed9dd33d100", + "timestamp": "0x66b46109", + "totalDifficulty": "0x0", + "transactionsRoot": "0x6e8084d3c22542f12bec0c4dc7b7a26d31c1901b7c0a01dc9084a79bc03cd429", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x0ad0c2d2e5cb1907c077b4d6c36a79b167529946a29c4920db4c1c66ac098b06'); + }); +}); + +suite('Polygon zkEVM', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x0000000000000000000000000000000000000000", + "stateRoot": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "totalDifficulty": "0x0", + "size": "0x1f9", + "number": "0x0", + "gasLimit": "0x0", + "gasUsed": "0x0", + "timestamp": "0x641d792b", + "extraData": "0x", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "uncles": [] + }); + deepStrictEqual(hash, '0x81005434635456a16f74ff7023fbe0bf423abbc8a8deb093ffff455c0ad3b741'); + }); + + test('Block number 14927800', { concurrency: true }, () => { + const { hash } = calculate({ + "parentHash": "0xe5cdcf2c5ff28c77d3dddef3387c6005119e45c478f82e39a1e2f0c019371827", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x148ee7daf16574cd020afa34cc658f8f3fbd2800", + "stateRoot": "0xe9dcbe96808734636c55fd16fcbf1276d35efff1bfea3e0cda9aa8535da424fd", + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "difficulty": "0x0", + "totalDifficulty": "0x0", + "size": "0x203", + "number": "0xe3c7b8", + "gasLimit": "0x4000000000000", + "gasUsed": "0x0", + "timestamp": "0x66b463a6", + "extraData": "0x", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "uncles": [] + }); + deepStrictEqual(hash, '0xdff4c21929f8134749c9f928db4fde6f3053cc1f315e23bb6921b654ad6ab43d'); + }); }); \ No newline at end of file