-
Notifications
You must be signed in to change notification settings - Fork 10
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
Recurssive light client commit inputs #227
base: main
Are you sure you want to change the base?
Conversation
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.
Also, you should build the circuit modify get_light_client_recursive_input.ts
if needed and generate the proofs using light_client_recursive_updates.ts
.
Change the proofs in vendor/eth2-light-client-updates/mainnet/recursive-proofs
to the newly generated proofs for the new recursive light client. And check that the verify_updates.ts
script works.
beacon-light-client/circom/circuits/light_client_recursive.circom
Outdated
Show resolved
Hide resolved
|
||
for (var i = 0; i < 2; i++) { | ||
commitment.in[cummulative_index + i] <== nextHeaderHashNum[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.
add an empty line after the bracket
|
||
for (var i = 0; i < 2; i++) { | ||
commitment.in[cummulative_index + i] <== originator[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.
add an empty line after the bracket
commitment.in[cummulative_index + i*2*k + j*k + q] <== IC[i][j][q]; | ||
} | ||
} | ||
} |
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.
add an empty line after the bracket
commitment.in[cummulative_index + i*2*k + j*k + q] <== gamma2[i][j][q]; | ||
} | ||
} | ||
} |
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.
add an empty line after the bracket
commitment.in[cummulative_index + i*2*k + j*k + q] <== negalfa1xbeta2[i][j][q]; | ||
} | ||
} | ||
} |
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.
add an empty line after the bracket
signal input gamma2[2][2][k]; | ||
signal input delta2[2][2][k]; | ||
signal input IC[pubInpCount+1][2][k]; | ||
signal input historicSyncCommiteeHashTreeRoot; |
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.
Maybe this should be named historicParticipationRateHashTreeRoot
template VerifierPoseidon(pubInpCount, k) { | ||
signal input originator[2]; | ||
signal input nextHeaderHashNum[2]; | ||
|
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.
the domain should also be part of the commitment
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.
You should extend the recursive verification code starting at line 214. Specifically the public inputs part starting line 246.
The public input should now be the prevVerifierCommitment, which you should not get as input to the circuit but calculate it using the originator
, prevHeaderHashNum
as nextHeaderHashNum
as this is the commitment to the previous proof. And using the historicParticipationRateHashTreeRoot which should be calculated somehow using the historicParticipation
(omitting the new one and somehow remembering the past one)
c87753e
to
87628cc
Compare
3cdfce6
to
6176fd8
Compare
6176fd8
to
31cbf71
Compare
@Dimo99 Please review the circuits, before I update the tests |
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.
Fix the syncCommitteeHistoricParticipationIndex
usage maybe it should be used in the calculation of prevVerifierCommitment
somehow
|
||
include "../../../node_modules/circomlib/circuits/comparators.circom"; | ||
|
||
template updateSyncCommitteeHistoricParticipation(N, Periods) { |
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.
Make the template start with upercase
|
||
include "../../../node_modules/circomlib/circuits/comparators.circom"; | ||
|
||
template updateSyncCommitteeHistoricParticipation(N, Periods) { |
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.
Also Periods
is better to be renamed to PERIODS
as it is constant.
@@ -25,6 +26,9 @@ template LightClientRecursive(N, K) { | |||
|
|||
// private inputs | |||
signal input prevHeaderHashNum[2]; | |||
signal input syncCommitteeHistoricParticipation[1024]; |
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 actually a public input
groth16Verifier.pubInput[2] <== prevHeaderHashNum[0]; | ||
groth16Verifier.pubInput[3] <== prevHeaderHashNum[1]; | ||
signal prevVerifierCommitment <== VerifierPoseidon(pubInpCount, k)( | ||
originator, prevHeaderHashNum, negalfa1xbeta2, gamma2, delta2, IC, historicParticipationRateHashTreeRoot |
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.
historicParticipationRateHashTreeRoot
is not defined
@@ -25,6 +26,9 @@ template LightClientRecursive(N, K) { | |||
|
|||
// private inputs | |||
signal input prevHeaderHashNum[2]; | |||
signal input syncCommitteeHistoricParticipation[1024]; | |||
signal input syncCommitteeHistoricParticipationIndex; | |||
signal input prevVerifierCommitment; |
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 calculated bellow and shouldn't be input
@Dimo99 prevVerifierCommitment is now computed using the prevHeaderHashNum, prevSyncCommitteeHistoricParticipationIndex and prevSyncCommitteeHistoricParticipation |
@Dimo99, please review changes of the logic when adding the final poseidon commitment