Skip to content

Commit

Permalink
block/client: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Jan 18, 2024
1 parent 99f412b commit 0f9cc6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/block/test/block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ describe('[Block]: block functions', () => {
assert.equal(genesisBlock.isGenesis(), true)
})

it('should test genesis hashes (mainnet default)', () => {
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Chainstart })
const rlp = hexToBytes('0x' + testDataGenesis.test.genesis_rlp_hex)
const hash = hexToBytes('0x' + testDataGenesis.test.genesis_hash)
const block = Block.fromRLPSerializedBlock(rlp, { common })
assert.ok(equalsBytes(block.hash(), hash), 'genesis hash match')
})

it('should test hash() method (mainnet default)', () => {
let common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Chainstart })
const rlp = hexToBytes('0x' + testDataGenesis.test.genesis_rlp_hex)
Expand Down
4 changes: 2 additions & 2 deletions packages/client/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
secp256k1Expand,
secp256k1Recover,
secp256k1Sign,
waitReady,
waitReady as waitReadyPolkadotSha256,
sha256 as wasmSha256,
} from '@polkadot/wasm-crypto'
import * as kzg from 'c-kzg'
Expand Down Expand Up @@ -807,7 +807,7 @@ async function run() {
const chain = args.networkId ?? args.network ?? Chain.Mainnet
const cryptoFunctions: CustomCrypto = {}
if (args.useJsCrypto === false) {
await waitReady()
await waitReadyPolkadotSha256()
cryptoFunctions.keccak256 = keccak256WASM
cryptoFunctions.ecrecover = (
msgHash: Uint8Array,
Expand Down

0 comments on commit 0f9cc6c

Please sign in to comment.