-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
core: ewasm support #16957
Conversation
The EEI functions require access to the module's memory. This is handled by go-interpreter/wagon#59 which is currently heavily discussed. |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
3 similar comments
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
1 similar comment
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Great work here @gballet ! Which milestone does this PR belong to? Is this close to merge & publish in the upcoming build? |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
cmd/ewasm/main.go
Outdated
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. |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
1 similar comment
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
1 similar comment
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
core/vm/ewasm_linker.go
Outdated
@@ -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" { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gballet please address this :)
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
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 { |
There was a problem hiding this comment.
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.
core/vm/ewasm_linker.go
Outdated
"log", | ||
"getBlockNumber", | ||
"getTxOrigin", | ||
"return", |
There was a problem hiding this comment.
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". |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
Hi @gballet, quick question, what is the status of this PR? Is there an Issue for tracking this? |
@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. |
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. |
Co-authored-by: Brandon van Houten <[email protected]>
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 |
This PR implements eWASM contracts based on github.com/go-interpreter/wagon.
geth
evm
geth
so that on-chain ewasm smart contracts can be executed