LIT-Protocol / js-sdk

The Lit Protocol SDK provides developers with a framework for implementing Lit functionality into their own applications.
https://developer.litprotocol.com
MIT License
105 stars 65 forks source link

[dClimate] Cannot connect LitNodeClient to localhost #568

Open 0xSwego opened 3 months ago

0xSwego commented 3 months ago

Description of the issue

We have a fully working setup for datil-dev and are now trying to modify it so that it will work also on localhost during development.

Steps we followed (from this guide):

But when we run this we get the following error:

    const client = new LitNodeClient({
        litNetwork: "localhost",
        debug: true
    });
    await client.connect();
Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="currentValidatorCountForConsensus()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
    at Logger.makeError (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at Interface.decodeFunctionResult (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/abi/src.ts/interface.ts:427:23)
    at Contract.<anonymous> (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/contracts/src.ts/index.ts:400:44)
    at step (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/contracts/lib/index.js:48:23)
    at Object.next (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/contracts/lib/index.js:29:53)
    at fulfilled (/home/0xSwego/projects/external-adapters-v2/node_modules/@ethersproject/contracts/lib/index.js:20:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  reason: null,
  code: 'CALL_EXCEPTION',
  method: 'currentValidatorCountForConsensus()',
  data: '0x',
  errorArgs: null,
  errorName: null,
  errorSignature: null,
  address: '0xD4507CD392Af2c80919219d7896508728f6A623F',
  args: [],
  transaction: {
    data: '0x43cb0a0e',
    to: '0xD4507CD392Af2c80919219d7896508728f6A623F'
  }
}

I couldn't find any reference of 0xD4507CD392Af2c80919219d7896508728f6A623F in the deployed contracts list (see additional context). Should I pass the deployed contract addresses somehow to the client in order for it to properly connect?

Additional context

deployed-lit-node-contracts-temp.json

{
  "backupRecoveryContractAddress": "0xa7D75C844f0725E4832ED99d77EC8a0bBc5d3eF6",
  "stakingBalancesContractAddress": "0x474EE774139C38E76BC0b60d8Fb5F6De5C949850",
  "stakingContractAddress": "0x9f82626CaD80b6C87ee681c21F1E46AFD5cE2222",
  "multisenderContractAddress": "0x43707909eD7426734A930D795e15cd78CC88AE3f",
  "litTokenContractAddress": "0x2Cf6C2a9Fb4d50Da99D9e04889beDF450E71e7F4",
  "pubkeyRouterContractAddress": "0xCDD9741479f0da694E0dCAD68D55C9F3872D794d",
  "pkpNftContractAddress": "0x8c0BA4741A31DA76D75b9Fe5133c2847Ba87A4b9",
  "rateLimitNftContractAddress": "0xbb6a8eaE20f8B881d0196978f38e67B90ADeb998",
  "pkpHelperContractAddress": "0x7FaE3b3fCf5ad222F3f42e11ad92933A1a297242",
  "pkpPermissionsContractAddress": "0xf1A63d37f733b14c05d0ef93ea887F53970b350A",
  "pkpNftMetadataContractAddress": "0xf94EA781F213b1782f89a2F451D45BC6DD896bE7",
  "allowlistContractAddress": "0xEfE5BB36d84024F03B185B018BB1217C4C7d46cB",
  "resolverContractAddress": "0xF4210c6bff554B8Ca9eF2c5cbFe33B0d3dfA9Fe7",
  "DomainWaleltRegistryAddress": "0x9dAfD423cbE6c0BE3a6C4b2Eca39A95A939b327e",
  "DomainWalletOracleAddress": "0x26a60b5d6076D1BCfD27e7aFe0eB5A32A7D5227b",
  "hdKeyDeriverContractAddress": "0x23caF9d5D041B3E95B41BCc022AA35a308a2a13a",
  "chainId": "31337",
  "rpcUrl": "http://127.0.0.1:8545",
  "chainName": "localchain",
  "litNodeDomainName": "127.0.0.1",
  "litNodePort": 7470,
  "rocketPort": 7470,
  "facets": {
    "StakingBalances": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0xD4F66c085509CAcc31b8871Db79307380f840501"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0xEc4eDfC064E58276069136f1c7B3315243919773"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0xC0A173da8B4becF1290467CD9EF92411B7033Ccb"
      },
      {
        "facetName": "StakingBalancesFacet",
        "facetAddress": "0x8A150D9DB45412490FdE869405080062C437Cba5"
      }
    ],
    "Staking": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0x8d8541C89F5118f6Fe75775AD7697214FA0540EB"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0xa94413716dCec6A7343E495d963e1bdc7c52945f"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0xC636765b1f23011c34F1C2540358da9db55c8133"
      },
      {
        "facetName": "StakingFacet",
        "facetAddress": "0x561a059E477991EE3832AB2d53Afd07B76f05738"
      },
      {
        "facetName": "StakingViewsFacet",
        "facetAddress": "0x12d1e2Ca8c91443Ad22e01B91CbCB512D337DC3F"
      },
      {
        "facetName": "StakingVersionFacet",
        "facetAddress": "0xbCB0bD8A2881B075123C99C9b3FDfe5344D09dDb"
      }
    ],
    "PKPNFT": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0xb8A30caf214E5c903D550A506CBbC2D370731D08"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0xa188d0A6BBCD06583C7A29f5Ff5a80e609186095"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0x6aDB04504970e8aa7309D9d864CB50a57045bC19"
      },
      {
        "facetName": "PKPNFTFacet",
        "facetAddress": "0x15dfc947F9E22EE93991b7a7f3631B230b94F489"
      }
    ],
    "RateLimitNFT": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0x72B37931996570d67C191361Cb0d76E9fdb4121b"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0x09749778A41128Ac714021392D671CFD6EC188d0"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0xc36449d5A86668E941214d8B5661D9BaA1DE8b1D"
      },
      {
        "facetName": "RateLimitNFTFacet",
        "facetAddress": "0xBed8c13f489f8964c4cAd074CFd17cD2Dc306a08"
      },
      {
        "facetName": "RateLimitNFTViewsFacet",
        "facetAddress": "0x0b2c72270880D592ab1091e758CF5025BCf46107"
      }
    ],
    "PubkeyRouter": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0xa57505712c63E3ab9C027E1E7225d94F4Bab5b12"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0x34b178b5E0E84dAd510CAe085736Cc26F719E9A6"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0xE7997c212A38981794b69904A89453e96b9A6f0b"
      },
      {
        "facetName": "PubkeyRouterFacet",
        "facetAddress": "0xcDd54580Cb0EAD2e8A1bCF6Ea764E4CC11087395"
      }
    ],
    "PKPPermissions": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0x4f5a89f66ec13410A69Ce13303FBD0Ce94b201a6"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0x897843A8F5d3c0e06Ed5a3678C6aF0962bb93ac9"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0x9A8b6E78BD77593604412bDf803B6CEa6F498A02"
      },
      {
        "facetName": "PKPPermissionsFacet",
        "facetAddress": "0x911E392870dc235307FC39090Ca4B2244BE7fe9c"
      }
    ],
    "BackupRecovery": [
      {
        "facetName": "DiamondCutFacet",
        "facetAddress": "0x65f20F15411Adb19E8C5C7e227567D189558cF14"
      },
      {
        "facetName": "DiamondLoupeFacetNoERC165",
        "facetAddress": "0xd5489a72fc61798Db46D4F0bd2dDC2943f56C5f8"
      },
      {
        "facetName": "OwnershipFacet",
        "facetAddress": "0x4Bd273CeCe78597Fa8D3fce8F1c6f49331b33713"
      },
      {
        "facetName": "BackupRecoveryFacet",
        "facetAddress": "0x95860974dF03251Ba52c31965563a9fad959D386"
      }
    ]
  }
}

