Closed c194 closed 2 years ago
so i tried using the buildPayloadForExit
and i received same result -
const client = new POSClient();
await client.init({
log: true,
network: 'testnet',
version: 'mumbai',
parent: {
provider: new HDWalletProvider(privateKey, rpc.parent),
defaultConfig: {
from
}
},
child: {
provider: new HDWalletProvider(privateKey, rpc.child),
defaultConfig: {
from
}
}
});
// client.rootChainManager.processReceivedMessage()
console.log("init called");
const mumbaiERC20Token = client.erc20(mumbaiERC20);
const goerliERC20Token = client.erc20(goerliERC20, true);
const goerliERC721Token = client.erc721(pos.parent.erc721, true);
const mumbaiERC721Token = client.erc721(pos.child.erc721);
const goerliERC1155Token = client.erc1155(pos.parent.erc1155, true);
const mumbaiERC1155Token = client.erc1155(pos.child.erc1155);
// setProofApi("https://apis.matic.network");
var result = await client.exitUtil.buildPayloadForExit('0xc2668907d53f85d1ca1808622e51dc8645c8e9e7cf1393347a156e015309160a','0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036');
return console.log('result', result);
sharing the screenshot for ref -
I am not sure what's happening in your case, but i will ask you to try changing the RPC.
also you could try with proof-api using -
setProofApi("https://apis.matic.network");
var result = await client.exitUtil.buildPayloadForExit('0xc2668907d53f85d1ca1808622e51dc8645c8e9e7cf1393347a156e015309160a','0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036', true);
return console.log('result', result);
just so you know - proof api also internally uses this code to return the proof.
Thanks for the quick response @ujjwalguptaofficial ! It turns out this was RPC related. I was using a Speedy Node for Mumbai through Moralis, but switching my RPC to "https://matic-mumbai.chainstacklabs.com"
resolved the issue. Thanks for your help!
Describe the bug
The
maticjs
library returns a different, invalid burnproof payload than when I access the API directly for Mumbai transactions.For example:
I submit this withdrawal transaction on Mumbai: https://mumbai.polygonscan.com/tx/0xc2668907d53f85d1ca1808622e51dc8645c8e9e7cf1393347a156e015309160a
When I access the API directly using https://apis.matic.network/api/v1/mumbai/exit-payload/0xc2668907d53f85d1ca1808622e51dc8645c8e9e7cf1393347a156e015309160a?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036
I get a payload starting with
0xf90da58428db4a20b90100a...
When I submit this payload on Goerli, everything works as intended: https://goerli.etherscan.io/tx/0x4b39adaace7a9645067a247bf74b5da54cc6e2dcdf0bb83660339e5a09b3eb7f
HOWEVER
When I use the
maticjs
library to generate the burnproof, it returns a different payload starting with0xf90ca38428db4a20808401...
- trying to use this burnproof results in aFail with Error: Leaf Index is too Big
for the Goerli transaction.Requested Resolution
Investigate why the library returns a different payload than the Web API call and resolve the discrepancy
My Configuration to Reproduce
generate_burnproof.js
package.json