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

getlit tool is possibly out of date #18

Open
spacesailor24 opened this issue Apr 22, 2024 · 16 comments
Open

getlit tool is possibly out of date #18

spacesailor24 opened this issue Apr 22, 2024 · 16 comments

Comments

@spacesailor24
Copy link

spacesailor24 commented Apr 22, 2024

Description of the issue

Updating the description for clarification of the current issue:

Running the following to reproduce yields the There was an error getting the signing shares from the nodes error:

  1. npx getlit action
  2. npx getlit setup
    1. Connect wallet and mint PKP if you don't already have one, if you do select it
  3. Fix the schema validation error in foo.action.ts
  4. npx getlit watch main
  5. npx getlit watch main
    1. 1st run will prompt an install of @lit-protocol/lit-node-client-nodejs
  6. npx getlit watch main
    1. After quitting the successful run from step 5, running the command again will result in the error
[Lit-JS-SDK v5.0.0] [2024-04-29T13:53:27.152Z] [ERROR] [core] [id: 594396b6c7785] most common error: {"success":false,"error":"Uncaught (in promise) Error: Failed to sign ecdsa: lit_node::Error { kind: Unexpected, code: NodeContractResolverConversionFailed, msg: \"Error getting owner of PKP\", source: Revert(Bytes(0x)), caller:  { file: \"src/pkp/auth/mod.rs:465:17\" } }"}
errConstructorFunc {
  message: 'There was an error getting the signing shares from the nodes',
  name: undefined,
  errorCode: 'unknown_error'
}

@josh Mentioned that getlit could be out of date and could be causing an issue - @wyatt to investigate


Hi there !
I would like to pass params into a lit action.
I could find the jsParams but if I'm not mistaken, those params are only available into the LitActions.signEcdsa function, is it right ?
I tried using jsParams and executeJs but I'm still having this error.
Is there a way to do this ? Particularly I need to pass conditional params to fetch an api
Thank you in advance !

image

Additional context

No response

Copy link
Author

spacesailor24 commented Apr 22, 2024

I think it's a matter of declaring your Lit Action within a string template like so. It looks like toSign and publicKey are available by default and you should be able to specify whichever additional parameters you'd like

For additional reference, there are more examples

@spacesailor24
Copy link
Author

I'm curious how your getLitActionCode function is working, is it just returning the self invoking function on the left? Is it possible for you to share your repo?

@bertrandbuild
Copy link

bertrandbuild commented Apr 23, 2024

Hi spacesailor and thank you for your support !

Here is the link to the repo : git repo

I've been checking the example but if I'm not mistaken, all the examples are using the passed JSparams inside the sign function so I was not sure if those params were available from the whole lit-action. Thank you for your confirmation !

It's just the basic getlit cmd init + the fetch example.

In fact, the condition of the fetch was hiding another error signing error (present also in the main action):

  • internal id for request: lit_f33c49028af53 - Error getting owner of PKP

So I used 'npx getlit setup' to generate a new PKP, but I have this error message getting the AuthSign :
image

I could generate the PKP but I guess the authsign error remains and I now have a Swile error :
image

Since it's the expirationTime of the getLit.json that is causing an error I tried to change the expirationTime of the signedMessage / switching browser & cleaning up the getlit.json without success

Copy link
Author

