Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: ewasm support #16957

Closed
wants to merge 23 commits into from
Closed

core: ewasm support #16957

wants to merge 23 commits into from

Conversation

gballet
Copy link
Member

@gballet gballet commented Jun 12, 2018

This PR implements eWASM contracts based on github.com/go-interpreter/wagon.

@gballet gballet requested review from holiman and karalabe as code owners June 12, 2018 10:23
@gballet
Copy link
Member Author

gballet commented Jun 12, 2018

The EEI functions require access to the module's memory. This is handled by go-interpreter/wagon#59 which is currently heavily discussed.

@GitCop
Copy link

GitCop commented Jun 19, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

3 similar comments
@GitCop
Copy link

GitCop commented Jun 19, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Jun 19, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Jun 20, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Jun 21, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Jun 21, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

1 similar comment
@GitCop
Copy link

GitCop commented Jun 21, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@0zAND1z
Copy link

0zAND1z commented Jun 29, 2018

Great work here @gballet ! Which milestone does this PR belong to? Is this close to merge & publish in the upcoming build?

@GitCop
Copy link

GitCop commented Jul 19, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 478d9555e5201b755d47c1874bd694f1bcb24766
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

if err != nil {
return errors.New(fmt.Sprintf("Could not instantiate vm: %v", err))
}

// If the module doesn't have any start function, check if the
// exports specify a `main` function and if so, execute it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if the module has a start function, that shouldn't be executed as per current "ECI rules".

"github.com/ethereum/go-ethereum/core/vm"
)

func TestEWASMVM(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should ignore every test apart from the stEWASMTests directory.

@GitCop
Copy link

GitCop commented Jul 27, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: fd83338e30b81bbc231970ccb3e523b7172d91f8
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

1 similar comment
@GitCop
Copy link

GitCop commented Jul 30, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: fd83338e30b81bbc231970ccb3e523b7172d91f8
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Aug 3, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 19c2211333369c242a46649cd684f20126d5a1e4
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

1 similar comment
@GitCop
Copy link

GitCop commented Aug 6, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 19c2211333369c242a46649cd684f20126d5a1e4
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@@ -104,7 +104,7 @@ var eeiFunctionList = []string{

// ModuleResolver matches all EEI functions to native go functions
func ModuleResolver(interpreter *InterpreterEWASM, name string) (*wasm.Module, error) {
if name != "env" {
if name != "env" && name != "ethereum" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env should not be accepted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gballet please address this :)

@GitCop
Copy link

GitCop commented Aug 10, 2018

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 19c2211333369c242a46649cd684f20126d5a1e4
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

core/vm/ewasm.go Outdated

// If the module doesn't have any start function, check if the
// exports specify a `main` function and if so, execute it.
if module.Start == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is exec.NewVM executing the start function?

Since this is disabled in ewasm, you could just leave out the if (perhaps replace it with a panic).

In any case you need to add support for executing system contracts, at least in the create case, so that incoming bytecode can be run through metering.

"log",
"getBlockNumber",
"getTxOrigin",
"return",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been renamed to finish.

Node is now able to synchronize with the
testnet when passing geth the option:
`--vm.ewasm="metering:true"`.
Non-passing tests still need to be discussed in
ewasm/hera#457 and
ewasm/hera#456
panic(fmt.Sprintf("Error loading the metering contract: %v", err))
}
// TODO when the metering contract abides by that rule, check that it
// only exports "main" and "memory".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done on the latest release (testnet milestone1)


if in.metering {
metered, _, err := sentinel(in, code)
if len(metered) < 5 || err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this against what Hera does.

}
}

if len(code) > 8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please compare these 8 and 5 length checks against Hera.

@Latrasis
Copy link

Hi @gballet, quick question, what is the status of this PR? Is there an Issue for tracking this?

@gballet
Copy link
Member Author

gballet commented Aug 15, 2019

@Latrasis this PR is currently on hold, as there is currently no clear sign that there is a strong desire to deploy ewasm on the eth1 mainnet.

The PR works, it needs a couple optimizations but could be used on private networks. Right now, we don't want to merge it because that would force us to keep maintaining it when there is no guarantee it will ever be used. Therefore, it has been put on hold.

@gballet gballet changed the title WIP: ewasm support core: ewasm support Aug 15, 2019
cmd/ewasm/main.go Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Sep 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status:inactive label Sep 2, 2020
Co-authored-by: Brandon van Houten <[email protected]>
@codefromthecrypt
Copy link

Hi, I noticed ewasm repos seem to be maintained, but wondered if maybe another reason this didn't proceed was that the wagon project was archived.

we are working on a go-native wasm implementation (only adds 1.5M to a go binary and zero OS deps, no CGO etc), but need to ensure the API is able to cover main use cases. We are also starting to get questions about CPU limiting and feels like ewasm folks may have some experience here.

If someone could volunteer to have a look, that would be great. If that helps resurrection of ewasm (and that's a desired thing) all the better. otherwise, forgive the intrusion! https://github.com/tetratelabs/wazero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants