bodhi.js icon indicating copy to clipboard operation
bodhi.js copied to clipboard

improve orphan tx hash calculation

Open shunjizhan opened this issue 2 years ago • 1 comments

currently we use keccak256([...hexToU8a(blockHash), ...nToU8a(index)]); , however,@polkadot/api slightly changed how nToU8a works, which broke the hash after upgrading to @polkadot/api@9

I think we can just use keccak256(blockHash + index) which removes dependency for nToU8a, and the result is still deterministic & unique

a reproduce can be found here

shunjizhan avatar Nov 25 '22 04:11 shunjizhan

maybe just move out the hash calculation part to bodhi, so it will never change

shunjizhan avatar Aug 29 '23 03:08 shunjizhan