Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

smart contracts, first rfc! #396

Merged
merged 9 commits into from
Jun 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
aeyakovenko committed Jun 22, 2018
commit 33d5e8ac27611e2715f50776be5361fb98303eef
17 changes: 9 additions & 8 deletions rfcs/rfc-001-smart-contracts-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ The module_data structure is configued by the client, it contains the `struct so

A client will create a transaction to create a new loader instance:

`Solana_NewLoader(Loader instance PubKey, proof of key ownership, space I need for my elf)`
`Solana_NewLoader(Loader Instance PubKey, proof of key ownership, space I need for my elf)`

A client will then do a bunch of transactions to load its elf into the loader instance they created:

`Loader_UploadElf(Loader instance PubKey, proof of key ownership, pos start, pos end, data)`
`Loader_UploadElf(Loader Instance PubKey, proof of key ownership, pos start, pos end, data)`

`Loader_NewInstance(Loader instance PubKey, proof of key ownership, Instance PubKey, proof of key owndership)`
At this point the client can create a new instance of the module with its own instance address:

A client will then do a bunch of transactions to load its elf into the loader instance they created:
`Loader_NewInstance(Loader Instance PubKey, proof of key ownership, Instance PubKey, proof of key ownership)`

Once the instance has been created, the client may need to upload more user data to solana to configure this instance:

`Instance_UploadModuleData(Instance PubKey, proof of key ownership, pos start, pos end, data)`

Expand All @@ -98,11 +100,9 @@ struct module_hdr {
};
```

At this point the client may need to upload more R user data to the OS via some more transactions to the loader:

`Instance_Start(Instance PubKey, proof of key owndership)`
Now clients can `start` the instance and send it transactions:

At this point clients can start sending transactions to the instance
`Instance_Start(Instance PubKey, proof of key ownership)`

## Parallelizable Runtime

Expand All @@ -122,6 +122,7 @@ void map(const struct module_data *module_data, struct transaction* tx, uint8_t
{
//msg.userdata is a network protocol defined fixed size that is an input from the user via the transaction
tx->favorite = tx->msg.userdata[0];
//collect marks this transaction as accepted into the contract, if this is never called, the transaction is dropped
collect(&tx->hdr);
}
```
Expand Down