From 38ac703fa8d60c44764915e616427f68328213e1 Mon Sep 17 00:00:00 2001 From: Dominic Letz Date: Fri, 1 Nov 2019 16:20:37 +0100 Subject: [PATCH 1/2] eip-2330 EXTSLOAD wip --- libaleth-interpreter/VM.cpp | 12 ++++++++++++ libevm/Instruction.h | 1 + 2 files changed, 13 insertions(+) diff --git a/libaleth-interpreter/VM.cpp b/libaleth-interpreter/VM.cpp index 567a8a253a9..57884a5912f 100644 --- a/libaleth-interpreter/VM.cpp +++ b/libaleth-interpreter/VM.cpp @@ -1431,6 +1431,18 @@ void VM::interpretCases() } NEXT + CASE(EXTSLOAD) + { + ON_OP(); + updateIOGas(); + + auto const address = intx::be::trunc(m_SP[0]); + auto const key = intx::be::store(m_SP[1]); + m_SPP[0] = + intx::be::load(m_context->host->get_storage(m_context, &address, &key)); + } + NEXT + CASE(INVALID) DEFAULT { diff --git a/libevm/Instruction.h b/libevm/Instruction.h index f86625d0a43..94b4e7f33e3 100644 --- a/libevm/Instruction.h +++ b/libevm/Instruction.h @@ -82,6 +82,7 @@ enum class Instruction : uint8_t MSIZE, ///< get the size of active memory GAS, ///< get the amount of available gas JUMPDEST, ///< set a potential jump destination + EXTLOAD, ///< load word from storage of another contract PUSH1 = 0x60, ///< place 1 byte item on stack PUSH2, ///< place 2 byte item on stack From 4e38c9769d95eed852b200108a1641c47735abb1 Mon Sep 17 00:00:00 2001 From: Dominic Letz Date: Fri, 1 Nov 2019 16:43:34 +0100 Subject: [PATCH 2/2] eip-2330 EXTSLOAD wip#2 --- CHANGELOG.md | 1 + libaleth-interpreter/VMConfig.h | 2 +- libevm/Instruction.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 517b53369b9..1a899fb1d54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [1.8.0] - Unreleased +- Added: [#XXXX](https://github.com/ethereum/aleth/pull/XXXX) EIP XXXX: EXTSLOAD opcode. - Added: [#5699](https://github.com/ethereum/aleth/pull/5699) EIP 2046: Reduced gas cost for static calls made to precompiles. - Added: [#5752](https://github.com/ethereum/aleth/pull/5752) [#5753](https://github.com/ethereum/aleth/pull/5753) Implement EIP1380 (reduced gas costs for call-to-self). - Removed: [#5760](https://github.com/ethereum/aleth/pull/5760) Official support for Visual Studio 2015 has been dropped. Compilation with this compiler is expected to stop working after migration to C++14. diff --git a/libaleth-interpreter/VMConfig.h b/libaleth-interpreter/VMConfig.h index deca08e3e92..8415778b404 100644 --- a/libaleth-interpreter/VMConfig.h +++ b/libaleth-interpreter/VMConfig.h @@ -231,7 +231,7 @@ namespace eth &&MSIZE, \ &&GAS, \ &&JUMPDEST, \ - &&BEGINDATA, \ + &&EXTSLOAD, \ &&BEGINSUB, \ &&INVALID, \ &&INVALID, \ diff --git a/libevm/Instruction.h b/libevm/Instruction.h index 94b4e7f33e3..3c06f6d935c 100644 --- a/libevm/Instruction.h +++ b/libevm/Instruction.h @@ -82,7 +82,7 @@ enum class Instruction : uint8_t MSIZE, ///< get the size of active memory GAS, ///< get the amount of available gas JUMPDEST, ///< set a potential jump destination - EXTLOAD, ///< load word from storage of another contract + EXTSLOAD, ///< load word from storage of another contract PUSH1 = 0x60, ///< place 1 byte item on stack PUSH2, ///< place 2 byte item on stack