Skip to content
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

documentation, benchmark update, and contract interfaces #9

Merged
merged 2 commits into from
Mar 14, 2024
Merged

Conversation

kitounliu
Copy link
Collaborator

No description provided.

@kitounliu kitounliu requested a review from souradeep-das March 11, 2024 11:39
Copy link
Contributor

@souradeep-das souradeep-das left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great to me! left some minor comments

therefore, the proving/verifying keys are deterministic given a configuration.
The parameters are stored in "./kzg_params" and the generated contracts in "./contracts".
The option `-s` splits the verifier contract and verifying key contract so that the verifier contract
stays the same for different (t,n) values. The verifying key contract needs to be changed when (t,n) changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a small note here: that the current contracts implementation sets t/n to (3,5)

Instead, a lower bound $m$ with threshold < m <= number_of_members can be set to accept the NI-DKG process.
For example, m = (2/3) * number_of_members. If at least m members submit valid $(pp_i, zkp_i)$, then the NI-DKG can be considered successfully.
The members that do not submit will still be able to obtain a secret/verification key pair (in the following steps) as long as their member public keys are included.
These members can be allowed or banned from participating in the randomness generation process.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add a note here, that the current implementation of contracts still expect submission from each member? (which will be changed in the future)

```
$ RUST_LOG=info ./target/release/client rand verify-final <INPUT>
```
This command reads pseudorandom from "./data/random/pseudo.json".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add another section for #Running Tests and #Deploying Contracts ? Otherwise, I could add them too after this is merged!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add that section.

roundToRandom[currentRoundNum] = keccak256(abi.encodePacked(sigma.X, sigma.Y));
require(IPseudoRand(pseudoRand).verifyPseudoRand(bytes(roundInput[currentRoundNum]), pseudo.proof, gpkVal), "Incorrect random submitted");
bytes32 value = keccak256(abi.encodePacked(pseudo.proof.x, pseudo.proof.y));
require(pseudo.value == value, "Incorrect pseudorandom value");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we want to take this as an user input and compare? instead of assigning the value directly. (gas savings)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually useful to avoid bugs/inconsistence. I just found out that the keccak hash in rust produces different value than the one in the contract due to some data format difference.

}

currentRoundNum++;
uint256 currentTimestamp = block.timestamp;
roundInput[currentRoundNum] = currentTimestamp.toString();
}

function submitPartialEval(Pairing.G1Point memory pEval, IPseudoRand.PartialEvalProof memory proof) public {
function submitPartialEval(IPseudoRand.PartialEval memory pEval) public {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is storing the proof on the contract useful?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, if we implement lazy verification, the proof won't be verified immediately when it is sent onchain.

@kitounliu kitounliu merged commit eb014bc into main Mar 14, 2024
1 check passed
@kitounliu kitounliu deleted the doc branch July 30, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants