Closed micahriggan closed 5 years ago
I personally like this more than #68, thanks! I'd however wait until https://github.com/ethereumjs/ethereumjs-tx/pull/130 makes it into the next release, and then merge here with the latest ethereumjs-tx.
Okay, let me know if there's anything else I can do :)
@micahriggan Sorry that this takes so long, we'll do a tx release soon.
@micahriggan thanks for submitting this PR!
We already released a new ethereumjs-tx
version, that changes how hardforks are managed. Can you update this PR to the latest version? If you can't, please let me know and I'll do it.
@alcuadrado updated to 2.1.0
@alcuadrado Can you go on with a review here?
So I tried with this using the last hardfork, and that doesn't fix the original issue, so it will need to be based off of the height.
Edit: Should be good now
This should work :) Thanks a lot @micahriggan ! Can you re-review it @holgerd77 ?
Something I noticed is that in the current code the BlockHeader#_common
could have a null
hardfork
, but BlockHeader
's methods handle that case.
I kept working on this as part of the TS migration, and I found many edge-cases mostly due to BlockHeader#number
being mutable.
Things like, what happens if you initialize a block with transactions on petersburg, and then change the block number to one pre-eip155?
Also, can you really share the common between a block an its uncles? they may belong to a different HF.
I tried updating the Common
object whenever header.number
was changed, but lots of tests fail that wait.
TBH, I'm a little lost about what to do.
I also tried overwriting the number
descriptor to forbid modifications once a block header is constructed, but this breaks BlockHeader#setGenesisParams
.
@alcuadrado seems like this intended update (of Common
and Transaction
libraries) is pulling to the surface more insufficiencies and inconsistencies of the block library than expected and will as it looks now a bit open up different work areas.
@micahriggan I am just seeing that the commit history of this work is getting too extensive/intransparent anyhow to be directly merged and would need squashing and reorganizing.
@alcuadrado @micahriggan Would it generally be a way that we extract the util
changes from here - @micahriggan would you be willing to open a separate PR on that with a single commit? - and we then close this PR here and take on the TypeScript transition first - which gives @alcuadrado some more opportunity to dig into the library.
@alcuadrado while working on this you can eventually already open separate issues on refactoring ideas/necessities and we tackle these separately afterwards working towards a more consistent solution which doesn't feel "hacky"?
Does this make sense? I have the impression we are trying to solve too many things at once otherwise eventually.
@alcuadrado seems like this intended update (of
Common
andTransaction
libraries) is pulling to the surface more insufficiencies and inconsistencies of the block library than expected and will as it looks now a bit open up different work areas.
Yes, absolutely. Unfortunately, I believe that this is not only affecting this library, but it's a general issue shared by all the libraries. My understanding is that it comes from:
Different objects have complex relationships between them (i.e. the block number changes the hardfork, and the hardfork changes the tx validation rules), and being able to mutate them individually will always lead to edge-cases.
These libraries try to serve two very different clients: dapp and smart contract developers, and protocol-level developers (as in using them in the VM). I think that both can be served with an appropriate design, but we now have an inconsistent mixture of protocol-level/RLP internal representation and application-level logic.
We have been discussing this with @s1na for some time in other issues.
@alcuadrado @micahriggan Would it generally be a way that we extract the
util
changes from here - @micahriggan would you be willing to open a separate PR on that with a single commit?
I'm not convinced that this is worth it or even a positive thing. It will fix some edge-cases, but opening the door to/ignoring others. I think the current state of the proposal keeps the previous behavior, which in most cases work. I'm not 100% sure about this, as it's a pretty complex situation.
@alcuadrado while working on this you can eventually already open separate issues on refactoring ideas/necessities and we tackle these separately afterwards working towards a more consistent solution which doesn't feel "hacky"?
Does this make sense? I have the impression we are trying to solve too many things at once otherwise eventually.
I'll take some time to recollect what was previously discussed, and open an issue in the organization repo.
This change was incorporated in #72
Thanks for this PR @micahriggan !
closes #68 closes #67