Pre-PIP #3: Cross Chain Request feature in Push Smart Contracts v3

Pre-PIP: 3

Author: Zaryab Afser

Discussions: Not Applicable

Created: 30th July 2024

Simple Summary

Pre-PIP 3 is a proposal to implement the Cross Chain Requests feature in Push Protocol smart contracts (i.e., PushCore and PushComm). Once enabled this feature shall allow users to interact with Push Core smart contract on the Ethereum chain, from any EVM or Non-EVM chain of their choice ( without leaving their favorite chain).

Abstract

Cross Chain Requests ( CCR) feature shall be one of the most significant features of Push Smart Contracts as it will enable users to perform important actions like channel creation, creation of Incentivized Chat requests, or any arbitrary request from the chain of their choice.

In other words, users would no longer need to switch their network to Ethereum to interact with the Push Core contract. Instead, they can remain on their favorite chains and still be able to interact with the Core contract seamlessly and perform the required actions.

Motivation

Push Smart Contracts are currently designed in the following way:

  1. Push Core Contract:
    1. Deployed only on Ethereum.
    2. The main contract handles all the imperative features like channel creation, incentivization mechanisms like staking, channel state changes, incentivized chat request functionalities, etc.
    3. Apart from features, the Push Core contract also includes the Protocol Fee Pool which stores the fees earned by the core smart contract via different actions. These fees are then used to incentivize token holders.
  2. Push Communicator(Comm) Contract:
    1. Deployed on multiple EVM chains, this is a lightweight contract that primarily handles sendNotification features as well as channel alias-related functionalities.
      It’s noteworthy how all imperative functionalities that a user or other web3 protocol might require to interact with Push Smart Contracts are included in the Push Core contract which is only deployed on the Ethereum chain.

The problem here is quite clear as the user must switch to the Ethereum network for any interaction they would want to do with the Push Core contract.

This leads to a bad user experience for existing or new users who want to interact with the Push Core contract. This strict requirement to only use one specific network is cumbersome, particularly for users who primarily operate on other EVM-compatible chains or even Non-EVM users.

Additionally, this acts as a barrier to Push Protocol as well.

The reliance on Ethereum exclusively limits the Push Protocol’s ability to tap into other chains and help solve the communication/notification issues of those chains adequately. This constraint hinders the protocol from reaching a broader audience and solving communication issues across diverse blockchain environments.

Therefore, by enabling a cross-chain request feature, Push Protocol can primarily significantly enhance the UX for average users as well as channel creators/managers from not just Ethereum but multiple other EVM/Non-EVM chains as well. It also allows the protocol to expand its market reach, attract users from different chains, and foster a more interconnected blockchain ecosystem.

Specification

Overview

The core idea of Cross Chain request feature is to make Push smart contracts capable of handling requests that can originate from any chain and are securely relayed to Push Core contracts on Ethereum for necessary validations & state changes.

As previously mentioned, the Push Comm smart contract was designed to be a lightweight and stand-alone smart contract that can be deployed on multiple chains quite easily.

This is an added advantage that we already have which reduces the complexity of implementing Cross Chain Request features being proposed in this Pre-PIP. Since Push Comm is already deployed on multiple EVM-compatible chains ( and soon non-EVM chains), it already resolves the first concern of expanding the smart contracts to multiple chains.

The next step would be the implementation of the Cross Chain Request feature in already existing Push Comm contracts.

This means the following changes in the existing smart contracts:

Push Communicator contract can be upgraded to implement cross-chain features that allow it to perform the following actions:

- Receive a msg payload from users on any chain.
- Securely relay this message to Push Core Contract on Ethereum

Push Core would require some modifications as well. These modifications would specifically allow Push Core contract to perform the following actions:

- Receive relayed messages or tokens from Push Comm
- Validate the incoming message payloads
- Update states in Core Contract.

How exactly can we bridge tokens and messages?

To achieve this feature, we currently propose using Wormhole’s NTT architecture and Relayers, this might change in the future as new features of Push get realized.

This will allow us to securely bridge arbitrary message payloads as well as tokens from one chain to another allowing us to relay any important requests like channel creations from any chain to Push Core on Ethereum.

In the next sections, it should be clear why these design choices are being proposed for the CCR feature.

Before that, let’s visualize how this entire flow would work with the help of a quick example of BOB creating a channel on Push Core via the CCR feature:

