LayerZero-Labs / LayerZero

An Omnichain Interoperability Protocol
Other
1.95k stars 1.25k forks source link

Enhancing the current UA configuration #45

Open lightning-li opened 9 months ago

lightning-li commented 9 months ago

Description:

I've identified a potential improvement in the way cross-chain messages are managed between two chains, referred to as chainA and chainB, and their respective userApplication (ua) contracts, uaA on chainA and uaB on chainB.

Current Behavior:

When uaA sends a cross-chain message to uaB, it retrieves the relayer and oracle configuration for chainB from appConfig[uaA][chainB]. Let's assume the addresses are relayerA and oracleA. The fees for this operation are sent to relayerA and oracleA. Upon execution of this cross-chain message on chainB, the system looks up appConfig[uaB][chainA] to confirm the configuration of relayerB and oracleB, ensuring the correct entities are relaying the message. Similarly, when uaB initiates a cross-chain message to uaA:

It checks appConfig[uaB][chainA] for relayerB and oracleB's addresses, directing the fees to these addresses. Upon execution on chainA, appConfig[uaA][chainB] is consulted to verify relayerA and oracleA's involvement. Issue: There seems to be an inconsistency. When uaA sends a message to uaB (chainA to chainB), relayerB and oracleB contribute to relaying and verifying the message, yet the fees are directed to relayerA and oracleA, and vice versa for messages from uaB to uaA.

Suggested Improvement:

To add flexibility and ensure the correct entities receive the fees for their services, I propose adding an extra key to the appConfig mapping: appConfig[sourceUa][destChainId][destUa]. This change should allow the system to directly associate fees with the relayers and oracles actually involved in a specific cross-chain transaction.

When uaA sends a cross-chain message to uaB, it retrieves the relayer and oracle configuration for chainB from appConfig[uaA][chainB][uaB] to get the addresses. Upon execution of this cross-chain message on chainA, the system looks up appConfig[uaB][chainB][uaA] to get the relayer and oracle addresses.

Question:

Is my understanding correct that this proposed change would improve the fee distribution and overall flexibility of the cross-chain message handling?

royalking14 commented 6 months ago

cross chain not fixed till fess also high slip page