Merge pull request #9274 from ethereum/YulInterpreterSelfBalance

Yul interpreter: Remove selfbalance constant
This commit is contained in:
chriseth 2020-06-30 17:15:11 +02:00 committed by GitHub
commit a1c33249f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,16 @@
{
mstore(0, balance(address()))
mstore(0x20, selfbalance())
mstore(0x40, balance(div(mul(address(), 2), 2)))
mstore(0x60, balance(add(address(), 1)))
}
// ====
// EVMVersion: >=istanbul
// ----
// Trace:
// Memory dump:
// 0: 0000000000000000000000000000000000000000000000000000000022223333
// 20: 0000000000000000000000000000000000000000000000000000000022223333
// 40: 0000000000000000000000000000000000000000000000000000000022223333
// 60: 0000000000000000000000000000000000000000000000000000000022222222
// Storage dump:

View File

@ -182,7 +182,10 @@ u256 EVMInstructionInterpreter::eval(
case Instruction::ADDRESS:
return m_state.address;
case Instruction::BALANCE:
return m_state.balance;
if (arg[0] == m_state.address)
return m_state.selfbalance;
else
return m_state.balance;
case Instruction::SELFBALANCE:
return m_state.selfbalance;
case Instruction::ORIGIN: