-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
The fn create
and fn create2
are functions of Ethereum smart contracts that allow the creation of new smart contracts.
This is possible because the Inspector trait allows catching create operations, which can then be sent to the Linera runtime.
Now, the creation function in the ContractRuntime is
fn create_application(
&mut self,
module_id: ModuleId,
parameters: Vec<u8>,
argument: Vec<u8>,
required_application_ids: Vec<ApplicationId>,
) -> Result<ApplicationId, ExecutionError>;
So, in Linera the application needs first to be created with the blobs for contract/service and then the create_application
can create an ApplicationId
blob.
While the creation in the REVM is done with
fn create(&mut self, context: &mut CTX, inputs: &mut CreateInputs) -> Option<CreateOutcome> {
The inputs.init_code
contains the bytes of the bytecode and the constructor argument.
Therefore, for the implementation of the creation of contracts, we need to
- Be able from a blob from a contract. This is issue Allow applications to create data blobs. #3707.
- Be able to determine the size of the bytecode. What we have access to is the bytecode concatenated with the constructor argument, and it is unclear how to get the bytecode length.