-
Notifications
You must be signed in to change notification settings - Fork 251
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
Consensus block value calculation for produceBlockV3 API call. #5873
Conversation
929692a
to
c4fdc73
Compare
aa77553
to
b6081cd
Compare
92a735f
to
129ff94
Compare
#6022 doesn't replace the "front-end" parts of this, but does provide a new back-end calculation approach |
129ff94
to
fe5330c
Compare
# Returns value of `block-consensus-value` in Wei units. | ||
(uint64(r.attestations) + uint64(r.sync_aggregate) + | ||
uint64(r.proposer_slashings) + | ||
uint64(r.attester_slashings)).u256 * 1000000000.u256 |
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 1000000000.u256
is unnecessarily runtime-constructed, complete with the customary usually pointless nimZeroMem()
:
N_LIB_PRIVATE N_NIMCALL(void,
blockConsensusValue__validatorsZbeacon95validators_112)(
tyObject_BlockRewards__9c3PGRoMCH9aJ4gpUEVcHWJA *r,
tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg *Result) {
tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg T1_;
tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg T2_;
nimZeroMem((void *)(&T1_), sizeof(tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg));
u256__specZvalidator_12417(
(NU64)((NU64)((NU64)((NU64)((NU64)((NU64)((*r).attestations) +
(NU64)((*r).sync_aggregate))) +
(NU64)((*r).proposer_slashings))) +
(NU64)((*r).attester_slashings)),
(&T1_));
nimZeroMem((void *)(&T2_), sizeof(tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg));
u256__OOZvendorZnim45ethZethZcommonZeth95types_308(((NI)1000000000), (&T2_));
star___OOZvendorZnim45stintZstint_435((&T1_), (&T2_), Result);
}
Better to define it as a const
to avoid the
nimZeroMem((void *)(&T2_), sizeof(tyObject_StUint__ExULMdD1zVCTKy89cyuy4Dg));
u256__OOZvendorZnim45ethZethZcommonZeth95types_308(((NI)1000000000), (&T2_));
part.
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.
I wish not to change it, because its annoying, please re-read all the comments before and lets end it please. If you think its correct, lets use it as it is, because i wish not to check c-code on this specific thing, there is a lot more u256
conversions around which was not highlighted.
Also block-proposal is made once per 12 seconds on mainnet, so its CPU intensive operation.
This reverts commit 9fef9a8.
Return back to Gwei.
This reverts commit 32feb20.
ffa132c
to
ddb83e3
Compare
This reverts commit 4948b2c.
No description provided.