]> git.ardis.lu - block-hash-calculator/commitdiff
Add support for Tempo T4
authorArdis Lu <ardisglu@gmail.com>
Fri, 29 May 2026 04:32:23 +0000 (21:32 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 29 May 2026 04:32:23 +0000 (21:32 -0700)
calculate.js
calculate.test.js

index dca0e42ad9e7f1781ec0b73305d2b0eeebcbc7bf..daf1ae24aaaf02122f70a0e3fa689188de85647e 100644 (file)
@@ -96,6 +96,13 @@ function calculate(block) {
     ];
   }
 
+  // Tempo T4
+  // https://github.com/tempoxyz/tempo/blob/main/tips/tip-1031.md
+  if (block?.consensusContext) {
+    const { epoch, view, parentView, proposer } = block.consensusContext;
+    header.push([epoch, view, parentView, proposer]);
+  }
+
   const rlp = RLP.encode(header);
   const hash = keccak256(rlp);
 
index e6611acfe8fd93043830d00299deb9610f0286ec..2d6b2130081ea030c3551e67e95d1d0f6bb7c2a2 100644 (file)
@@ -1582,4 +1582,45 @@ suite('Tempo', { concurrency: true }, () => {
     });
     deepStrictEqual(hash, '0x6599e1fe537ebf615f53225bc33069c3023184a5d4bc223855308d974e3927f8');
   });
+
+  test('Block number 22474189 (T4)', { concurrency: true }, () => {
+    const { hash } = calculate({
+      "mainBlockGeneralGasLimit": "0x1c9c380",
+      "sharedGasLimit": "0x0",
+      "timestampMillisPart": "0x241",
+      "parentHash": "0x33c637371efa8fb4245a2524824be7c7c0ffd8fac5571abce52e258742ba8ac6",
+      "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
+      "miner": "0xeb2359cfe9f3f8afd7dcc140c2500ab348406dcc",
+      "stateRoot": "0x00781f66933bec6248e3cc07bbeb4819104ce26d6956043d07a1fe9d93add3ab",
+      "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+      "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+      "difficulty": "0x0",
+      "number": "0x156edcd",
+      "gasLimit": "0x1dcd6500",
+      "gasUsed": "0x0",
+      "timestamp": "0x6a1914f2",
+      "extraData": "0x",
+      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "nonce": "0x0000000000000000",
+      "baseFeePerGas": "0x4a817c800",
+      "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+      "blobGasUsed": "0x0",
+      "excessBlobGas": "0x0",
+      "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+      "consensusContext": {
+        "epoch": 1040,
+        "view": 10190,
+        "parentView": 10189,
+        "proposer": "0x82bb74d4a1461bbc72bfdb6988f47fac5e21c36d33c6d84a72e3edf8995d4316"
+      },
+      "size": "0x2a4",
+      "timestampMillis": "0x19e71f9d391",
+      "uncles": [],
+      "transactions": [],
+      "withdrawals": []
+    });
+    deepStrictEqual(hash, '0xc8fffc6d30293207eed42bcc2816dac0219bcbe87deeb95b92ad7801551cd8d7');
+  });
 });
This page took 0.041575 seconds and 4 git commands to generate.