Git Product home page Git Product logo

fx-portal's People

Contributors

akkii4 avatar dhairyasethi avatar gretzke avatar jdkanani avatar pranavdaa avatar qedk avatar raneet10 avatar reddyismav avatar sidhant-shr avatar wschwab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fx-portal's Issues

Missing default return value in MerklePatriciaProof.verify

The compiler fires this warning:

Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
  --> @maticnetwork/fx-portal/contracts/lib/MerklePatriciaProof.sol:20:30:
   |
20 |     ) internal pure returns (bool) {
   |                              ^^^^

Is fx-portal still a valid approach for token bridging?

From token mapper, it says fx-portal was discontinued. What's the reason for that?
Even without the UI, I assume this approach still works since the contracts still there. But I wonder is it safe to continue using this for erc20 bridging?

Is the reason somehow related to polygon 2.0 that POS chain will be migrate to a zkEVM validium, so the state sync may not continue to work?

How are network fees handled?

Hey!

I just got through this repo and I'm trying to understand how it all fits together. While it makes it complete sense on the contract side, I'm wondering who pays for network fees?

FelixTheCat22

FelixTheCat is owner of 0x0000000000000000000000000000000000001010

His new wallet is 0x682f81e57eaa716504090c3ecba8595fb54561d8
Screenshot_20240407_162742_Chrome

Is this still portal functional?

is this still functional?, it doesn't seem to be sync activity between ethereum and the child contract "fxChild".

Looking at the contract in mumbai, ther las activity was 3 months ago.

Missing SPDX license in ExitPayloadReader and RLPReader

The compiler fires these warnings:

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> @maticnetwork/fx-portal/contracts/lib/ExitPayloadReader.sol


Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> @maticnetwork/fx-portal/contracts/lib/RLPReader.sol

Is the recent vulnerability fix to the mask needed for the RootTunnel too?

As there was a recent vulnerability fix to revert masks that start with 0x00, does the fix also need to be done for the contracts in fx portal, especially the part where the mask will be used to produce the exit hash which supposed to be unique?

Particularly this part: https://github.com/fx-portal/contracts/blob/main/contracts/tunnel/FxBaseRootTunnel.sol#L79

The usage of the mask looks almost the same as how it is used in the contracts on the main Polygon repo.

This was the fix applied on the contracts in the Polygon repo some time back: https://github.com/maticnetwork/contracts/pull/381/files

Which is mainly this:

require(vars.branchMaskBytes[0] == 0, "incorrect mask");

State transfer from Polygon to Ethereum

Hello, I am wondering how to transfer data from child to Root, how to generate the proof as an input to receiveMessage() to receive the messages?
In the Doc of Polygon, it shows:
// npm i @maticnetwork/maticjs
// for goerli - mumbai testnet
const getPOSClient = (network = 'testnet', version = 'mumbai') => {
const posClient = new POSClient()
return posClient.init({
log: true,
network: network,
version: version,
child: {
"matic-provider"
},
parent: {
"matic-provider"
}
}
});
}
posClient.exitUtil.buildPayloadForExit("burntxhash","event signature")

I am wondering how to set "matic-provider", "matic-provider" and burntxhash, event signature

Technical Support Required - FxPortal Implementation `Fail with error ‘Leaf index is too big’` (Goerli/Mumbai)

Hello! I'm the Lead Developer working on integrating GoldHunt Game (thegame.gold) with the Polygon network. I intend to build a custom implementation of the FxPortal Root & Child Contracts (https://github.com/fx-portal/contracts) to enable our community to move tokens between Ethereum <-> Polygon.

I need technical support on implementing this bridge on the Test networks (Goerli, Mumbai).

The problem: when I call function receiveMessage(bytes memory inputData) public virtual on my implementation of the Root contract, I am getting a Fail with error 'Leaf index is too big' error on the transaction.

Failed Transactions (same error):

I generate the burn proof as such:


const execute = async () => {

  const posClient = await getPOSClient();

  const proof = await posClient.exitUtil.buildPayloadForExit(

    "0x76bd13760e3dbea702450f8741b405bf528be0078570d94c405a9183a8911ef9", // Withdraw transaction hash

    "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036"  // MESSAGE_SENT_EVENT_SIG: Do not change this

  )

  console.log(" ----- BURN PROOF -----")

  console.log(proof)

}

Where https://mumbai.polygonscan.com/tx/0x76bd13760e3dbea702450f8741b405bf528be0078570d94c405a9183a8911ef9 is the Withdraw transaction I submitted on the Mumbai network.

My implementation of the FxMintableERC20RootTunnel is deployed at https://goerli.etherscan.io/address/0xC0Af0b1a10F2417D62EE044BC99dB1b40b4DC82e - you'll notice a number of failed transactions all throwing the same error.

My implementation of the FxMintableERC20ChildTunnel is deployed at https://mumbai.polygonscan.com/address/0x38530B465C2937b6f3fB7559a796156D2a0A9f02 - I submitted the Withdraw transaction on Mumbai to this contract (see above) over 24 hours ago.

I am attempting to send GGold (ERC20) back and forth across my tunnel, and am unable to resolve the last step to receive the funds back from the Tunnel on Goerli due to the error above.

GGold (Goerli) - https://goerli.etherscan.io/address/0xbdCDF80D26DDA1ae2F9C0003995d160F4893F20A

