Skip to content

Conversation

gballet
Copy link
Member

@gballet gballet commented Sep 17, 2018

Interpreter initialization is left to the PRs implementing them.

There is a commented-out part that needs to be uncommented in order to initialize the proper interpreter when need be; for instance, in the case of ewasm and assuming that --ewasm.interpreter is evmc:path then the code should be something like:

params := strings.Split(, ":")
switch params[0] {
case "evmc":
  if len(params) != 2 {
  panic("Missing vm path in evmc:path argument to ewasm.interpreter")
  }
  vmPath := params[1]
  evm.interpreters = append(evm.interpreters, NewEVMC(evm, vmPath))
  break;
  ...
}

and the panic should be removed.

@gballet gballet mentioned this pull request Sep 17, 2018
@chfast
Copy link
Member

chfast commented Sep 17, 2018

Is there a way to run tests with an external EVMC VM? E.g. --evm.interpreter evmc:aleth-interpreter.so? Can go test ./tests/... accept custom flags?

@chfast
Copy link
Member

chfast commented Sep 17, 2018

EVMC supports also custom options. Can will add additional flag, e.g. --evmc.options option1=x;option2=y?

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 be defined by a hard fork rule, not a CLI flag.

Copy link
Member

Choose a reason for hiding this comment

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

Please name these --vm.evm and --vm.ewasm. The defaults should be empty, which geth can interpret by running the built in VMs.

Copy link
Member

Choose a reason for hiding this comment

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

Also add (default = built in implementation)

Copy link
Member

Choose a reason for hiding this comment

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

Whether ewasm is enabled or not is not a configuration value, it's a chain fork rule.

Copy link
Member

Choose a reason for hiding this comment

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

Please get rid of geth and wagon. Empty means built in, non empty means use something else.

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please use nil. big.NewInt(0) enables EWASM at block 0.

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please use nil. big.NewInt(0) enables EWASM at block 0.

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please use nil. big.NewInt(0) enables EWASM at block 0.

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please move this up after the rest of the fork definitions.

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

"Constantinople" -> "EWASM"

@gballet
Copy link
Member Author

gballet commented Sep 17, 2018

Is there a way to run tests with an external EVMC VM? E.g. --evm.interpreter evmc:aleth-interpreter.so? Can go test ./tests/... accept custom flags?

you can write those tests

EVMC supports also custom options. Can will add additional flag, e.g. --evmc.options option1=x;option2=y?

I would say that's part of the EVMC pr: if you have --vm.evm=path:option1:option2 that should work .

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Can't wait to implement eWASM on mainnet 😂

Copy link
Member

Choose a reason for hiding this comment

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

Please remove "wagon" and "geth"

Copy link
Member

Choose a reason for hiding this comment

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

ping

params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Lets keep the comment consistent with the other ones.

// EWASM switch block (nil = no fork, 0 = already activated)

Copy link
Member

Choose a reason for hiding this comment

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

External EWASM configuration (default = built in interpreter)

Copy link
Member

Choose a reason for hiding this comment

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

External EVM configuration (default = built in interpreter)

eth/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Does this needs to be colon separated or can anything be passed after evmc:path:.... ?

Copy link
Member Author

Choose a reason for hiding this comment

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

anything can be passed

Copy link
Member

Choose a reason for hiding this comment

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

You can use the same comments as for the flag.

External eWASM configuration and External EVM configuration

I wouldn't mention the config string here yet, since it's not even implemented, so we don't know what it will be. We do know it won't be the one you listed though (no evmc).

@karalabe karalabe added this to the 1.8.16 milestone Sep 19, 2018
params/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Can you use ewasm instead of eWASM as that is the current naming style?

Copy link
Member Author

Choose a reason for hiding this comment

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

@axic is this the current or the definitive naming style? 😄

Copy link
Member

Choose a reason for hiding this comment

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

Current, could change.

But there is agreement eWASM is not the way to go :)

Interpreter initialization is left to the PRs implementing them.
Options for external interpreters are passed after a colon in the
`--vm.ewasm` and `--vm.evm` switches.
@gballet gballet force-pushed the vm-selector-switches branch from 4e4c89b to 0c84df5 Compare September 19, 2018 13:10
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

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

LGTM

@karalabe karalabe merged commit da29332 into ethereum:master Sep 20, 2018
nizsheanez referenced this pull request in nizsheanez/go-ethereum Sep 21, 2018
Interpreter initialization is left to the PRs implementing them.
Options for external interpreters are passed after a colon in the
`--vm.ewasm` and `--vm.evm` switches.
}
var (
vmConfig = vm.Config{EnablePreimageRecording: config.EnablePreimageRecording}
vmConfig = vm.Config{
Copy link
Member

@chfast chfast Sep 21, 2018

Choose a reason for hiding this comment

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

Sorry, but you missed 64 other places where vm.Config{} is created. I'm not even sure if the new incoming transactions are going to be executed with the selected VM.

Copy link
Member Author

Choose a reason for hiding this comment

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

@chfast those other location correspond to tests and simulations and we want to use the native interpreter in them. Incoming transactions will be executed by the VM, if you don't believe us check it for yourself.

Copy link
Member

Choose a reason for hiding this comment

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

I believe you. I just remember I had to change this in two places. Maybe it was about tests.

@gballet gballet mentioned this pull request Sep 25, 2018
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants