Giter VIP home page Giter VIP logo

Comments (7)

c194 avatar c194 commented on August 30, 2024

Hi @QEDK is this something that you can assist with? I'm unable to find any information about how to resolve a Fail with error 'Leaf Index is too big' online and I believe I have followed all of the steps for deposits and withdraws correctly, described here: https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/

from fx-portal.

c194 avatar c194 commented on August 30, 2024

Hi @jdkanani is this something that you can assist with? I'm unable to find any information about how to resolve a Fail with error 'Leaf Index is too big' online and I believe I have followed all of the steps for deposits and withdraws correctly, described here: https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/

from fx-portal.

c194 avatar c194 commented on August 30, 2024

I'm posting here because I've already taken the following actions to get support for this issue and have not received a response:

Multiple tickets submitted to: https://polygon.technology/contact-us/
Forum Post: https://forum.polygon.technology/t/technical-support-required-fxportal-implementation-fail-with-error-leaf-index-is-too-big/1394
This Support Ticket: https://support.polygon.technology/support/tickets/31130
Github Issue on FX-Portals Repo: #28
Multiple Messages in Polygon Discord Support Channel: https://discord.com/channels/635865020172861441/717384861647896616/935176155298930689

from fx-portal.

c194 avatar c194 commented on August 30, 2024

Hi @jdkanani - I wanted to provide some more information about this issue. On Mumbai, you can see I submit a withdraw/burn transaction here: https://mumbai.polygonscan.com/tx/0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0
which resolves successfully. I then move on to the next step, which is generating the burnproof.

I define a utils.js file that looks like such:

const bn = require('bn.js')
const HDWalletProvider = require('@truffle/hdwallet-provider')
const config = require('./config')
const { POSClient, setProofApi, use } = require('@maticnetwork/maticjs')
const SCALING_FACTOR = new bn(10).pow(new bn(18))
const { Web3ClientPlugin } = require("@maticnetwork/maticjs-web3");

use(Web3ClientPlugin);

if (config.proofApi) {
  setProofApi(config.proofApi);
}

const privateKey = config.user1.privateKey
const userAddress = config.user1.address

const getPOSClient = (network = 'testnet', version = 'mumbai') => {
  const posClient = new POSClient()
  return posClient.init({
    log: true,
    network: network,
    version: version,
    child: {
      provider: new HDWalletProvider(privateKey, config.child.rpc),
      defaultConfig: {
        from: userAddress
      }
    },
    parent: {
      provider: new HDWalletProvider(privateKey, config.parent.rpc),
      defaultConfig: {
        from: userAddress
      }
    }
  });
}

module.exports = {
  SCALING_FACTOR,
  getPOSClient: getPOSClient,
  child: config.child,
  plasma: config.plasma,
  pos: config.pos,
  from: config.user1.address,
  privateKey: config.user1.privateKey,
  proofApi: config.proofApi
}

and a generate_burn_proof.js file that looks like such:

const { getPOSClient, from } = require('../../utils');

const execute = async () => {
  const posClient = await getPOSClient();
  const proof = await posClient.exitUtil.buildPayloadForExit(
    "0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0", // Withdraw transaction hash
    "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036"  // MESSAGE_SENT_EVENT_SIG: Do not change this
  )
  console.log(" ----- BURN PROOF -----")
  console.log(proof)
}
execute().then(() => {
}).catch(err => {
  console.error("err", err);
}).finally(_ => {
  process.exit(0);
})

You'll note that I am submitting the 0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0 transaction hash here to generate the proof. By running generate_burn_proof.js, I'm able to successfully generate the burnproof for the transaction.

I submit this burnproof as input to my Root contract's receiveMessage message function but it fails due to Fail with error 'Leaf index is too big' - Failed Transaction: https://goerli.etherscan.io/tx/0xc5724512db14a1de7631441fc2e26e3da2439862515a2e15db6ef32761ab7fe6

from fx-portal.

Raneet10 avatar Raneet10 commented on August 30, 2024

Hi @c194 , can you try with this payload here: https://apis.matic.network/api/v1/mumbai/exit-payload/0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036

from fx-portal.

c194 avatar c194 commented on August 30, 2024

Hi @Raneet10 Thanks for the quick response, and that payload did work!

Successful Transaction: https://goerli.etherscan.io/tx/0x628ce213f9523db782d49e6f882cf2bc2a1bd7d5bce2f746edbebe20d94437a8

I am now wondering if the @maticnetwork/maticjs library needs to be updated to include whatever changes that you made.

I define the following configuration for POSClient:

const { POSClient, setProofApi, use } = require('@maticnetwork/maticjs')
// Irrelevant code excluded from this snippet

setProofApi('https://apis.matic.network/api/v1/');

const privateKey = config.user1.privateKey
const userAddress = config.user1.address

