Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Added: [#5634](https://github.com/ethereum/aleth/pull/5634) Bootnodes for Rinkeby and Goerli.
- Added: [#5640](https://github.com/ethereum/aleth/pull/5640) Support EIP-1702 Generalized Account Versioning Scheme (active only in Experimental fork.)
- Added: [#5691](https://github.com/ethereum/aleth/pull/5691) Istanbul support: EIP-2028 Transaction data gas cost reduction.
- Added: [#5696](https://github.com/ethereum/aleth/pull/5696) Istanbul support: EIP-1344 ChainID opcode.
- Added: [#5696](https://github.com/ethereum/aleth/pull/5708) [#5696](https://github.com/ethereum/aleth/pull/5708) Istanbul support: EIP-1344 ChainID opcode.
- Added: [#5701](https://github.com/ethereum/aleth/issues/5701) Outputs ENR text representation in admin.nodeInfo RPC.
- Added: [#5707](https://github.com/ethereum/aleth/pull/5707) Aleth waits for 2 seconds after sending disconnect to peer before closing socket.
- Changed: [#5532](https://github.com/ethereum/aleth/pull/5532) The leveldb is upgraded to 1.22. This is breaking change on Windows and the old databases are not compatible.
Expand Down
2 changes: 1 addition & 1 deletion evmc
Submodule evmc updated from e9d464 to ec8c90
14 changes: 14 additions & 0 deletions libaleth-interpreter/VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,20 @@ void VM::interpretCases()
}
NEXT


CASE(CHAINID)
{
ON_OP();

if (m_rev < EVMC_ISTANBUL)
throwBadInstruction();

updateIOGas();

m_SPP[0] = fromEvmC(getTxContext().chain_id);
}
NEXT

CASE(POP)
{
ON_OP();
Expand Down
2 changes: 1 addition & 1 deletion libaleth-interpreter/VMConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ namespace eth
&&NUMBER, \
&&DIFFICULTY, \
&&GASLIMIT, \
&&INVALID, \
&&CHAINID, \
&&INVALID, \
&&INVALID, \
&&INVALID, \
Expand Down
13 changes: 8 additions & 5 deletions libevm/ExtVMFace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ evmc_tx_context EvmCHost::get_tx_context() noexcept
evmc_tx_context result = {};
result.tx_gas_price = toEvmC(m_extVM.gasPrice);
result.tx_origin = toEvmC(m_extVM.origin);
result.block_coinbase = toEvmC(m_extVM.envInfo().author());
result.block_number = m_extVM.envInfo().number();
result.block_timestamp = m_extVM.envInfo().timestamp();
result.block_gas_limit = static_cast<int64_t>(m_extVM.envInfo().gasLimit());
result.block_difficulty = toEvmC(m_extVM.envInfo().difficulty());

auto const& envInfo = m_extVM.envInfo();
result.block_coinbase = toEvmC(envInfo.author());
result.block_number = envInfo.number();
result.block_timestamp = envInfo.timestamp();
result.block_gas_limit = static_cast<int64_t>(envInfo.gasLimit());
result.block_difficulty = toEvmC(envInfo.difficulty());
result.chain_id = toEvmC(envInfo.chainID());
return result;
}

Expand Down
20 changes: 20 additions & 0 deletions test/unittests/libevm/VMTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ class LegacyVMChainIDTestFixture : public ChainIDTestFixture
LegacyVMChainIDTestFixture() : ChainIDTestFixture{new LegacyVM} {}
};

class AlethInterpreterChainIDTestFixture : public ChainIDTestFixture
{
public:
AlethInterpreterChainIDTestFixture() : ChainIDTestFixture{new EVMC{evmc_create_interpreter()}}
{}
};

} // namespace

BOOST_FIXTURE_TEST_SUITE(LegacyVMSuite, TestOutputHelperFixture)
Expand Down Expand Up @@ -937,4 +944,17 @@ BOOST_AUTO_TEST_CASE(AlethInterpreterSstoreEip1283Case17)

BOOST_AUTO_TEST_SUITE_END()

BOOST_FIXTURE_TEST_SUITE(AlethInterpreterChainIDSuite, AlethInterpreterChainIDTestFixture)

BOOST_AUTO_TEST_CASE(AlethInterpreterChainIDworksInIstanbul)
{
testChainIDWorksInIstanbul();
}

BOOST_AUTO_TEST_CASE(AlethInterpreterChainIDisInvalidBeforeIstanbul)
{
testChainIDisInvalidBeforeIstanbul();
}
BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()