makerdao / xdomain

GNU Affero General Public License v3.0
19 stars 10 forks source link

Fix claiming failed deposit error #146

Closed vladbochok closed 1 year ago

vladbochok commented 1 year ago

The l2Signer.provider.getLogProof(txHash) returns the first L2 -> L1 log that sent in L2 transaction with txHash hash. Sometimes, system logs may be sent together with other transaction logs. So the correct code for getting L2 -> L1 logs will be:

            const receipt = await this._providerL2().getTransactionReceipt(ethers.utils.hexlify(depositHash));
            const successL2ToL1LogIndex = receipt.l2ToL1Logs.findIndex(
                (l2ToL1log) => l2ToL1log.sender == BOOTLOADER_FORMAL_ADDRESS && l2ToL1log.key == depositHash
            );
            const successL2ToL1Log = receipt.l2ToL1Logs[successL2ToL1LogIndex];

The SDK already implements the proper method, so replace the code with its usage.

olivdb commented 1 year ago

Changes incorporated into #147