William Villanueva
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# x-shard/meta-ee discussion For background, read the following: Writeup: https://ethresear.ch/t/an-even-simpler-meta-execution-environment-for-eth/6704/2 Casey’s Simple Explainer Doc: https://notes.ethereum.org/fkPBDSV_QiSePrrk5u-0Qg ## Example 2 normal EEs, 1 meta EE, 2 Shards For simplification, lets define our block body as follows: ``` ShardBlock { shard: u32, transactions: Vec<ShardTransaction>, } ShardTransaction { data: Vec<u8>, ee_index: u32, } ``` ### Outgoing X-Shard In this example, EE0 sends eth from shard 0 to EE0 on shard 1. EE1 also sends eth from shard 0 to EE1 on shard 1. The example drastically simplifies things, but is a good exercise for determining the end-to-end process. This EE does not have users and we are ignoring the user perspective. Current EE0 Matrix: ``` [3 , 0] [0 , 0] ``` Current EE1 Matrix: ``` [3 , 0] [0 , 0] ``` Transaction for EE0: ``` ShardTransaction { data: [{ amount: 1eth, shard: 1, }], ee_index: 0, } ``` Transaction for EE1: ``` ShardTransaction { data: [{ amount: 1eth, shard: 1, }], ee_index: 1, } ``` So far, our block looks like this: ``` ShardBlock { shard: 0, transactions: [ ShardTransaction { data: [{ amount: 1eth, shard: 1, }], ee_index: 0, }, ShardTransaction { data: [{ amount: 1eth, shard: 1, }], ee_index: 1, }, ], } ``` The above describes the inputs. Next, we need to show how the aux outputs may work. In order to accomplish this, we need to define a receipt-printing host function. Let's assume that EE execution is ordered, i.e. that ShardTransaction blocks are processed sequentially. Any EE that wants to create an output to be later on consumed by the Meta-EE has to have access to a host function to do so. `print_output(Vec<u8>)` The host function would take the byte array, add the sender ee_id to it and write it to a temporary buffer. For the sake of our simplified example we will assume that the arbitrary byte output conforms to the following structure: ``` Output { ee_id: u32, data: vec<u8>, } ``` For illustrtion, lets give the data a structure: ``` data { shard_id: u32, amount: u64, } ``` After the two ShardTransaction blocks ran, the temporary buffer would look like: ``` [ Output { ee_id: 0, data { shard_id: 1, amount: 1, }, }, Output { ee_id: 1, data { shard_id: 1, amount: 1, }, } ] ``` The Meta-EE would then run as the last transaction of the block. An example would be: ``` ShardTransaction { data { multiproof: ..., ee_ids: [u32], }, ee_index: 2, } ``` The Meta-EE would have to have access to a host function to get the outputs created by any specific EE, which we call `get_outputs(ee_id)` With this, an example for a Meta-EE could look like: ``` def main(multiproof, ee_ids): load_multiproof(multiproof) for ee_id in ee_ids: outputs = get_outputs(ee_id) for output in outputs: if get_balance(ee_id) < output.data.amount: continue reduce_balance(ee_id, output.data.amount) increase_shard_balance(ee_id, output.data.shard_id, output.data.amount) ``` After processing the first output, EE0's matrix would look like this: ``` [2 , 1] (the Meta-EE only has this row) [0 , 0] ``` Similarly, after processing the second output, EE1's matrix would look like this: ``` [2 , 1] (the Meta-EE only has this row) [0 , 0] ``` Open Questions: * How is the block proposer incentivized or forced to include the Meta-EE part into the block? * Who pays for the Meta-EE execution? * What happens if the block proposer instead decides to pack the block with transactions of other EEs and there is not enough room for the Meta-EE? This means outputs/receipts need to be referenced via a proof later on. * Doesn't this already mimic enshrined behavior - why not just enshrine it? * EE upgradeability has a number of issues and is not as simple as expected (a post/writeup on this soon) ## User Level Eth Transfers ### Cross-Shard In example above, auxiliary output would now need an extra field, `data_root`. ``` Output { ee_id: 0, data { shard_id: 1, amount: 1, data_root: H256, }, }, ``` This additional field gives details on the actual account transfers aka receipt trie. As an oversimplified example, the leaves could be as follows: ``` Receipt { from: Address, to: Address, amount: u64, call_data: vec<u8>, } ``` We now run into the same problem we had before, we need either a nonce/bitfield mechanism to manage protection against double-spends. ### Cross-EE Cross-EE scenarios are practically identical to the cross-shard example. The major difference is that there needs to be a messaging standard for the receipt leaves or trie. As an example: EE0 defines its Receipt as: ``` Receipt { from: Address, to: Address, total: u64, call_data: vec<u8>, } ``` EE1 defines its Receipt as: ``` Receipt { from: Address, to: Address, amount: u64, call_data: vec<u8>, } ``` These receipts are not compatible with each other and carry different syntax or keys. What happens if we want to upgrade a messaging standard/format? Maybe certain EEs offer priveleges to be called into? Additionally, we also need a way to terminate reading receipts once the aggregate amount exceeds the amount passed through the meta-EE. For example, meta-ee output is: ``` Output { ee_id: 0, data { shard_id: 1, ee_id: 1, amount: 3, data_root: H256, }, }, ``` Where the trie's leaves corresponding to the `data_root` are as follows: ``` [ Receipt { from: Address, to: Address, amount: 2, call_data: vec<u8>, }, Receipt { from: Address, to: Address, amount: 2, call_data: vec<u8>, } ] ``` You'll notice the aggregate total from the leaves send 4 eth while the meta-EE outputs only 3 eth. The above are just a few examples of issues that may occur due to faulty EEs or EEs that follow different messaging standards. ## Upgradeability We are choosing to pursue a meta-EE because we argue that moving upgradeability away from the core protocol is a major benefit. However, what does upgradeability even look like? It appears the meta-ee will likely need enshrined behavior, so doesn't this further complicate its upgrade path? ## VHEE There exists an EE which holds balances for standardized accounts. It receives privileged behaviors (EEs can call synchronously into it). Validator accounts deposit into VHEE via a receipt as described in Vitalik's proposal: ``` { "validator_index": uint64, "target": uint64, "data": bytes "pubkey": BLSPubkey, "signature": BLSSignature } ``` The actual VHEE stores funds in 2 dimensions, `(shard, ee_id)`. EEs can call directly into their `(shard, ee_id)` pair and make whatever updates they want to the portion of the trie associated with the same ee_id. In order to transfer funds between `ee_id`s, user can submit a direct transaction to the VHEE. Alternatively, we can support the netting style scheme for an integrated VHEE/meta-execution EE. Essentially, this standardizes the account model across EEs (which makes things like fee markets, etc. easier). But comes with the caveat of a less flexible system. Could use P2SH scheme as mentioned by Dankrad, but does not work properly in a pull model (as it would make multiproofs between EEs reliant on each other) ## Synchronous Cross-EE communication In a world where EEs can communicate synchronously with each other, concepts such as a VHEE simplify the system overall. EEs can also read and write directly to each other. The main issue with synchronous calls between EEs is on the state provider side. Here are three ways to accomplish this: ### Restricting dynamic state access (direct push model) The direct push model could support complete synchronous communication between all EEs if we support an SSA model. ### Sequential Pull Model Does not provide complete synchronous communication between all EEs. EEs executed later in a block may directly access the output of EEs executed earlier in a block. The BP in the pull model would have to acquire multiproofs for each EE in an ordered, sequential manner. ### State Providers Hold all State Provides complete synchronous communication as in the direct push model. State providers are assumed to hold state for all EEs. Pull model or Relayed Push model could work. This particular approach is interesting, and if we assume state providers hold all the shard state, then it seems appropriate? ### Library Method EE primitives (authenticated proof model, memory backend, etc.) are deployed on the beacon chain. When deploying an EE, you can reference these primitives. State providers are assumed to hold state for all EEs that share similar sets of primitives (proof, memory and cross-ee communication libraries).

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully