-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LSP1] Gas Limit for Universal Receivers #242
Comments
SolutionA viable solution to the high gas consumption challenge posed by the ExampleConsider a scenario: User A wishes to transfer a token to User B. If User A's off-chain client (e.g., a browser extension or mobile app) detects that User B's universalReceiver function consumes an exorbitant amount of gas, User A can be prompted with a warning. This warning would inform User A of the high gas costs associated with the transaction and seek confirmation on whether they wish to proceed. In this setup, User B stands at a disadvantage if their universalReceiver function is gas-intensive, as they are the primary beneficiary of the token transfer. If User A decides against the transfer due to high gas costs, User B misses out. It's essential to recognize that some solutions, like hardcoding a gas limit for the universalReceiver function, may not be feasible. Such restrictions could stifle potential use cases that require higher gas amounts. Moreover, with the evolving landscape of blockchain scalability, it's uncertain what future functionalities the universalReceiver might encompass. Imposing restrictive measures could inadvertently limit its potential. Several alternative solutions exist: Gas Reimbursement: The recipient's universalReceiver function could be designed to reimburse the gas costs. If it doesn't, the sender might opt not to proceed with the transaction. Delegated Execution: The sender could sign a message, allowing the intended recipient to execute the action. This way, the recipient bears the gas costs and any additional load their universalReceiver function might introduce. In essence, leveraging off-chain clients to provide users with real-time feedback on potential gas costs, combined with the power of social consensus, can offer a practical solution to this challenge.
|
A bit of background on the issue as well for history. The initially thoughts before coming to these conclusions were to think of making the call to the LSP1 Delegate contract capped, while not reverting the whole transaction if the cap is reached. There was also the need to assess what would be the behaviour in an implementation code if a fixed amount of gas is forwarded, but the LSP1 Delegate on the sender + receiver end reverts. |
Gas Limit for Universal Receivers
Problem
A primary concern for individuals interacting with contracts utilizing the LSP1
universalReceiver(..)
function is the potential for significant gas consumption on the contract being notified. In such scenarios, the transaction initiator (referenced bytx.origin
) bears the high gas fees due to the logic executed in the notified contract.Example
To illustrate, consider a scenario where a user transfers a token. The token contract, in turn, notifies the recipient via the
universalReceiver(..)
function. If this function contains complex logic, it could result in substantial gas consumption, forcing the sender to pay very high transaction fees.How this problem is supposed to be solved ?
The text was updated successfully, but these errors were encountered: