Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Genesis: add an option to load account code from a file #4774

Closed
axic opened this issue Jan 16, 2018 · 10 comments
Closed

Genesis: add an option to load account code from a file #4774

axic opened this issue Jan 16, 2018 · 10 comments
Assignees
Labels

Comments

@axic
Copy link
Member

axic commented Jan 16, 2018

e.g.

  "accounts": {
    "0000000000000000000000000000000000000001": { "codeFromFile": "/path/to/ecrecover.wasm" }
  }
@axic
Copy link
Member Author

axic commented Jan 16, 2018

@chfast @gumb0 what do you think?

@axic axic mentioned this issue Jan 16, 2018
44 tasks
@winsvega
Copy link
Contributor

winsvega commented Jan 16, 2018

so the "code" : "0x0001" should work directly from json file.
I guess we could just add a syntax to parse the code if it contains link to a file.

but speaking of wasm first there should be a support for wasm code
#4754

@axic
Copy link
Member Author

axic commented Jan 16, 2018

This only cares about filling the account code with raw data, whatever that data is. Nothing in the genesis should be processed or compiled afterwards.

The above feature isn't good only for ewasm, but for example the blockhash EVM bytecode could be placed there too.

@chfast
Copy link
Member

chfast commented Jan 16, 2018

The .wasm files in the example contain a bytecode already. No compilation is needed here.

I'm just worried about using relative paths in the JSON file...

@gumb0
Copy link
Member

gumb0 commented Jan 16, 2018

Maybe just require all code files to be in the same dir as json? and codeFromFile will have only the name

@winsvega
Copy link
Contributor

hm. yes this sounds like a nice feauture.

in the same dir might become with too many files. a subdir would be reasonable

@chfast
Copy link
Member

chfast commented Jan 16, 2018

I can make the relative paths to work relatively to the config.json file. But we also use string literals for config :)

@axic
Copy link
Member Author

axic commented Jan 16, 2018

I think another decision to be made is whether the file referenced should have:

  • binary code
  • hex string
  • hex string prefixed 0x

@winsvega
Copy link
Contributor

the function importCode deals with hex and prefixed hex.

@axic
Copy link
Member Author

axic commented Jan 16, 2018

I don't think importCode from testeth is relevant here?

I would personally prefer to take the file as binary but considering all tools output EVM bytecode as hexadecimal (without the 0x prefix) probably that is the most sane choice.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants