diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-10 15:48:00 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-30 17:54:29 +0800 |
commit | 0c8beac35785a3c688c48c7f607832c30509c907 (patch) | |
tree | 042638c13656bd597f4c8fa719b28c71ddac058d /libevmasm/KnownState.cpp | |
parent | 0066a08aa8f6c469cde7947ec50ca662a32123a0 (diff) | |
download | dexon-solidity-0c8beac35785a3c688c48c7f607832c30509c907.tar.gz dexon-solidity-0c8beac35785a3c688c48c7f607832c30509c907.tar.zst dexon-solidity-0c8beac35785a3c688c48c7f607832c30509c907.zip |
Rename the SHA3 assembly instruction to KECCAK256
Diffstat (limited to 'libevmasm/KnownState.cpp')
-rw-r--r-- | libevmasm/KnownState.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index 6e3130dd..e2f10f22 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -136,10 +136,10 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool m_stackHeight + _item.deposit(), loadFromMemory(arguments[0], _item.location()) ); - else if (_item.instruction() == Instruction::SHA3) + else if (_item.instruction() == Instruction::KECCAK256) setStackElement( m_stackHeight + _item.deposit(), - applySha3(arguments.at(0), arguments.at(1), _item.location()) + applyKeccak256(arguments.at(0), arguments.at(1), _item.location()) ); else { @@ -346,18 +346,18 @@ ExpressionClasses::Id KnownState::loadFromMemory(Id _slot, SourceLocation const& return m_memoryContent[_slot] = m_expressionClasses->find(item, {_slot}, true, m_sequenceNumber); } -KnownState::Id KnownState::applySha3( +KnownState::Id KnownState::applyKeccak256( Id _start, Id _length, SourceLocation const& _location ) { - AssemblyItem sha3Item(Instruction::SHA3, _location); + AssemblyItem keccak256Item(Instruction::KECCAK256, _location); // Special logic if length is a short constant, otherwise we cannot tell. u256 const* l = m_expressionClasses->knownConstant(_length); // unknown or too large length if (!l || *l > 128) - return m_expressionClasses->find(sha3Item, {_start, _length}, true, m_sequenceNumber); + return m_expressionClasses->find(keccak256Item, {_start, _length}, true, m_sequenceNumber); vector<Id> arguments; for (u256 i = 0; i < *l; i += 32) @@ -368,10 +368,10 @@ KnownState::Id KnownState::applySha3( ); arguments.push_back(loadFromMemory(slot, _location)); } - if (m_knownSha3Hashes.count(arguments)) - return m_knownSha3Hashes.at(arguments); + if (m_knownKeccak256Hashes.count(arguments)) + return m_knownKeccak256Hashes.at(arguments); Id v; - // If all arguments are known constants, compute the sha3 here + // If all arguments are known constants, compute the Keccak-256 here if (all_of(arguments.begin(), arguments.end(), [this](Id _a) { return !!m_expressionClasses->knownConstant(_a); })) { bytes data; @@ -381,8 +381,8 @@ KnownState::Id KnownState::applySha3( v = m_expressionClasses->find(AssemblyItem(u256(dev::keccak256(data)), _location)); } else - v = m_expressionClasses->find(sha3Item, {_start, _length}, true, m_sequenceNumber); - return m_knownSha3Hashes[arguments] = v; + v = m_expressionClasses->find(keccak256Item, {_start, _length}, true, m_sequenceNumber); + return m_knownKeccak256Hashes[arguments] = v; } set<u256> KnownState::tagsInExpression(KnownState::Id _expressionId) |