Principles

Principles to get to end-game state and win

Chain agnostic & account abstraction

System SHOULD NOT care on which chain you are. You SHOULD have the same result using system from any chain. Perfect state of the system is full abstraction for user to create seamless cross-chain interactions to make User not care about changing networks in MetaMask or any other wallet.

Permissionless

anybody can stake, create strategy or solver

LayerZero

Should implement best practices from LayerZero:

Instant Finality Guarantee (IFG)

Reverting in UA is cumbersome and expensive. It is more efficient to design your UA with IFG such that if a transaction was accepted at source, the transaction will be accepted at the remote. For example, Stargate has a credit management system (Delta Algorithm) to guarantee that if a swap was accepted at source, the destination must have enough asset to complete the swap, hence the IFG.

Tracking the Nonce

It is important for UA to keep track of their own nonce (e.g. by events) to correlate the send and receive side transactions. UA at send() side can query the nonce at endpoint.getOutboundNonce interface, and in lzReceive() the inboundNonce is in the arguments.

Store Failed Messages

If the message execution fails at the destination, try-catch, and store it for future retry. From LayerZero's perspective, the message has been delivered. It is much cheaper and easier for your programs to recover from the last state at the destination chain.Store a hash of the message payload is much cheaper than storing the whole message.

Gas for Message Types

If your app includes multiple message types to be sent across chains, compute a rough gas estimate at the destination chain per each message type. Your message may fail for the out-of-gas exception at the destination if your app did not instruct the relayer to put extra gas on contract execution. And the UA should enforce the gas estimate on-chain at the source chain to prevent users from inputting too low the value for gas.

Last updated