Complete flow of CCR:

  1. Bob is a native Polygon user and has a Polygon-PUSH token in his wallet. He wants to create a channel and start sending notifications.
  2. Instead of bridging $PUSH tokens from Polygon to Ethereum and changing the network, the points BOB to the already existing Push Communicator contract on Polygon.
  3. With the Cross Chain Request feature enabled, the Push Comm contract has a function called createChannel()
  4. BOB calls this function and provides the details of his channel, i.e., channel’s name, description, type, etc.
  5. Channel creation also requires 50 PUSH, so BOB also approves 50 PUSH tokens to be used by Push Comm.
  6. Along with this 50 PUSH, the on-chain transaction also uses some native tokens ( i.e., MATIC, , in this case,) for the transaction to be submitted. It should be noted that any unused MATIC shall be refunded to BOB.
  7. Once the transaction is submitted, the _createChannel() function on Push Comm shall perform the following actions:
    1. Validates the provided input and token value by BOB is valid.
    2. Create a payload of the provided input. ( this payload will be bridged to Core )
    3. Then, use Wormhole Relayers to relay the arbitrary data( payload containing details about the channel being created) to Push Core on Ethereum.
    4. Then, use Wormhole’s NTT framework to bridge the 50 PUSH tokens from Push Comm ( polygon ) to Push Core ( eth ).
  8. The completion of this step shall indicate that BOB’s request to create a channel has been successfully accepted and relayed to the Push Core contract.
  9. The last step required is for the Push Core contract to be able to handle this incoming cross-chain request.
  10. Once Wormhole relayers bridge the tokens and message payload to the Push Core on Ethereum, the Core contract performs the following actions:
    1. Decodes the incoming payload.
    2. Checks and validates the type of request contained by the payload, i.e., channel creation request in this case.
    3. Then use the payload data to call the actual _createChannel() function on Push Core, updates the state of the Core contract and thus, successfully completes the request from BOB.

As this transaction gets executed, BOB ends up having a channel successfully created on Push Core on Ethereum without ever having to leave the Polygon chain.

Here is a simple diagram to visualize how cross-chain features would look like:

Rationale

To understand the rationale behind the proposed implementation above, we must acknowledge that Push Smart Contracts are already live on Ethereum as well as many other L2s. Therefore this feature must be implemented keeping two crucial points in mind:

  • it should be implemented with minimal changes in the existing architecture,
  • It should be implemented with a security-first approach and keeping best practices in mind.

A simple solution to solving this would have been to deploy the Push Core contract on multiple chains so that users could easily interact with the Core contract without changing their network to Ethereum.

Let’s understand each one individually.

  1. Why not deploy Push Core on multiple chains?

    A simple solution to resolve this would have been to deploy the Push Core contract on multiple chains so that users could easily interact with the Core contract without changing their network to Ethereum.

    While it does sound simple it isn’t really.

    Multiple deployments of Push Core contracts indicate multiple fee pools on various chains which keeps increasing as Push starts to support more chains.

    This leads to an extremely difficult scenario of handling and syncing up multiple fee pools between all different chains. This will eventually affect the incentivization framework for token holders as well since it’s tied to the fee pool of the Push Core contract.

    In a nutshell, deploying multiple Push Core on different chains to achieve this feature is not ideal as it leads to significant modifications in the existing architecture, thereby making this implementation quite complex, less secure, and time-consuming.

  2. Why modify the Push Communicator contract?

    Now that we understand why Push Core on multiple chains is a bad idea, it’s easier to understand why Push Communicator is the right way to go.

    As previously mentioned, the Push Communicator contract has the added advantage of being already available on multiple chains due to its design. This makes it quite easy to implement and expand this feature to multiple chains.

    Secondly, this allows us to not make significant changes in the existing architecture of Push smart contracts, hence more secure, reliable, and faster.

  3. Why use Wormhole NTT framework & Relayers for Cross Chain Feature?

    After a thorough research on all existing arbitrary messages & token bridging protocols, we realized Wormhole fits best for our requirements.

    Mentioned below are some of the important reasons:

    1. Wormhole’s NTT Framework for Token Bridging:
      • Wormhole’s NTT framework is best suited for us as it allows us to use our existing Push Token with its framework seamlessly.
      • Most importantly, with NTT we will be able to retain ownership, upgrade authority, and customizability over our token as the NTT framework can integrate with any token contract or standard and any protocol governance processes.
    2. Support for EVM & Non-EVM Chains:
      • The Push Communicator contract is essentially designed to be deployed on all chains.
      • Wormhole’s wide range of support for EVM/Non-EVM chains aligns very well with the eventual vision of Push Communicator contracts.
    3. Secure and Battle-Test bridging network:
      • Since security is of utmost importance to us, we believe Wormhole is a battle-tested network for relaying tokens or arbitrary messages between chains.

