Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

delegatecall/callcode implementation #10566

Closed
yarikbratashchuk opened this issue Dec 28, 2021 · 0 comments · Fixed by #10617
Closed

delegatecall/callcode implementation #10566

yarikbratashchuk opened this issue Dec 28, 2021 · 0 comments · Fixed by #10617
Labels
J0-enhancement An additional feature request.

Comments

@yarikbratashchuk
Copy link
Contributor

yarikbratashchuk commented Dec 28, 2021

This issue tracks the implementation of delegate call in pallet-contract.

Delegate call can be used to:

  • Create an upgradable contract via the Proxy pattern.
  • Implement some library that can be called via delegate call.
  • Split the logic of a big contract into small subcontracts.

There are different ways to implement delegated calls:

  • Use the existing seal_call function and create a new PRESERVE_CONTEXT flag in CallFlags(possible implementation).
  • Create a new seal_delegate_call with its own signature.
fn delegate_call(
    flags: CallFlags,  <------ The user can copy or forward input
    code_hash_ptr: u32, 
    input_data_ptr: u32,
    input_data_len: u32,
) -> Result<ExecReturnValue, ExecError>

This way we can keep API clean.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants