-
Notifications
You must be signed in to change notification settings - Fork 27
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
Manually pack initialValidators for subnetConversion ID hash-preimage #564
Conversation
pure | ||
returns (bytes memory) | ||
{ | ||
bytes memory res = new bytes(92 + subnetConversionData.initialValidators.length * 88); |
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.
From the comment above, it wasn't immediately clear to me why the constant was 92 here rather than 72. Mind adding a comment explaining the address is known to be 20 bytes long?
} | ||
// Pack the address | ||
bytes20 addrBytes = bytes20(subnetConversionData.validatorManagerAddress); | ||
for (uint256 i = 0; i < 20; i++) { |
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.
Nit: Lets use pre-increment like each of the other loops here.
} | ||
|
||
return res; | ||
return abi.encodePacked(CODEC_ID, SUBNET_CONVERSION_MESSAGE_TYPE_ID, subnetConversionID); |
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.
While we're here, would you mind removing the TODO from line 46 above?
Why this should be merged
Addresses #559 partially
How this works
How this was tested
Existing CI
How is this documented