Implementation

To support this Cross Chain Request feature, we foresee the following crucial developments in our existing architecture:

  1. Enabling Push Token for Multi-Chain Support,
  2. Building Cross-Chain Support in Push Communicator, and
  3. Building Cross-Chain Support in Push Core Contract.

Note: The only external libraries needed for this feature would be Wormhole’s Relayer Interface and NTT framework support

Let’s understand the implementation at each level.

  1. Enabling Cross Chain support for Push Token

    As mentioned above, this feature would require Wormhole’s Native Token Transfer (NTT) framework which means the $PUSH Token must be able to support the NTT-related features.

    To achieve this the following steps are required:

    • Develop a $PUSH Token for NTT Support:
      • This will ensure that the $PUSH token on different chains is capable of supporting Wormhole’s NTT framework.
    • Deployment of NTT-supported $PUSH Token:
      • Once the NTT Wrapped $PUSH Token is developed, it shall be deployed and activated on other chains.
      • This ensures that PUSH Comm will be able to handle cross-chain token transfers using this $PUSH token on any chain, once deployed.

    Note: It must be noted that since Wormhole’s NTT framework will be used for token transfers, $PUSH token shall be completely owned and governed on any specific chain natively by Push Community, as it is currently done for the Ethereum chain.

  2. Building Cross-Chain Support in Push Communicator:

    The second step would be to build the necessary functionalities in the Push Communicator smart contract.

    Push Communicator contract will be able to support functionalities that allow users to perform imperative actions like channel creations, channel modification, creation of chat requests, or creation of any arbitrary request on Push Core contract on Ethereum.

    These functions will mainly perform the following actions:

    • Collection of Payload ( message payload and/or token value ):
      • The first step allows users to pass the payload which could be token value or messages ( or both together ) that must be bridged to the Push Core contract to trigger a specific action.
      • For instance: passing 50 push and channel details as payload to create a channel on Push Core on the Ethereum chain
    • Validation of Payload:
      • This includes validating the payload on the contract level to ensure the data being passed is accurate.
    • Relaying of Payload:
      • Once validated, the final step is to bridge this payload to the Push Core contract securely.
      • It must be noted that these functions will be able to bridge/relay both token value as well as arbitrary message data, based on the requirement of the function being called.
      • For Token Bridging: The Push Comm shall rely on Wormhole’s NTT framework for any token value transfer.
      • For Arbitrary Message Bridging: The Push Comm shall rely on Wormhole’s Relayer interface and use its sendPayloadToEvm() function for the same.
  3. Building Cross-Chain Support in Push Core Contract

    While most of the development shall be required in Push Communicator contract, Push Core also needs to be capable of handling the incoming requests from different chains.

    Therefore the main implementation required in Push Core contract would be:

    1. Inclusion of receiveWormholeMessages():
      1. This is a required function for the Core contract to be able to receive, decode as well as process the incoming payloads.
      2. Processing the incoming payloads indicates that this function shall route the payload according to the request type. For instance, if a payload is sent to create a new channel, the function must correctly identify this payload type and then trigger the _createChannel() function in the contract with the accurate data from the payload.
    2. Adjustments in existing functionalities:
      1. Additionally, the core contract also needs to include modifications in the existing functions to ensure they are compatible for handling cross-chain requests.
      2. This means ensuring that the functions are updated to handle not just the simple calls from the Ethereum chain but also from multiple other chains. This could involve updating arguments, validation logic, etc.
  4. Final Stages of CCR Feature

    Once the core architecture for CCR is complete, we shall proceed with the following final actions:

    1. Test cases that cover all CCR-related feature
    2. Security Audits for modified smart contracts
    3. Deployment and Upgrade of testnet and mainnet contracts.

Here are the requests for all the community members:

  1. Share your thoughts and ask as many questions as you wish to on this PRE-PIP
  2. Use the poll below to express your thoughts on Pre-PIP 3:
  • For
  • Against
0 voters
7 Likes

Huge for the future of Push on a technical level.

Fully behind this.

3 Likes

