-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: importing ethashjs as @ethereumjs/ethash #766
Conversation
utils not exists
Created with: ```graph TD vm{VM} common --> blockchain common --> block common --> vm common --> tx ethash --> blockchain block --> blockchain blockchain --> vm block --> vm tx --> vm tx --> block account --> vm```
This is ready for review. The failure is due to the coverage difference, now that Ethash is in. |
looks great! should i add a commit for #766 (comment) |
Sure! @ryanio |
@@ -18,13 +18,10 @@ import { | |||
getSeed | |||
} from './util' | |||
import type { LevelUp } from 'levelup' | |||
import type { Block, BlockHeader } from '@ethereumjs/block' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -122,8 +119,8 @@ export default class Ethash { | |||
return keccak256(Buffer.concat(this.cache)) | |||
} | |||
|
|||
headerHash(header: BlockHeader) { | |||
return rlphash(header.slice(0, -2)) | |||
headerHash(rawHeader: Buffer[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanio the Buffer type seems correct here, but why was it BlockHeader
first place? The tests that cover this function actually passed before this change, so I am a bit confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a misunderstanding on my part of what the input was when I transcribed it to TS.
It didn't complain because I set BlockHeader to type any since block v3 still wasn't on npm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Thanks for all your help
I have modified the monorepify.sh script to import ethashjs to this monorepo.
Thanks to @ryanio for converting this library to this monorepo standards in no-time =)
Note: this PR should be merged with "Create merge commit", so all commits will be present on the master branch.