0xPolygonHermez / zkevm-bridge-service

Other
67 stars 66 forks source link

problem with bridge asset from L2(zkevm validium) to L1(Sepolia) #537

Closed ran-noumena closed 1 week ago

ran-noumena commented 10 months ago

After I succeeded in transferring assets from L1(Sepolia) to Local L2(zkevm validium) as you can see in the Proxy contract address of PolygonZkEVMBridge contract (https://sepolia.etherscan.io/tx/0xc43750ab2e42e00b4ab0a7b1a129af49f142e9ecd366044c0dd5bd650b5e0ded), ,%C2%A0)and the attached image from L2 explorer, it tried to transfer assets from L2 to L1 via PolygonZkEVMBridge.claimAsset(), but when I ran the app, it stuck on PolygonZkEVMBridge.claimAsset() output wait() function without any error or warning.

async getDepositMD( depositCount: number, DepositNetworkIdSrc: PolygonBridgeNetworkDestinationId, ): Promise<GetDepositsOutputs> { // eslint-disable-next-line max-len const getDepositUrl =${this.blockchainL2NetworkUrl}:${this.blockchainL2BridgePort}/merkle-proof?net_id=${DepositNetworkIdSrc}&deposit_cnt=${depositCount}` this.logger.info("getDeposits: get deposit from: ", getDepositUrl) const getDepositsOutput = await this.axiosService.get(getDepositUrl) console.dir(getDepositsOutput) return getDepositsOutput }

async claimAssets(ContractAddress: string, holderAddress: string, provider: ethers.providers.Provider) { const depositCount = 15 const res = await this.getDepositMD(depositCount, PolygonBridgeNetworkDestinationId.LAYER_ONE) console.dir("bridgeAsset: get depositMD") console.dir(res) const holderWallet = await this.walletProviderService.getWallet(holderAddress) const contract = PolygonZkEVMBridge__factory.connect(this.BridgeContract, holderWallet.connect(provider)) const [names, symbol, decimals] = await Promise.all([ contract.name(), contract.symbol(), contract.decimals(), ]) const md = defaultAbiCoder.encode(["string", "string", "uint8"], [names, symbol, decimals]) console.dir(md) console.dir("####randd2") const output = await contract.claimAsset( res.proof.merkle_proof, depositCount, res.proof.main_exit_root, res.proof.rollup_exit_root, PolygonBridgeNetworkDestinationId.LAYER_ONE, ContractAddress, PolygonBridgeNetworkDestinationId.LAYER_TWO, holderAddress, ethers.utils.parseEther("25"), md, { gasLimit: 40740, gasPrice: 0 }, ) console.dir(output) const res_waite = await output.wait() console.dir("bridgeAsset: get claim assets res after wait!!!") console.dir(res_waite) } `

logs: ` 'bridgeAsset: get depositMD' { proof: { merkle_proof: [ '0x8e985d276ee486765e7edbbf2310e04acd4e4d5b1e420579a81c655dee3969e1', '0x061a5d6bf18c48cfd7b367b08dfe1368d2290e48c7849db09f696b4fad820054', '0x202d34c74bb49918c1100fd4eba1d737637439616e5e0a76e96052b76b61866f', '0xdc7fb4a69eec916697b3b6ad14aa617b3760c4d270c5cc5704989699c74071d8', '0xe58769b32a1beaf1ea27375a44095a0d1fb664ce2dd358e7fcbfb78c26a19344', '0x0eb01ebfc9ed27500cd4dfc979272d1f0913cc9f66540d7e8005811109e1cf2d', '0x887c22bd8750d34016ac3c66b5ff102dacdd73f6b014e710b51e8022af9a1968', '0xffd70157e48063fc33c97a050f7f640233bf646cc98d9524c6b92bcf3ab56f83', '0x9867cc5f7f196b93bae1e27e6320742445d290f2263827498b54fec539f756af', '0xcefad4e508c098b9a7e1d8feb19955fb02ba9675585078710969d3440f5054e0', '0xf9dc3e7fe016e050eff260334f18a5d4fe391d82092319f5964f2e2eb7c1c3a5', '0xf8b13a49e282f609c317a833fb8d976d11517c571d1221a265d25af778ecf892', '0x3490c6ceeb450aecdc82e28293031d10c7d73bf85e57bf041a97360aa2c5d99c', '0xc1df82d9c4b87413eae2ef048f94b4d3554cea73d92b0f7af96e0271c691e2bb', '0x5c67add7c6caf302256adedf7ab114da0acfe870d449a3a489f781d659e8becc', '0xda7bce9f4e8618b6bd2f4132ce798cdc7a60e7e1460a7299e3c6342a579626d2', '0x2733e50f526ec2fa19a22b31e8ed50f23cd1fdf94c9154ed3a7609a2f1ff981f', '0xe1d3b5c807b281e4683cc6d6315cf95b9ade8641defcb32372f1c126e398ef7a', '0x5a2dce0a8a7f68bb74560f8f71837c2c2ebbcbf7fffb42ae1896f13f7c7479a0', '0xb46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0', '0xc65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2', '0xf4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd9', '0x5a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e377', '0x4df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652', '0xcdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef', '0x0abf5ac974a1ed57f4050aa510dd9c74f508277b39d7973bb2dfccc5eeb0618d', '0xb8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d0', '0x838c5655cb21c6cb83313b5a631175dff4963772cce9108188b34ac87c81c41e', '0x662ee4dd2dd7b2bc707961b1e646c4047669dcb6584f0d8d770daf5d7e7deb2e', '0x388ab20e2573d171a88108e79d820e98f26c0b84aa8b2f4aa4968dbb818ea322', '0x93237c50ba75ee485f4c22adf2f741400bdf8d6a9cc7df7ecae576221665d735', '0x8448818bb4ae4562849e949e17ac16e0be16688e156b5cf15e098c627c0056a9' ], main_exit_root: '0xc5beb33cd9d3ef9e23fc2e8d8ac790a269cb9e35c10214e5b57a238e9172b929', rollup_exit_root: '0x0000000000000000000000000000000000000000000000000000000000000000' } }

'0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004436f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004434f494e00000000000000000000000000000000000000000000000000000000' '####randd2' { type: 2, chainId: 11155111, nonce: 9, maxPriorityFeePerGas: BigNumber { _hex: '0x00', _isBigNumber: true }, maxFeePerGas: BigNumber { _hex: '0x00', _isBigNumber: true }, gasPrice: null, gasLimit: BigNumber { _hex: '0x9f24', _isBigNumber: true }, to: '0xa7d97Af4aB3C4f6564147B96935B07c6F6a219c0', value: BigNumber { _hex: '0x00', _isBigNumber: true }, data: '0x2cffd02e8e985d276ee486765e7edbbf2310e04acd4e4d5b1e420579a81c655dee3969e1061a5d6bf18c48cfd7b367b08dfe1368d2290e48c7849db09f696b4fad820054202d34c74bb49918c1100fd4eba1d737637439616e5e0a76e96052b76b61866fdc7fb4a69eec916697b3b6ad14aa617b3760c4d270c5cc5704989699c74071d8e58769b32a1beaf1ea27375a44095a0d1fb664ce2dd358e7fcbfb78c26a193440eb01ebfc9ed27500cd4dfc979272d1f0913cc9f66540d7e8005811109e1cf2d887c22bd8750d34016ac3c66b5ff102dacdd73f6b014e710b51e8022af9a1968ffd70157e48063fc33c97a050f7f640233bf646cc98d9524c6b92bcf3ab56f839867cc5f7f196b93bae1e27e6320742445d290f2263827498b54fec539f756afcefad4e508c098b9a7e1d8feb19955fb02ba9675585078710969d3440f5054e0f9dc3e7fe016e050eff260334f18a5d4fe391d82092319f5964f2e2eb7c1c3a5f8b13a49e282f609c317a833fb8d976d11517c571d1221a265d25af778ecf8923490c6ceeb450aecdc82e28293031d10c7d73bf85e57bf041a97360aa2c5d99cc1df82d9c4b87413eae2ef048f94b4d3554cea73d92b0f7af96e0271c691e2bb5c67add7c6caf302256adedf7ab114da0acfe870d449a3a489f781d659e8beccda7bce9f4e8618b6bd2f4132ce798cdc7a60e7e1460a7299e3c6342a579626d22733e50f526ec2fa19a22b31e8ed50f23cd1fdf94c9154ed3a7609a2f1ff981fe1d3b5c807b281e4683cc6d6315cf95b9ade8641defcb32372f1c126e398ef7a5a2dce0a8a7f68bb74560f8f71837c2c2ebbcbf7fffb42ae1896f13f7c7479a0b46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0c65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2f4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd95a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e3774df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652cdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef0abf5ac974a1ed57f4050aa510dd9c74f508277b39d7973bb2dfccc5eeb0618db8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d0838c5655cb21c6cb83313b5a631175dff4963772cce9108188b34ac87c81c41e662ee4dd2dd7b2bc707961b1e646c4047669dcb6584f0d8d770daf5d7e7deb2e388ab20e2573d171a88108e79d820e98f26c0b84aa8b2f4aa4968dbb818ea32293237c50ba75ee485f4c22adf2f741400bdf8d6a9cc7df7ecae576221665d7358448818bb4ae4562849e949e17ac16e0be16688e156b5cf15e098c627c0056a9000000000000000000000000000000000000000000000000000000000000000fc5beb33cd9d3ef9e23fc2e8d8ac790a269cb9e35c10214e5b57a238e9172b929000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006432001603619025c6013786bafce3da612f0843000000000000000000000000000000000000000000000000000000000000000100000000000000000000000085e16f8d2abf33838daf9a0352810e3bc39a90f20000000000000000000000000000000000000000000000015af1d78b58c40000000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004436f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004434f494e00000000000000000000000000000000000000000000000000000000', accessList: [], hash: '0xc25d4a047ca1a9fed9acc3790059741882b8a09ff997977e889469b79b56db1d', v: 0, r: '0x96cb2df7cf9b1df9a3a1731f489aaa04e403ae9b0b79970259a5e4f385b28a3f', s: '0x62141c087f597791e2a205ae9d24fd52dac2133c6dabd2c95f7e6b1f318a6040', from: '0x85e16f8D2ABF33838dAF9a0352810E3bc39A90F2', confirmations: 0, wait: [Function (anonymous)] }

****stuck here!!!!! `

ran-noumena commented 10 months ago

update it takes almost 3-7 hours and than its failed

ARR552 commented 9 months ago

Hi @ran-noumena when you want to send funds from L2 to L1: 1- You need to do a deposit in the L2 bridge smc. 2- Once the deposit is done, you must wait until the batch that contains your deposit tx is verified in L1 sms. 3- When this verification is done, you have to send the merkle proof the the bridge smc in L1 (using the claim asset function if you used bridgeAsset during the deposit).