good to know, feel free to ask questions or share feedbacks if you have any. Thanks

2 Likes

@NooberBoy @wolfcito Very interested to know what you think of the above

2 Likes

Just Wooow woow woow @zaryab2000,

Thank you for sharing the proposal for the Cross Chain Requests (CCR) feature. I am excited about the potential improvements it can bring to Push Protocol.

I have voted FOR this proposal and fully support it. I look forward to seeing it in action. I really appreciate that it will:

  1. Improve User Experience: Users can interact with Push Core on Ethereum from any chain without switching networks. This will make it much easier and more convenient for them.

  2. Widen Our Reach: By supporting both EVM and non-EVM chains, we can attract more users and expand our community.

  3. Ensure Security and Simplicity: The use of Wormhole’s NTT framework and relayers ensures a secure and efficient way to handle cross-chain requests.

The implementation plan is well thought out, from enabling cross-chain support for the $PUSH token to updating the Push Communicator and Push Core contracts. Just can’t wait for the update.

2 Likes

I also want to extend my heartfelt thanks to the DAO council members (@EC3, @SixtyKeys, @Carlaupgrade and @Rene) and everyone involved in bringing forward the proposal for the Cross Chain Requests (CCR) feature. Great work guys.

Let’s Keep Pushing!

3 Likes

thanks, more update coming soon. @NooberBoy

2 Likes

Hey @zaryab2000, thank you for the extremely well-detailed and thought-out proposal :fire: Great to see Pre-PIP #3 on the forum.

LFG!!! This is the killer Push Protocol feature we have all been waiting for. The future is multichain/cross-chain, and this update will truly make Push Protocol the native web3 communications network :purple_heart::bell: I know Push was founded as EPNS, and we all love and adore Ethereum, but it is truly a monumental step to see the growth beyond Ethereum.

I fully agree with this. Communications should not be limited by chain and should be fully chain agnostic so that many more users can be activated with this change. We could tap into 100s of new partners following the implementation of Cross Chain Requests.

Historically, bridging has been a painfully long process. Is there any word on how we plan to mitigate this to ensure that users can create channels and receive notifications in a timely manner?

Will this require the migration of the current PUSH token contract to a new one?

1 Like

@zaryab2000 your analysis is very comprehensive and well-structured.

Here is a more detailed breakdown and some additional recommendations on the points you have mentioned:

Positive Aspects

  • Use of Wormhole
    :white_check_mark: Technical Viability: Wormhole appears to be a solid option for cross-chain management, providing a proven infrastructure for message and token transfers.
    :white_check_mark: Modularity of Push Communicator: The modular structure allows for easy integration of cross-chain functionalities without significantly altering Push Core.

  • User Experience
    :white_check_mark: Cross-Chain Interactions: Allowing users to interact with Push Core from any chain improves accessibility and simplifies the process.

  • Expansion and Simplification
    :white_check_mark: Expansive Reach: The ability to expand to new chains without needing multiple instances of Push Core is a significant advantage.

Below are certain aspects that should be taken into consideration:

I’m not sure if it was just a mistake in writing the example, but I would like to clarify a detail in the example provided.

It mentions that there will be no precise knowledge of the fee to be used on the chain, as it indicates that the unused TOKEN will be refunded.

Uncertainty about fees: This could make it difficult for both the user and the system to accurately predict transaction costs, which could lead to a poor user experience if fees vary significantly.

Impact on user experience: The need to manage and refund TOKEN could complicate the process and create additional friction for the user

  • Additional Complexity
    • Wormhole Integration: The inherent complexity in integrating Wormhole can be challenging. It is crucial to ensure that all cross-chain interactions are secure and efficient.
    • State Synchronization: Synchronization and validation of messages between chains require rigorous attention to avoid inconsistencies and errors.
  • External Dependency
    • Wormhole Vulnerability: Dependence on Wormhole for secure transfers involves risks related to potential vulnerabilities in Wormhole’s infrastructure. It is important to monitor updates and changes in Wormhole.
  • Security Audits
    • Audit Recommendation: Conducting independent security audits is essential to identify vulnerabilities and ensure the implementation is secure.
  • Incentive Optimization
    • Incentive Model: Ensuring that the incentive model is not negatively impacted by the cross-chain implementation is key to maintaining token holder interest and system integrity.
  • Extensive Testing
    • Test Coverage: Implementing a comprehensive set of tests to cover possible scenarios is crucial to identify and fix issues before deployment.
  • Scalability
    • Impact on Scalability: Assessing how expansion to more chains will affect system scalability is important to ensure the system can handle increased transaction volumes.

