EIPs/EIPS/eip-2003.md
Pandapip1 9e393a79d9
Force usage of included LICENSE file (#5055)
* Include LICENCE in the Jekyll build

* Replace old licence link with new and improved licence link

* Add note to EIP-1 mandating the new link

* Maybe this fixes it?

* Rename LICENCE so that jekyll picks it up

* Add original LICENCE file back

* Delete the markdown file

* Add Jekyll header

Hopefully the tooling still detects it as CC0

* Remove Jekyll header

* Maybe this will trick Jekyll and satisfy github?

* Remove config changes

* Enable incremental build

* Will it work if I rename it?

* I'll just paste the content of the licence into the file...

* Perhaps this will work

* Replace the licence file

* Fix false positive

Co-authored-by: Micah Zoltu <micah@zoltu.net>

* Resolve feedback

* Perhaps this might work

* It didn't work

This reverts commit 55116e15168fb20ae57dea97388bb260c0941465.

* Will licencee still detect this correctly?

* Jekyll Preamble in licence file

* Include it?

* Licence -> License, get rid of CC0.md

* Force wording of copyright waiver

* Formatting consistent with the rest of the list

* Spelling

* Escape

* Task failed successfully

* Fix two more links

* Will this render it?

* Perhaps this will work too

* .md essential

* Fix the issues Micah noted

Co-authored-by: Micah Zoltu <micah@zoltu.net>
2022-05-06 00:29:09 -07:00

6.4 KiB
Raw Permalink Blame History

eip title author discussions-to status type category created requires
2003 EVMC modules for implementations of precompiled contracts Paweł Bylica (@chfast), Alex Beregszaszi (@axic) https://github.com/ethereum/evmc/issues/259 Stagnant Standards Track Interface 2019-05-09 1352

Abstract

EVMC specifies a generic API for Ethereum execution engines. This EIP specifies a way of providing implementations of Ethereum precompiled contracts using the EVMC VM API.

Specification

For the complete EVMC specification visit the EVMC documentation first. This EIP is based on and is compatible with EVMC ABI version 6.

The EVMC module with implementations of precompiled contracts SHOULD:

  1. Advertise the EVMC_CAPABILITY_PRECOMPILES capability in the get_capabilities() method.

  2. Implement the execute() method in the following way:

    1. Validate the incoming execution request requirements:

      1. The message kind (evmc_message::kind) is a call (EVMC_CALL).

      2. The call destination address (evmc_message::destination) is within the range of precompiled contracts defined by EIP-1352.

      3. There is no code provided (the code argument is NULL and code_size argument is 0).

      If the requirements are not fulfilled, abort execution with the EVMC_REJECTED status code.

    2. Check if the call destination address (evmc_message::destination) targets existing precompiled contract. Consider the EVM revision (evmc_revision) requested by the rev parameter of execute().

      If yes, execute as follows:

      1. Inspect the input data (evmc_message::input_data, evmc_message::input_size) and calculate the gas cost of the execution.

      2. Compute the amount of gas left after execution by subtracting the gas cost from the call gas limit (evmc_message::gas).

      3. If gas left is negative, abort execution with the EVMC_OUT_OF_GAS status code.

      4. Otherwise, execute the code of the precompiled contract, return the EVMC_SUCCESS status code, the output and gas left (evmc_result::output_data, evmc_result::output_size, evmc_result::gas_left).

    3. Otherwise, emulate execution of empty code by returning the EVMC_SUCCESS status code and gas left equal the call gas limit (evmc_message::gas).

Precompiled contract implementations are allowed to return two more EVMC error codes:

  • EVMC_FAILURE if the failure was caused due to something other than out of gas (e.g. input validation error)
  • EVMC_REVERT if the precompile doesn't want to forfeit all supplied gas (as of May 2019 no such precompile exists)

The Client is not required to provide the Host interface ([evmc_context] argument of execute() is set to NULL). Therefore, the precompiled contracts implementation MUST NOT access the evmc_context.

Rationale

It is very unlikely that any precompile will need to access or modify a contract state. Not requiring the Client to implement the EVMC Host interface removes the big portion of work needed for full EVMC integration.

Test Cases

EVMC provides the evmc-vmtester tool for checking compatibility with the EVMC specification.

Implementations

References

Copyright and related rights waived via CC0.