-
Notifications
You must be signed in to change notification settings - Fork 772
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
Util: Allow v
to be 0
or 1
for EIP1559 transactions
#1904
Comments
Hi there, Our current stronger tendency is to completely remove this package and directly rely on/use the ethereum-cryptography package - which bundles the underlying crypto - and then encapsulate the remaining and less relevant legacy part directly in the You are very very invited to comment on that plan and give your thoughts. Also of interest is your context of reporting: do you have an imminent problem where you need a solution? Or did you just - generally - want to improve on things? Thanks a lot! |
(have done some post-submit edits, better to read directly on the website) |
Hi, thanks for the fast response.
Overall I agree with moving towards
Of course! We're making use of this in OpenZeppelin Defender, and some changes I'm currently introducing related to EIP1559 support are breaking because we can't serialize signed EIP1559 transactions because of So, the hack of Right now, I went for this approach:
It's working, but I decided to open the PR to have the |
Thanks a lot for submitting and also for the extensive explanations here. I do have a tendency to take this in respectively merge the PR, since this already sufficiently tackles substantial parts of the legacy signature code problems. It also lead me to the following evolved opinion on how to proceed with this whole task, will also present this to the team as a suggestion: I do have the impression that we overload us with these big last minute refactoring tasks. The signature code in Util is also more complex and sensitive than the hash code, where a replacement was easier. So my suggestion is that we take this here in - already for master - and as some future-solidifying for the develop releases as well. On top we do some of the (small) refactoring tasks from the v6 list of this code part. We then keep the signature code instead of directly removing and take this one round slower. It is e.g. a possibility that we - during the v6 release lifecycle - internally move over to direct This seems more appropriate to me on such sensitive code parts, people have more time to adjust (everyone can still directly use Does this make sense? 🙂 |
Makes sense to me. We recently upgraded from The Util's signature module is less of a headache in my opinion, as there are not too many functions in there, and the critical ones are already identified and you've planned ahead for them, but I do think that removing it completely will put somebody in a difficult position to upgrade to v6.
Agree a 100% percent with this. Deprecating and slowly replacing with |
Description
Currently, there are 4 functions using the
calculateSigRecovery
method, but it only allows for values to be27
,28
orchainId * 2 + (35 | 36)
, introducing incompatibility for EIP1559 signed transactions, which is avoidable by just extracting theyParity
from thev
value (as stated in #1597).The so-called functions are:
However, the hack of extracting the
yParity
out ofv
works in most of the cases except for thetoRpcSign
function, which creates its result from thev
param, making impossible to justtoRpcSign(v - 27, r, s)
, since subtracting 27 actually changes the result.Another related problem is that the
fromRpcSig
function might receive any signature but ifv
is< 27
, it'll add 27 anyway. This is fixable once called since you can just subtract the27
if you know what you're doing, but I think the docs will need at least to state that the function doesn't have enough information to know if adding27
or not.Proposed solution
calculateSigRecovery
function to allow0
and1
valuesfromRpcSig
docs to state that is adding27
for< 27
values in any caseThe text was updated successfully, but these errors were encountered: