Skip to content

Commit

Permalink
Commit with console.logs #78
Browse files Browse the repository at this point in the history
  • Loading branch information
ETatuzova committed Apr 29, 2024
1 parent 94ec9af commit 7ef3d12
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,16 @@ unchecked {
{
uint256 offset;
for(uint8 i = 0; i < batches_num;){
console.log("Commitment");
console.logBytes32(bytes32(commitments[i]));
i++;
}
uint256 challenge2 = transcript.get_field_challenge(tr_state, modulus);
console.log("Commitment challenge from transcript", challenge2);
if (challenge!= challenge2) {
console.log(challenge);
console.log(challenge2);
console.log("Challenge from proof", challenge);
console.log("Wrong challenge");
return false;
}
Expand Down
10 changes: 7 additions & 3 deletions include/nil/blueprint/transpiler/templates/modular_verifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ contract modular_verifier_$TEST_NAME$ is IModularVerifier{
bytes calldata blob,
uint256[] calldata public_input
) public returns (bool result) {
console.logBytes(blob[0:0x1000]);
console.log("Proof size = ", blob.length);
verifier_state memory state;
state.b = true;
state.xi = basic_marshalling.get_uint256_be(blob, $EVAL_PROOF_OFFSET$);
Expand All @@ -176,12 +178,12 @@ contract modular_verifier_$TEST_NAME$ is IModularVerifier{
);
//0. Direct public input check
/* if(public_input.length > 0) {
if (!public_input_direct(blob[$TABLE_Z_OFFSET$:$TABLE_Z_OFFSET$+$QUOTIENT_OFFSET$], public_input, state)) {
if(public_input.length > 0) {
if (!public_input_direct(blob[$TABLE_OFFSET$:$TABLE_END_OFFSET$], public_input, state)) {
emit WrongPublicInput();
state.b = false;
}
}*/
}
//1. Init transcript
types.transcript_data memory tr_state;
Expand All @@ -203,6 +205,7 @@ contract modular_verifier_$TEST_NAME$ is IModularVerifier{
//6. Gate argument
IGateArgument modular_gate_argument = IGateArgument(_gate_argument_address);
uint256 theta = transcript.get_field_challenge(tr_state, modulus);
console.log("Theta: ", theta);
state.F[7] = modular_gate_argument.verify(blob[table_offset:table_end_offset], theta);
state.F[7] = mulmod(
state.F[7],
Expand Down Expand Up @@ -234,6 +237,7 @@ contract modular_verifier_$TEST_NAME$ is IModularVerifier{
//7. Push quotient to transcript
for( uint8 i = 0; i < f_parts;){
uint256 alpha = transcript.get_field_challenge(tr_state, modulus);
console.log("Alpha: ", alpha);
F_consolidated = addmod(F_consolidated, mulmod(state.F[i], alpha, modulus), modulus);
unchecked{i++;}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ library modular_permutation_argument_$TEST_NAME${
uint256 l0,
bytes32 tr_state_before // It's better than transfer all random values
) internal view returns (uint256[3] memory F, bytes32 tr_state_after){
console.log("Permutation argument max quotient chunks: ", max_quotient_chunks);
types.transcript_data memory tr_state;
tr_state.current_challenge = tr_state_before;
perm_state memory state;
state.beta = transcript.get_field_challenge(tr_state, modulus);
state.gamma = transcript.get_field_challenge(tr_state, modulus);
console.log("Beta: ", state.beta);
console.log("Gamma: ", state.gamma);
state.V_P_value = basic_marshalling.get_uint256_be(blob, table_values_offset + $PERMUTATION_TABLE_OFFSET$);
state.h = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ library modular_permutation_argument_$TEST_NAME${
uint256 l0,
bytes32 tr_state_before // It's better than transfer all random values
) internal view returns (uint256[3] memory F, bytes32 tr_state_after){
console.log("Permutation argument(chunked) max quotient chunks: ", max_quotient_chunks);
types.transcript_data memory tr_state;
tr_state.current_challenge = tr_state_before;
perm_state memory state;
Expand Down

0 comments on commit 7ef3d12

Please sign in to comment.