hyperledger / fabric-samples

Samples for Hyperledger Fabric
https://wiki.hyperledger.org/display/fabric
Apache License 2.0
2.74k stars 3.34k forks source link

commit #1196

Closed vmaslarova closed 2 months ago

denyeart commented 2 months ago

I'm not sure if this PR was intended, since the commits are not signed.

But regardless, we don't want to encourage AbsoluteMaxBytes greater than 100MB since the default grpc message size limit is 100MB.

vmaslarova commented 2 months ago

I’m trying to deploy a smart contract on the network but the limit is 100 MB and is failing the deployment of the contract. I need to use snarkjs and circom to protect the location of a user that uses smart parking. What should I reduce to fit the size Can you give any advise of how to deploy the contract without the size being a problem

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Dave Enyeart @.> Sent: Wednesday, April 17, 2024 4:02:54 PM To: hyperledger/fabric-samples @.> Cc: MASLAROVA, VIKTORIA (UG) @.>; Author @.> Subject: Re: [hyperledger/fabric-samples] commit (PR #1196)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification CAUTION: External email. Ensure this message is from a trusted source and exercise caution before clicking links/opening attachments.

I'm not sure if this PR was intended, since the commits are not signed.

But regardless, we don't want to encourage AbsoluteMaxBytes greater than 100MB since the default grpc message size limit is 100MB.

— Reply to this email directly, view it on GitHubhttps://github.com/hyperledger/fabric-samples/pull/1196#issuecomment-2061481337, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV6FWH22OWEVNBZ76VKJVY3Y52FJ5AVCNFSM6AAAAABGLKJ72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRGQ4DCMZTG4. You are receiving this because you authored the thread.Message ID: @.***>

The University of Aberdeen is a charity registered in Scotland, No SC013683. Tha Oilthigh Obar Dheathain na charthannas clàraichte ann an Alba, Àir. SC013683.

denyeart commented 2 months ago

If the problem is during chaincode deploy, it is probably an issue with peer size limit, can be set here: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L503-L508

vmaslarova commented 2 months ago

I get this when I deploy my contract Error: failed to endorse chaincode install: rpc error: code = ResourceExhausted desc = trying to send message larger than max (2104529784 vs. 104857600) Chaincode installation on peer0.org1 has failed Deploying chaincode failed

Is there any way I can change the size to be bigger or I need to change the code in the chaincode and make it smaller? Do I also have to change dependecies in the package.json Do I need to split the contract into different repository because all my smart contact code is in smartparking.js What exactly makes it so big that I can’t deploy it Is there anything else I can do to deploy it successfully

From: Dave Enyeart @.> Date: Wednesday, 17 April 2024 at 19:21 To: hyperledger/fabric-samples @.> Cc: MASLAROVA, VIKTORIA (UG) @.>, Author @.> Subject: Re: [hyperledger/fabric-samples] commit (PR #1196) CAUTION: External email. Ensure this message is from a trusted source and exercise caution before clicking links/opening attachments.

If the problem is during chaincode deploy, it is probably an issue with peer size limit, can be set here: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L503-L508

— Reply to this email directly, view it on GitHubhttps://github.com/hyperledger/fabric-samples/pull/1196#issuecomment-2061935935, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV6FWH4A6EBVJG743JXBHDDY524STAVCNFSM6AAAAABGLKJ72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRHEZTKOJTGU. You are receiving this because you authored the thread.Message ID: @.***>

The University of Aberdeen is a charity registered in Scotland, No SC013683. Tha Oilthigh Obar Dheathain na charthannas clàraichte ann an Alba, Àir. SC013683.

denyeart commented 2 months ago

You are definitely hitting this grpc limit: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L503-L508

You need to set it on peer side AND client side.

That being said, 2GB for a chaincode is unreasonably large. You need to look into your chaincode package and identify why it is so large. Sorry can't help with that part since it is on your application side.

vmaslarova commented 2 months ago

Am I allowed to change the size in the core.yaml.

peer: grpcOptions: maxRecvMsgSize: 104857600 maxSendMsgSize: 104857600 and make it

peer: grpcOptions: maxRecvMsgSize: 209715200 maxSendMsgSize: 209715200

Do I have to stick to the 104857600 size I am trying to peer lifecycle chaincode install this code

'use strict';

const { Contract } = require('fabric-contract-api');

class ParkingContract extends Contract {

async verifyProximity(ctx, proofJsonString, publicJsonString, verificationKeyJsonString) {
    const proof = JSON.parse(proofJsonString);
    const public = JSON.parse(publicJsonString);
    const verificationKey = JSON.parse(verificationKeyJsonString);  // Passed as transient data

    const isVerified = await snarkjs.groth16.verify(verificationKey, publicSignals, proof);
    if (isVerified) {
        console.info('The user is within the distance.');
        return true;
    } else {
        console.error('The user is NOT within the distance.');
        return false;
    }
}

}

module.exports = ParkingContract;

Error: failed to endorse chaincode install: rpc error: code = ResourceExhausted desc = trying to send message larger than max (167637845 vs. 104857600)

I try excluding a lot of stuff but it is still too long

From: Dave Enyeart @.> Date: Wednesday, 17 April 2024 at 21:56 To: hyperledger/fabric-samples @.> Cc: MASLAROVA, VIKTORIA (UG) @.>, Author @.> Subject: Re: [hyperledger/fabric-samples] commit (PR #1196) CAUTION: External email. Ensure this message is from a trusted source and exercise caution before clicking links/opening attachments.

You are definitely hitting this grpc limit: https://github.com/hyperledger/fabric/blob/main/sampleconfig/core.yaml#L503-L508

You need to set it on peer side AND client side.

That being said, 2GB for a chaincode is unreasonably large. You need to look into your chaincode package and identify why it is so large. Sorry can't help with that part since it is on your application side.

— Reply to this email directly, view it on GitHubhttps://github.com/hyperledger/fabric-samples/pull/1196#issuecomment-2062307425, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV6FWH7SWRLUZQ3GAIG6CXDY53OYXAVCNFSM6AAAAABGLKJ72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSGMYDONBSGU. You are receiving this because you authored the thread.Message ID: @.***>

The University of Aberdeen is a charity registered in Scotland, No SC013683. Tha Oilthigh Obar Dheathain na charthannas clàraichte ann an Alba, Àir. SC013683.