Skip to content

Conversation

@Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Oct 9, 2024

Description

  • add numResponsesRequired param to executeJs.

❗️❗️Note that setting the number of required responses to less than the threshold will cause Lit.Actions.signEcdsa to fail when running executeJs because ECDSA requires a minimum number of participants (the threshold) to collaboratively generate a valid signature. If fewer nodes participate, the signature cannot be formed, leading to a failure.

eg.

❌ Not good

  const res = await devEnv.litNodeClient.executeJs({
    sessionSigs: eoaSessionSigs,
    code: `(async () => {
      const sigShare = await LitActions.signEcdsa({ <== 👈 Signing using ECDSA 
        toSign: dataToSign,
        publicKey,
        sigName: "sig",
      });
    })();`,
    jsParams: {
      dataToSign: alice.loveLetter,
      publicKey: alice.pkp.publicKey,
    },
    numResponsesRequired: 1, <===  This will fail, eg. need at least 5 if we have connected to 9 nodes
  });

✅ This is good

  const res = await devEnv.litNodeClient.executeJs({
    sessionSigs: eoaSessionSigs,
    code: `(async () => {
        console.log("testing"); <=== 👈 Only console.logging
    })();`,
    jsParams: {
      dataToSign: alice.loveLetter,
      publicKey: alice.pkp.publicKey,
    },
    numResponsesRequired: 1, <===  Das ist gut 
  });

@Ansonhkg Ansonhkg requested a review from joshLong145 as a code owner October 9, 2024 17:23
@Ansonhkg Ansonhkg requested review from DashKash54, MaximusHaximus and joshLong145 and removed request for joshLong145 October 9, 2024 17:25
Copy link
Contributor

@MaximusHaximus MaximusHaximus left a comment

Choose a reason for hiding this comment

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

👍 rock on, this LGTM

Ansonhkg and others added 2 commits October 9, 2024 18:33
Co-authored-by: Daryl Collins <daryl@litprotocol.com>
Signed-off-by: Anson <ansonox@gmail.com>
@Ansonhkg Ansonhkg requested a review from FedericoAmura October 9, 2024 17:44
@MaximusHaximus MaximusHaximus merged commit 29fa617 into LIT-3920-batchGeneratePrivateKeys Oct 9, 2024
3 checks passed
@MaximusHaximus MaximusHaximus deleted the feature/lit-3945-js-sdk-add-sendtosinglenode-feature branch October 9, 2024 18:49
@MaximusHaximus
Copy link
Contributor

❇️ thanks @Ansonhkg -- I'll update the call from the batchGeneratePrivateKeys functions in wrapped-keys in the LIT-3920 branch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants