Merge pull request #184 from ethereum/max_revision

Rename EVMC_LATEST_REVISION to EVMC_MAX_REVISION
This commit is contained in:
Paweł Bylica 2019-01-21 12:46:04 +01:00 committed by GitHub
commit c9fac623d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 9 deletions

View File

@ -2,6 +2,9 @@
## [6.1.0-dev] - unreleased
- Deprecated: [[#184](https://github.com/ethereum/evmc/pull/184)]
The `EVMC_LATEST_REVISION` is deprecated, replaced with `EVMC_MAX_REVISION`.
## [6.0.2] - 2019-01-16
- Fixed: [[#179](https://github.com/ethereum/evmc/pull/179)]

View File

@ -1,6 +1,6 @@
/* EVMC: Ethereum Client-VM Connector API.
* Copyright 2018 The EVMC Authors.
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
* Copyright 2019 The EVMC Authors.
* Licensed under the Apache License, Version 2.0.
*/
/** This example shows how to use evmc::instructions library from evmc CMake package. */
@ -9,6 +9,5 @@
int main()
{
return evmc_get_instruction_metrics_table(EVMC_LATEST_REVISION)[OP_STOP]
.num_stack_returned_items;
return evmc_get_instruction_metrics_table(EVMC_BYZANTIUM)[OP_STOP].num_stack_returned_items;
}

View File

@ -2,8 +2,8 @@
* EVMC: Ethereum Client-VM Connector API
*
* @copyright
* Copyright 2018 The EVMC Authors.
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
* Copyright 2019 The EVMC Authors.
* Licensed under the Apache License, Version 2.0.
*
* @defgroup EVMC EVMC
* @{
@ -11,6 +11,17 @@
#ifndef EVMC_H
#define EVMC_H
#ifdef __has_attribute
#if __has_attribute(deprecated)
#define EVMC_DEPRECATED __attribute__((deprecated))
#endif
#endif
#ifndef EVMC_DEPRECATED
#define EVMC_DEPRECATED
#endif
#include <stdbool.h> /* Definition of bool, true and false. */
#include <stddef.h> /* Definition of size_t. */
#include <stdint.h> /* Definition of int64_t, uint64_t. */
@ -708,7 +719,16 @@ enum evmc_revision
EVMC_CONSTANTINOPLE = 5,
EVMC_ISTANBUL = 6,
EVMC_LATEST_REVISION = EVMC_ISTANBUL /**< This is the maximum revision number supported. */
/** The maximum EVM revision supported. */
EVMC_MAX_REVISION = EVMC_ISTANBUL,
/**
* The latests EVM revision supported.
*
* @deprecated Replaced with ::EVMC_MAX_REVISION.
*/
EVMC_LATEST_REVISION EVMC_DEPRECATED = EVMC_MAX_REVISION
};

View File

@ -113,7 +113,7 @@ TEST(instructions, constantinople_hard_fork)
TEST(instructions, name_gas_cost_equivalence)
{
for (auto rev = EVMC_FRONTIER; rev <= EVMC_LATEST_REVISION;
for (auto rev = EVMC_FRONTIER; rev <= EVMC_MAX_REVISION;
rev = static_cast<evmc_revision>(rev + 1))
{
const auto names = evmc_get_instruction_names_table(rev);

View File

@ -41,7 +41,7 @@ TEST_F(evmc_vm_test, execute)
std::array<uint8_t, 2> code = {{0xfe, 0x00}};
evmc_result result =
vm->execute(vm, context, EVMC_LATEST_REVISION, &msg, code.data(), code.size());
vm->execute(vm, context, EVMC_MAX_REVISION, &msg, code.data(), code.size());
// Validate some constraints
if (result.status_code != EVMC_SUCCESS && result.status_code != EVMC_REVERT)