-
Notifications
You must be signed in to change notification settings - Fork 146
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: access list support for signature calculation #17041
base: main
Are you sure you want to change the base?
feat: access list support for signature calculation #17041
Conversation
…ure in EthTxSigs by passing it as array of object and encoding it as list in RLPEncoder
@@ -45,6 +46,7 @@ public record EthTxData( | |||
BigInteger value, // weibar, always positive - note that high-bit might be ON in RLP encoding: still positive | |||
byte[] callData, | |||
byte[] accessList, | |||
RLPList accessListAsRLP, |
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.
This is awkward. This is a fairly widely used class from a module that is intended to hide certain implementation details. One of those details would be the use of the headlong library - from which the RLPList
type comes. And sure enough, the headlong library isn't exported from the module's module-info.java
.
Problem is - what to replace it with?
No good suggestions, but what I have is: Since the only other use is in EthTxSigs
in this very same module (and I wouldn't anticipate this field being used anywhere else in the near future): You could hold it in the record as an Object
- and then EthTxSigs
would have to know the intimate details of EthTxData
- but it is in the same package ... (And also being an Object
would signal to users outside the package that they should stay away from it.)
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.
Ok, I have a question, do you wish to get rid off using of headlong library in the EthTxData
class or do not use RLPList as a field in this class? Because if you only wish to not use RLPList
as an record than maybe the best solution would be holding this record field accessListAsRLP
as an array of Object? Instead of using the new method in EthTxSigs
static Object[] encodeRLPList(RLPList rlpList) {
return rlpList.elements().stream().map(rlpItem -> {
if (rlpItem.isList()) {
return encodeRLPList(rlpItem.asRLPList());
}
else {
return rlpItem.data();
}
}).toArray();
}
I could always move it to EthTxData and do the transformation here and save the result as the new record as an array of Object and then only use the result in calculating the signature. Would that be ok?
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.
RIght, not get rid of the use of headlong, just don't expose any headlong type (RLPList
in this case) as a record field which means other modules will see it.
Holding it as an Object[]
is just fine - just do whatever you need to do in EthTxSigs
. Sound OK?
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.
Sounds great! Ok, so I will make this change and push it soon
Description:
When sending transaction with access list the public key and the address of the transaction sender is not properly calculated and it results in error for example of INVALID_ACCOUNT_ID. We added changes in EthTxData.java and EthTxSigs.java to fix this behaviour by firstly read
accessList
as object of RLPList instance and put it different variableaccessListAsRLP
. If this variable is present we transform it to array of Object containing byte array and then we add this to RLPEncoder.We also put unit tests to check if now transactions on which we found this error are now calculating proper signature.
Related issue(s):
#17040
Notes for reviewer:
Checklist