Coder Social home page Coder Social logo

Comments (6)

wanseob avatar wanseob commented on May 26, 2024

function registerVk(
uint8 numOfInputs,
uint8 numOfOutputs,
uint[2] memory alfa1,
uint[2][2] memory beta2,
uint[2][2] memory gamma2,
uint[2][2] memory delta2,
uint[2][] memory ic
) public onlySetupWizard {
bytes32 txSig = Types.getSNARKsSignature(numOfInputs, numOfOutputs);
SNARKsVerifier.VerifyingKey storage vk = Layer2.vks[txSig];
vk.alfa1 = G1Point(alfa1[0], alfa1[1]);
vk.beta2 = G2Point(beta2[0], beta2[1]);
vk.gamma2 = G2Point(gamma2[0], gamma2[1]);
vk.delta2 = G2Point(delta2[0], delta2[1]);
for (uint i = 0; i < ic.length; i++) {
vk.ic.push(G1Point(ic[i][0], ic[i][1]));
}
}

@weijiekoh Line 44, it seems it's already using VerifyingKey struct. Would you please check this?

from zkopru.

weijiekoh avatar weijiekoh commented on May 26, 2024

Ah, I meant to suggest:

 function registerVk( 
     uint8 numOfInputs, 
     uint8 numOfOutputs, 
     SnarksVerifier.VerifyingKey memory vk
 ) public onlySetupWizard {

from zkopru.

wanseob avatar wanseob commented on May 26, 2024

Thank you Weijie, However, only internal function supports "struct" as its parameter. Is this changed?

from zkopru.

weijiekoh avatar weijiekoh commented on May 26, 2024

Hmm, I managed to write public functions where a parameter is a struct in Solidity 0.5.0. e.g.: https://github.com/appliedzkp/maci/blob/master/contracts/sol/MACI.sol#L256

    function signUp(
        PubKey memory _userPubKey,
        bytes memory _signUpGatekeeperData,
        bytes memory _initialVoiceCreditProxyData
    ) 

from zkopru.

wanseob avatar wanseob commented on May 26, 2024

@weijiekoh
Oh I got it. I just thought that we should avoid using experimental pragma but didn't know that the solidity 0.6,x document is saying ABIEncoderV2 is now considered as a non-experimental.

The new ABI encoder is able to encode and decode arbitrarily nested arrays and structs. It might produce less optimal code and has not received as much testing as the old encoder, but is considered non-experimental as of Solidity 0.6.0. You still have to explicitly activate it using pragma experimental ABIEncoderV2; - we kept the same pragma, even though it is not considered experimental anymore.

Will update it ;)

from zkopru.

wanseob avatar wanseob commented on May 26, 2024

0b75d45 closes this issue

from zkopru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.