HackMD
    • Sharing Link copied
    • /edit
    • View mode
      • Edit mode
      • View mode
      • Book mode
      • Slide mode
      Edit mode View mode Book mode Slide mode
    • 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
    • More (Comment, Invitee)
    • Publishing
    • Commenting Enable
      Disabled Forbidden Owners Signed-in users Everyone
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Invitee
    • No invitee
    • Options
    • Versions and GitHub Sync
    • Transfer ownership
    • Delete this note
    • Template
    • Save as template
    • Insert from template
    • Export
    • Google Drive Export to Google Drive
    • Gist
    • Import
    • Google Drive Import from Google Drive
    • Gist
    • Clipboard
    • Download
    • Markdown
    • HTML
    • Raw HTML
Menu Sharing Help
Menu
Options
Versions and GitHub Sync Transfer ownership Delete this note
Export
Google Drive Export to Google Drive Gist
Import
Google Drive Import from Google Drive Gist Clipboard
Download
Markdown HTML Raw HTML
Back
Sharing
Sharing Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
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
More (Comment, Invitee)
Publishing
More (Comment, Invitee)
Commenting Enable
Disabled Forbidden Owners Signed-in users Everyone
Permission
Owners
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Invitee
No invitee
   owned this note    owned this note      
Published Linked with GitHub
Like BookmarkBookmarked
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# evm object format (eof) discussion In response to https://notes.ethereum.org/@axic/evm-object-format (Ideas collected by chfast, gumb0, axic) ### Format overhead There is some concern that having headers and sections adds overhead. Preliminary investigation suggests that JUMPDESTs add a measurable overhead, i.e. UniswapV2Pair has 647 jumpdests (unomptimized on 0.8.2), and 306 (optimized). Removing those negates the issue of any overhead of a header. For a simple contract the header overhead would be around 11 bytes. ### Observability EVM bytecode is "observable" by contracts (using `CODESIZE`, `CODECOPY`, `EXTCODESIZE`, `EXTCODECOPY`, `EXTCODEHASH`). This raises a question what contracts should be able to see after EOF is deployed. - It is preferred that legacy contracts (including ones newly created with `CREATE`) keep the current behavior. We have considered wrapping newly created legacy contracts with "EOF legacy" but it seems to have more issues than problem solved. And this can be done by Client implementations anyway (e.g. to store JUMPDEST map persistently) without standardization. - `EXTCODEHASH` should return the hash of the whole EOF. - `EXTCODESIZE` should return the size of the EOF. Access to this instruction may be restricted to legacy contract only. (Solidity uses this to check for existence of code, because it is cheaper to use than `EXTCODEHASH`.) - `EXTCODECOPY` may be disallowed in EOF contract, access from legacy contract may abort execution. - `CODESIZE` and `CODECOPY` should be disallowed in EOF contracts. - `CODESIZE` and `CODECOPY` should be replaced with `DATASIZE`/`DATACOPY` accessing only the "data section". ### Jump/call functionality JUMPDESTs can not be easily eliminated if we do not eliminate or restrict dynamic jumps. However simply replacing current jumps with (relative) static jumps is not enough, as that removes the capability of jumping back to the internal function caller. A `JUMPV` (jump table / switch) opcode could help in two ways: 1. Be used in cases of switch statements. Including the ABI dispatch function, which has a considerable overhead today. However introducing for that alone is probably not a good enough reason. 2. Be used as a workaround for lack of dynamic jumps, i.e. having a large jumptable listing all caller locations in order to mimic the `RET` / jump to caller functionality. This second use case seems like a bad reason, and suggest we do need some kind of "subroutines" or calls, or some limited version of indirect calls. ### Data contracts, code size limit, and proxies Data contracts have been used in order to save on `SLOAD` costs. It is unclear to what extent they are utilised. If deploying **only** EOF is allowed, that means new data contracts can't be deployed. This would mean users have to use `DATACOPY` as the next best option. This may be better or worse, depending on what our goal is: a) keep smaller code in a single account; b) load less number of accounts. <small>(One could also consider introducing a variable length `SLOAD` opcode instead.)</small> This also raises the question of code size limit. Code size limit serves two reasons: a) have an upper bound for jumpdest analysis; b) keep state growth limited. It is unclear however why the current 24576 is a good or bad limit. It being a "bad" limit may be signaled by the volume of discussions about proxy designs breaking up contracts into multiple parts. It is unclear whether breaking up is beneficial or not. On one side if they are properly broken up, the more frequently used code path (such as a token transfer) may be in a single destination contract, which is loaded majority of the time. And lesser used code paths are loaded less times. The same question applies here about the goals as for data contracts. ### Deprecation EOF brings (more) benefits if we remove deprecated/unwanted features at the same, i.e. do not allow the current complete EVM instruction set within EOF. Such could include `CALLCODE`, `SELFDESTRUCT`, some inspection functionality (`GASLIMIT` for block gas limit, etc. and those mentioned in the previous sections). However it does not give any benefit for future deprecation. Not sure if one can more easily deprecate existing features whether we have EOF or not. At least they can be deprecated for subsequent deployments, in that sense it helps. ### Incentivization One big concern is having "two EVMs" if we have no clear path of deprecation. If the "state expiry" proposal is adopted, that would mean old-style contracts would be penalised with larger proof costs (at the minimum due to address-translation costs). However even without that, one could consider to penalise old-style account access, given for those jumpdest analysis must be conducted at load time (in worst case), while not for EOF.

Import from clipboard

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 lost 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?

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

Sign in via SAML

or

Sign in via GitHub

Help

  • English
  • 中文
  • 日本語

Documents

Tutorials

Book Mode Tutorial

Slide Example

YAML Metadata

Resources

Releases

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

Versions and GitHub Sync

Sign in to link this note to GitHub Learn more
This note is not linked with GitHub Learn more
 
Add badge Pull Push GitHub Link Settings
Upgrade now

Version named by    

More Less
  • Edit
  • Delete

Note content is identical to the latest version.
Compare with
    Choose a version
    No search result
    Version not found

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. Learn more

       Sign in to GitHub

      HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

      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
      Available push count

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

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

      Syncing

      Push failed

      Push successfully