deployed-lit-core-contracts-temp.json


{
  "contractResolver": "0xF4210c6bff554B8Ca9eF2c5cbFe33B0d3dfA9Fe7",
  "releaseRegisterContractAddress": "0x6c0472552643B272a17403f2C7dE86f661c186FB"
}
joshLong145 commented 3 months ago

hey @0xSwego Unfortunately the repository you are using is not compatible with latest sdk versions. So if you are looking for a local datil environment this is not yet available. We are working on some things to bring a simple local dev solution but we are not yet ready to make it public at this time. If you would like we can give you a ping when it ready.

0xSwego commented 3 months ago

Hi @joshLong145, thanks a lot for your answer. I would definitely like to get a ping when things changed. Any ETA for it?

For the moment, what do you advise doing? Can I use an older version of the repo/sdk? Or it's not really worth it as it would require a lot of changes as soon as the local datil environment is ready?

joshLong145 commented 3 months ago

Hi @joshLong145, thanks a lot for your answer. I would definitely like to get a ping when things changed. Any ETA for it?

For the moment, what do you advise doing? Can I use an older version of the repo/sdk? Or it's not really worth it as it would require a lot of changes as soon as the local datil environment is ready?

At this time it wouldn't be worth migrating, as the API surface of various packages has changed. We have some tooling updates in the pipeline and will keep you updated on when they are released. I will keep this thread opened until it is live and update it with more info soon.