In your [utils.mjs](https://github.com/bertrandbuild/lit-git/blob/f8e36ab48f81571173fd8e25ca1fb81d2118c644/lit_actions/utils.mjs#L1) where is getlit.json? I'm curious what const authSig = getlitConfig['authSig']; looks like

@bertrandbuild
Copy link

Sure, it's actually the same as in the screenshot.
I'm not really getting the "signedMessage" error and what should I do next.

{ "authSig": { "sig": "0x355c1c[...]", "derivedVia": "web3.eth.personal.sign", "signedMessage": "localhost:1210 wants you to sign in with your Ethereum account:\n0x754edfB906252B304f89c59c61f4368028bdcE6c\n\n\nURI: http://localhost:1210/auth\nVersion: 1\nChain ID: 1\nNonce: DBqONUn3HrIpIs1ay\nIssued At: 2024-04-22T09:06:15.247Z\nExpiration Time: 2024-04-23T09:06:09.186Z", "address": "0x754edfb906252b304f89c59c61f4368028bdce6c" }, "pkpPublicKey": "0x04c388b8a09b[...]" }

Copy link
Author

Is that SIWE message hardcoded? It's expired: Expiration Time: 2024-04-23T09:06:09.186Z

I'm not really getting the "signedMessage" error

So which error are you getting? The original There was an error getting the signing shares from the nodes?

The jsParams property is still used with executeJs as you have, so that doesn't seem to be the cause of your issue. If you could provide me reproduction steps, then I can try to replicate the error you're receiving and escalate to the engineering team if needed

@bertrandbuild
Copy link

bertrandbuild commented Apr 29, 2024

About the SIWE message in the authSig, I can't update it, the workaround I found is to create a new wallet each time it expire (so everyday).

Here is a step by step guide to reproduce the error getting the signing shares from the nodes error :

  • npx getlit action
  • npx getlit setup (create a new wallet if needed)
  • rename the "NAME:" of the main.action.ts from 'hello' to 'main' (so it matches the tests) + fix in foo
  • npx getlit build main
  • npx getlit watch main (1st run will install @lit-protocol/lit-node-client-nodejs)
  • npx getlit watch main (2nd run will run it)

And on the 2nd run, I get this error :

[Lit-JS-SDK v5.0.0] [2024-04-29T13:53:27.152Z] [ERROR] [core] [id: 594396b6c7785] most common error: {"success":false,"error":"Uncaught (in promise) Error: Failed to sign ecdsa: lit_node::Error { kind: Unexpected, code: NodeContractResolverConversionFailed, msg: \"Error getting owner of PKP\", source: Revert(Bytes(0x)), caller:  { file: \"src/pkp/auth/mod.rs:465:17\" } }"}
errConstructorFunc {
  message: 'There was an error getting the signing shares from the nodes',
  name: undefined,
  errorCode: 'unknown_error'
}

Copy link
Author

Thank you for the steps, I will investigate further

Copy link
Author

spacesailor24 commented Apr 30, 2024

About the SIWE message in the authSig, I can't update it,…

Is this a limitation specific to your implementation, or is there an issue using the SDK to generate new AuthSigs?

Also I was able to reproduce the

[Lit-JS-SDK v5.0.0] [2024-04-29T13:53:27.152Z] [ERROR] [core] [id: 594396b6c7785] most common error: {"success":false,"error":"Uncaught (in promise) Error: Failed to sign ecdsa: lit_node::Error { kind: Unexpected, code: NodeContractResolverConversionFailed, msg: \"Error getting owner of PKP\", source: Revert(Bytes(0x)), caller:  { file: \"src/pkp/auth/mod.rs:465:17\" } }"}
errConstructorFunc {
  message: 'There was an error getting the signing shares from the nodes',
  name: undefined,
  errorCode: 'unknown_error'
}

error, so I'll escalate this and get back to you when I have an update!

@bertrandbuild
Copy link

Thank you very much ! 🙏

About the new AuthSigs I don't know. I think it was working without any trouble the first time, I guess the issue appeared later.

@spacesailor24
Copy link
Author

@bertrandbuild I don't see code to generate an auth sig in your repo, can you share that code and we can help debug that as well?

Copy link
Author

About the new AuthSigs I don't know. I think it was working without any trouble the first time, I guess the issue appeared later.

Ah yea I see now that getlit.json is generated by running getlit setup

@spacesailor24
Copy link
Author

@bertrandbuild
Just an update: We're suspecting that the getlit tool might be out-of-date. Our team is currently focused on releasing a new v6.0.0 of the SDK as well as a network upgrade, so we haven't had time to further investigate. This is on my to-do list, and I'm planning on investigating this week

In the meantime, can you tell me more about what you're trying to accomplish with Lit and I can help you get started with integrating Lit?

@bertrandbuild
Copy link

bertrandbuild commented May 9, 2024

Alright, noted about the getlit
I'm working on a lit action that can pull and process data from an api.
I could find a working setting using the v5 of the sdk and by following the old v2.x documentation.
I guess it's not ideal but working :)

ps: maybe the issue can be renamed to better match the trouble with the getlit tool ?

@spacesailor24 spacesailor24 changed the title Passing params to lit actions getlit tool is possibly out of date May 9, 2024
Copy link
Author

Do you want to share your code without using getlit, and maybe I can help with it? Is there anything specific you're having issues with?

Also renamed the issue, thank you for the suggestion!

@bertrandbuild
Copy link

thank you very much @spacesailor24 for your support.
I could setup the litaction without getlit and with a bit of setup it's working.

Here is a point I would need help with :

  • With LitAction I could sign data from passed params. I also tried to sign data coming from the inside of the LitAction function and it's working : ethers.utils.arrayify(ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Hello world"))),"

However, when I try to replace the Hellow world by a js object + stringify I have a timeout error.
The object is not so big (1300 characters). Is it a limitation from litAction or I'm missing something ?

Here is the details of my code + the errors.

Thx a lot for your support

const toSignRaw = JSON.stringify(credentials);
  // const toSignETH = ethers.utils.arrayify(ethers.utils.keccak256(ethers.utils.toUtf8Bytes(toSignRaw)));
  // -> [Lit-JS-SDK v5.0.0] [2024-05-17T08:05:03.810Z] �[31m[ERROR]�[0m [core] �[36m[id: 0e2afe68e827f]�[0m most common error: {"success":false,"error":"Failed to sign ecdsa: lit_node::Error { kind: Unexpected, code: NodeUnknownError, msg: \"ECDSA signing failed\", source: lit_node::Error { kind: Unexpected, msg: \"Error getting leader response.\", source: lit_node::Error { kind: Unexpected, msg: \"Error while waiting for incoming data\", source: lit_node::Error { kind: Unexpected, source: \"Timeout waiting for all nodes to respond to round 0 from node #2.  We received 0 of 1 responses from : []\", caller:  { file: \"src/p2p_comms/comms/wait.rs:116:24\" } }, caller:  { file: \"src/p2p_comms/mod.rs:248:22\" } }, caller:  { file: \"src/tasks/beaver_manager/listener.rs:1138:53\" } }, caller:  { file: \"src/pkp/utils.rs:469:22\" } }"}
  // (2nd execution) -> [Lit-JS-SDK v5.0.0] [2024-05-17T08:06:20.842Z] �[31m[ERROR]�[0m [core] �[36m[id: b07aec06dd892]�[0m most common error: {"errorKind":"Timeout","errorCode":"NodeJsTimeoutError","status":502,"message":"There was a timeout error executing the Javascript for this action","correlationId":"lit_b07aec06dd892","details":["timeout error: Your function exceeded the maximum runtime of 30000ms and was terminated."]}
  // const toSignETH = ethers.utils.arrayify(ethers.utils.keccak256(ethers.utils.toUtf8Bytes(`${toSignRaw}`)));
  // -> [Lit-JS-SDK v5.0.0] [2024-05-17T07:57:51.819Z] �[31m[ERROR]�[0m [core] �[36m[id: 9a39a57894b05]�[0m Something went wrong, internal id for request: lit_9a39a57894b05. Please provide this identifier with any support requests. Error is There was a timeout error executing the Javascript for this action - timeout error: Your function exceeded the maximum runtime of 30000ms and was terminated.
  const toSignETH = ethers.utils.arrayify(ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Hello world !")));
  // -> WORKING (ethers + small string)
  
  await Lit.Actions.signEcdsa({ toSign: toSignETH, publicKey, sigName });

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

No branches or pull requests

2 participants