const getPOSClient = (network = 'testnet', version = 'mumbai') => {
  const posClient = new POSClient()
  return posClient.init({
    log: true,
    network: network,
    version: version,
    child: {
      provider: new HDWalletProvider(privateKey, config.child.rpc),
      defaultConfig: {
        from: userAddress
      }
    },
    parent: {
      provider: new HDWalletProvider(privateKey, config.parent.rpc),
      defaultConfig: {
        from: userAddress
      }
    }
  });
}

and generate the burnproof as such:

const execute = async () => {
  const posClient = await getPOSClient();
  const proof = await posClient.exitUtil.buildPayloadForExit(
    "0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0", // Withdraw transaction hash
    "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036"  // MESSAGE_SENT_EVENT_SIG: Do not change this
  )
  console.log(" ----- BURN PROOF -----")
  console.log(proof)
}

Where I was sure to reference the same API endpoint as you sent over. However, the library produces a slightly different burnproof than the web request you sent over.

Web Request Burnproof: 0xf90b7b8428adf890b90...
@maticnetwork/maticjs Burnproof: 0xf90a798428adf890808...

I can use the GET web requests to continue with my development work but wanted to make sure I brought this discrepancy to your attention while you are working on the issue.

Second Example
Withdraw Transaction - https://mumbai.polygonscan.com/tx/0xba49d07f88c5bbd00a60428333a374f4fcc58dc60e231ab74986f39886914729
Receive Message Failure (using matijs burnproof 0xf909588428d15f10808401...: https://goerli.etherscan.io/tx/0x2746142e2687b840b3ee295814b7ae99a026712e11911013c55093209fea43d1
Receive Message Success (using GET request burnproof 0xf90a5a8428d15f10b...:
https://apis.matic.network/api/v1/mumbai/exit-payload/0xba49d07f88c5bbd00a60428333a374f4fcc58dc60e231ab74986f39886914729?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036
https://goerli.etherscan.io/tx/0x6e0cde361d4a47d8df3c9c8c5840f1227be44baff7fd9f79c43819971e6df349

Thanks again for your timely response! I really appreciate your support on this issue.

from fx-portal.

QEDK avatar QEDK commented on August 30, 2024

Hi @Raneet10 Thanks for the quick response, and that payload did work!

Successful Transaction: https://goerli.etherscan.io/tx/0x628ce213f9523db782d49e6f882cf2bc2a1bd7d5bce2f746edbebe20d94437a8

I am now wondering if the @maticnetwork/maticjs library needs to be updated to include whatever changes that you made.

I define the following configuration for POSClient:

const { POSClient, setProofApi, use } = require('@maticnetwork/maticjs')
// Irrelevant code excluded from this snippet

setProofApi('https://apis.matic.network/api/v1/');

const privateKey = config.user1.privateKey
const userAddress = config.user1.address

const getPOSClient = (network = 'testnet', version = 'mumbai') => {
  const posClient = new POSClient()
  return posClient.init({
    log: true,
    network: network,
    version: version,
    child: {
      provider: new HDWalletProvider(privateKey, config.child.rpc),
      defaultConfig: {
        from: userAddress
      }
    },
    parent: {
      provider: new HDWalletProvider(privateKey, config.parent.rpc),
      defaultConfig: {
        from: userAddress
      }
    }
  });
}

and generate the burnproof as such:

const execute = async () => {
  const posClient = await getPOSClient();
  const proof = await posClient.exitUtil.buildPayloadForExit(
    "0xae1c8793cc900f22676b348802d020790057ce9fb82cd9d7404ebd3c85b5fea0", // Withdraw transaction hash
    "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036"  // MESSAGE_SENT_EVENT_SIG: Do not change this
  )
  console.log(" ----- BURN PROOF -----")
  console.log(proof)
}

Where I was sure to reference the same API endpoint as you sent over. However, the library produces a slightly different burnproof than the web request you sent over.

Web Request Burnproof: 0xf90b7b8428adf890b90... @maticnetwork/maticjs Burnproof: 0xf90a798428adf890808...

I can use the GET web requests to continue with my development work but wanted to make sure I brought this discrepancy to your attention while you are working on the issue.

Second Example Withdraw Transaction - https://mumbai.polygonscan.com/tx/0xba49d07f88c5bbd00a60428333a374f4fcc58dc60e231ab74986f39886914729 Receive Message Failure (using matijs burnproof 0xf909588428d15f10808401...: https://goerli.etherscan.io/tx/0x2746142e2687b840b3ee295814b7ae99a026712e11911013c55093209fea43d1 Receive Message Success (using GET request burnproof 0xf90a5a8428d15f10b...: https://apis.matic.network/api/v1/mumbai/exit-payload/0xba49d07f88c5bbd00a60428333a374f4fcc58dc60e231ab74986f39886914729?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036 https://goerli.etherscan.io/tx/0x6e0cde361d4a47d8df3c9c8c5840f1227be44baff7fd9f79c43819971e6df349

Thanks again for your timely response! I really appreciate your support on this issue.

The likely reason is that the matic.js version used to generate the proof is older. If the issue persists on the latest version, please open an issue at https://github.com/maticnetwork/matic.js/issues with the details you provided above.

from fx-portal.

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.