Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit 25f5c3c

Browse files
authored
Merge pull request #5725 from ethereum/eip-1884-interpreter
Implement EIP-1884: Repricing for trie-size-dependent opcodes in aleth-interpreter
2 parents 02ca548 + a67c0ec commit 25f5c3c

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- Added: [#5640](https://github.com/ethereum/aleth/pull/5640) Support EIP-1702 Generalized Account Versioning Scheme (active only in Experimental fork.)
1717
- Added: [#5691](https://github.com/ethereum/aleth/pull/5691) Istanbul support: EIP-2028 Transaction data gas cost reduction.
1818
- Added: [#5696](https://github.com/ethereum/aleth/pull/5696) [#5708](https://github.com/ethereum/aleth/pull/5708) Istanbul support: EIP-1344 ChainID opcode.
19-
- Added: [#5700](https://github.com/ethereum/aleth/pull/5700) Istanbul support: EIP 1884 Repricing for trie-size-dependent opcodes.
19+
- Added: [#5700](https://github.com/ethereum/aleth/pull/5700) [#5725](https://github.com/ethereum/aleth/pull/5725) Istanbul support: EIP 1884 Repricing for trie-size-dependent opcodes.
2020
- Added: [#5701](https://github.com/ethereum/aleth/issues/5701) Outputs ENR text representation in admin.nodeInfo RPC.
2121
- Added: [#5705](https://github.com/ethereum/aleth/pull/5705) Istanbul support: EIP 1108 Reduce alt_bn128 precompile gas costs.
2222
- Added: [#5707](https://github.com/ethereum/aleth/pull/5707) Aleth waits for 2 seconds after sending disconnect to peer before closing socket.

libaleth-interpreter/VM.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,19 @@ void VM::interpretCases()
11641164
}
11651165
NEXT
11661166

1167+
CASE(SELFBALANCE)
1168+
{
1169+
ON_OP();
1170+
1171+
if (m_rev < EVMC_ISTANBUL)
1172+
throwBadInstruction();
1173+
1174+
updateIOGas();
1175+
1176+
m_SPP[0] = fromEvmC(m_context->host->get_balance(m_context, &m_message->destination));
1177+
}
1178+
NEXT
1179+
11671180
CASE(POP)
11681181
{
11691182
ON_OP();

libaleth-interpreter/VMConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ namespace eth
223223
&&DIFFICULTY, \
224224
&&GASLIMIT, \
225225
&&CHAINID, \
226-
&&INVALID, \
226+
&&SELFBALANCE, \
227227
&&INVALID, \
228228
&&INVALID, \
229229
&&INVALID, \

test/unittests/libevm/VMTest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ class LegacyVMSelfBalanceFixture : public SelfBalanceFixture
655655
LegacyVMSelfBalanceFixture() : SelfBalanceFixture{new LegacyVM} {}
656656
};
657657

658+
class AlethInterpreterSelfBalanceFixture : public SelfBalanceFixture
659+
{
660+
public:
661+
AlethInterpreterSelfBalanceFixture() : SelfBalanceFixture{new EVMC{evmc_create_interpreter()}}
662+
{}
663+
};
658664
} // namespace
659665

660666
BOOST_FIXTURE_TEST_SUITE(LegacyVMSuite, TestOutputHelperFixture)
@@ -1053,4 +1059,17 @@ BOOST_AUTO_TEST_CASE(AlethInterpreterChainIDisInvalidBeforeIstanbul)
10531059
}
10541060
BOOST_AUTO_TEST_SUITE_END()
10551061

1062+
BOOST_FIXTURE_TEST_SUITE(AlethInterpreterSelfBalanceSuite, AlethInterpreterSelfBalanceFixture)
1063+
1064+
BOOST_AUTO_TEST_CASE(AlethInterpreterSelfBalanceworksInIstanbul)
1065+
{
1066+
testSelfBalanceWorksInIstanbul();
1067+
}
1068+
1069+
BOOST_AUTO_TEST_CASE(AlethInterpreterSelfBalanceisInvalidBeforeIstanbul)
1070+
{
1071+
testSelfBalanceisInvalidBeforeIstanbul();
1072+
}
1073+
BOOST_AUTO_TEST_SUITE_END()
1074+
10561075
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)