Skip to content

Commit

Permalink
Merge pull request #184 from ethereum/max_revision
Browse files Browse the repository at this point in the history
Rename EVMC_LATEST_REVISION to EVMC_MAX_REVISION
  • Loading branch information
chfast committed Jan 21, 2019
2 parents 602cc23 + 1582fae commit c9fac62
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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. */
Expand All @@ -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;
}
26 changes: 23 additions & 3 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
* 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
* @{
*/
#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. */
Expand Down Expand Up @@ -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
};


Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/vmtester/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c9fac62

Please sign in to comment.