-
Notifications
You must be signed in to change notification settings - Fork 8
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
Revisit Block Structure #101
Conversation
Note that the unsuccessful test runs (in both cases) boil down to a single failing test: the flaky one from #100. |
Specifically: replace public scripts (hashes) and inputs with public announcements. Closes #40.
So: populate proof with empty vec.
- Add debug print statements in test. - In some mutator set method, turn `unwrap` into `unwrap_or_else` with `panic!` in order to display debug info.
Problem was using `block_digest` instead of `tip_digest` to lookup the tip header. Co-authored-by: Thorkil Værge <[email protected]>
18b526f
to
f4bce56
Compare
The block header does not need to commit to the block body. It is a potential source of discrepancy and at best surplus weight. Note that the block header does not commit to the body. However, the proof-of-work puzzle is defined in terms of the *block's hash*, which is `H(H(header)||H(body))`, so the *pair* is committed to when the miner expends energy.
The mutator set is already present in the block. Keeping its hash in the header constitutes duplicate representation of data and is a source of potential discrepancy. Moreover, it was not used anywhere, as far as I can tell.
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.
Excellent breakdown of the validity logic. I look forward to working with these traits SecretWitness
and ValidationLogic
. Also great that the block hash is not stored or transferred but always calculated.
I think we can avoid the manual implementation of discriminant
. If the variants do not carry data, you can just cast the values to usize
. I would keep the HasDiscriminant
trait though as it's nice to have a uniform way of getting the discriminants for these field selectors.
For enums without associated data (as used here), casting to usize gives the discriminant. This commit switches to that as it is less prone to error, but keeps the `.discriminant()` interface.
This PR:
Block
data structureNote that (some of) these changes are not backwards-compatible, meaning that this essentially corresponds to a new alphanet release.