pGGold (Polygon) - https://mumbai.polygonscan.com/address/0xC440ddBA14e585fdF395bD74B85797e41fd8317c

I can see that the error is ultimately being thrown by the Merkle library defined as such:

pragma solidity ^0.8.0;

library Merkle {
    function checkMembership(
        bytes32 leaf,
        uint256 index,
        bytes32 rootHash,
        bytes memory proof
    ) internal pure returns (bool) {
        require(proof.length % 32 == 0, "Invalid proof length");
        uint256 proofHeight = proof.length / 32;
        // Proof of size n means, height of the tree is n+1.
        // In a tree of height n+1, max #leafs possible is 2 ^ n
        require(index < 2**proofHeight, "Leaf index is too big");

        bytes32 proofElement;
        bytes32 computedHash = leaf;
        for (uint256 i = 32; i <= proof.length; i += 32) {
            assembly {
                proofElement := mload(add(proof, i))
            }

            if (index % 2 == 0) {
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }

            index = index / 2;
        }
        return computedHash == rootHash;
    }
}

but this entire section of code was defined as part of the FxBaseRootTunnel.sol file defined in the fx-portals repo which I am using an exact copy of so I'm not sure how to debug this issue.


Please advise on how to resolve this issue - I've already read through https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/ and this issue is not covered and I am unable to find any other sources online about how to resolve it.

Any help you can provide would be greatly appreciated, as we're excited about being able to onboard thousands of new users to the Polygon network once we're able to build out this infrastructure!

Should setFxRootTunnel and setFxChildTunnel be made virtual?

Currently, the setFxRootTunnel and setFxChildTunnel functions are non-virtual. Inherited classes are unable to override with their own logic or add their own modifiers to restrict anyone from calling them out of mischief.

Should these functions be made virtual intead?

State Transfer - state message relay time

  • First, this is an amazing feature and was pumped to implement it. Excited that I came across it so soon after its creation.

  • I've implemented this with Goerli and Mumbai testnets.

  • I've successfully run the State Transfer 10 times now, each completed at around 5-8 minutes(root to child).

  • That being said, my use case would ideally entail the relay time to be 2 minutes, tops. Are there plans to implement this for use cases requiring faster turn around? Or is there a method by which I can speed up the State Transfer?

-Really, appreciate that you made this!

recieveMessage function error

Hey everyone
I started to get issues w/ this part --> https://docs.polygon.technology/docs/develop/l1-l2-communication/state-transfer
and specifically w/ recieveMessage function (Polygon-->ETH transfer). Couple days ago I tested this function and it worked and now I see a warning "Exception in contract code" and failed gas estimation in MM. Contracts did not change.

So.. I wonder if there were any updates on this state transfer in recent days or maybe some issues I am not aware of on Goerli and Mumbai nets? Thanks.

About FxERC20Transfer withdraw test code

Hi, i have a question about FxERC20Transfer withdraw testcode in feature/hardhat_unittestbranch.
So i tested erc20 state transfer with test/tunnel/FxERC20Tunnel.ts.
I understand mapToken, deposit function, but i'm little confused of this withdraw line.

In the test code after deposit(), the wallet.getAddress() has 10(i will omit 10^18) in child token contract(the mapped contract).
And also the wallet.getAddress() has 9990 in the root token contract.

child token contract wallet.getAddress() balance : 10
root token contract wallet.getAddress() balance : 9990

When withdraw() function call(withdraw 5 from child token contract) i thought below will be the result.

child token contract wallet.getAddress() balance : 5
root token contract wallet.getAddress() balance : 9995

But instead of above balance, the test code is showing me below result.

child token contract wallet.getAddress() balance : 5
root token contract wallet.getAddress() balance : 9990

So to sum up my question is
Q1. Is the wallet.getAddress() balance I expected right? - child token contract: 5, root token contract: 9995
Q2. Is the withdraw test code resulted becuase the checkpointManager is not working in local test environment?
Q3. What is the checkpointManager0x600e7E2B520D51a7FE5e404E73Fb0D98bF2A913E in the test code? over here.

Thanks for advanced!

truffle compile fails for the FxERC721ChildTunnel.sol smart contract inside examples/

When we compile the contracts using truffle compile, the compilation fails with the below error message:

TypeError: Member "ownerOf" not found or not visible after argument-dependent lookup in contract IFxERC721.
  --> project:/contracts/examples/erc721-transfer/FxERC721ChildTunnel.sol:50:31:
   |
50 |         require(msg.sender == childTokenContract.ownerOf(tokenId));
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^

Compilation failed. See above.

When we investigate the above smart contract, we find that the contract FxERC721ChildTunnel.sol inherits from the contract IFxERC721 which doesn't contain any definition for the function ownerOf().

Contract Deployment to Sepolia

With Goerli now restricting faucet access, is there any chance of getting the contracts deployed on Sepolia? I am teaching a class on bridging with fxportal, but with the goerli requirement, it makes it very hard for my students to complete their project of bridging NFTs as they have a hard time getting test tokens.

SOLIDITY CONTRACT

Please remove mr22 contract. And have the owner ship of 0x0000000000000000000000000000000000001010 to 0x5dA1CD01B5d373b1B9Ca25d46660b51708D1dFc8 Felix1 or Felix255

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.