Consideration for Deploying on L2:

At this point, I would like to add to the proposal that the deployment of the core contract on L2 be considered, as it would generate a positive impact on the ecosystem due to the inherent cost reduction.

Advantages:

  • Reduced Transaction Costs: L2 solutions offer lower fees, which can significantly reduce costs for users and the platform.
  • Increased Speed: Faster transactions improve user experience by reducing wait times.
  • Enhanced Scalability: Deploying on L2 can increase capacity to handle more transactions without congesting the main network.

Disadvantages:

  • Additional Complexity: Implementing and maintaining Push Core Contract on L2 adds extra complexity. Interoperability between L2 and L1 needs to be carefully managed.
  • Security Risks: While L2 solutions are generally secure, increased complexity may introduce new risks.

Suggestions for Improvement:

  • Evaluate L2 Usage: Conduct a thorough cost-benefit analysis to determine if the benefits of using L2 outweigh the drawbacks.
  • Improve Fee Management: Explore methods to make transaction fees more predictable and transparent for users, potentially through adjustments in reimbursement mechanisms.
  • Testing and Simulation: Perform extensive testing in a controlled environment to understand how L2 implementation affects the system.

In conclusion, the proposal has a solid foundation and offers significant improvements in user experience and expanded reach. However, addressing complexity and security challenges, as well as considering L2 deployment, is crucial to maximizing benefits and minimizing costs.

2 Likes

For a deeper dive on the above: join now :slight_smile: x.com

2 Likes

@zaryab2000 I have a couple of questions with regards to the economic mechanims of the protocol post CCR activation.

Q1:
Since CCR Prensents an opportunity to deploy NTT Wrapped $PUSH on any chain. How would the project’s tokenomics play out? Would it remain the same as present? 100M max supply / chain ?

Q2: Would the cost of creating a channel other chains (excluding Eth mainnet) remain the same?
Do you forsee any possibility to tweak the pricing for evm and non-evm chains differently?

2 Likes

not really, the PUSH token contract remain as is in this case. that’s why we chose the NTT framework of wormhole for now which allows us to be in complete control of the actual push token contract instead of some wrapped version of PUSH token.

1 Like

sure, these are good questions.

  1. The max supply remains as is. All we use is the Hub-and-spoke model of Wormhole to create new spokes of the PUSH token on multiple chains. and the entire process of bridging simply follow a lock-and-mint approach where tokens are locked on the source chain and minted at the destination. I will try to write a detailed doc on how this works in future soon.
  2. As we begin the development, we are aiming to optimise the cost of channel creation as much as possible in the CCR Feature. Additionally we have already made some tweaks in the existing channelCreation() which means the cost of channel creation has already reduced quite a bit gas-wise.
1 Like

So there are two questions here:

  1. First, regarding UNUSED TOKENS on Source chain ( lets say polygon):
  • The gas estimator functions will already be included in the smart contract using functions like quoteEVMDeliveryPrice() in Wormhole relayer contract interface.
  • This means the exact cost of bridging a payload can be calculated easily and there won’t be any uncertainty on that front.
  • The unused token part indicates that when sending this payload in comm ( which will be then bridged to core) , even if the user sends additional gas with it, those extra gas will be refunded back to the user. So this shall be more of an additional security layer on top.
  1. Regarding Core on L2:
  • While I agree that the solution of deploying Core on L2 sounds quite simple and a straight-forward path, the major concern is the Fee Pool.
  • The fact that every transaction that deposits some fees into core and then those fees are distributed among token holders - is an important aspect of core contract. Multiple core means multiple fee pools and to bring all those fee pools in sync ( which by the way will keep increasing as we expand on multiple chains) is extremely difficult and risky task.
    Although I am all ears to hear to any suggestion from community on how they think this can be achieved or point out any part that I am missing. happy to discuss more.
2 Likes

@zaryab2000 Perfect; that helps me with clarity, regarding the unused token refund, it sounds interesting and could be a useful additional layer of security.

As for the second point, I understand that the scenario is valid, but the suggestion was not to have multiple core contracts on different chains, but rather to migrate the existing core contract from L1 to an L2 to avoid the complication of managing multiple fee pools. This could simplify the process and reduce associated risks.

Loved the idea of CCR, I am bullish on it!

2 Likes