Merge pull request #11094 from ethereum/use-map-evmhost

EVMHost: Use std::map for storage so that slots are stored in some order
This commit is contained in:
Bhargava Shastry 2021-03-12 10:58:27 +01:00 committed by GitHub
commit a93ad3b39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -37,7 +37,7 @@ using namespace solidity::util;
using namespace solidity::test;
using namespace evmc::literals;
using StorageMap = std::unordered_map<evmc::bytes32, evmc::storage_value>;
using StorageMap = std::map<evmc::bytes32, evmc::storage_value>;
evmc::VM& EVMHost::getVM(string const& _path)
{

View File

@ -63,7 +63,7 @@ public:
}
/// @returns contents of storage at @param _addr.
std::unordered_map<evmc::bytes32, evmc::storage_value> const& get_address_storage(evmc::address const& _addr);
std::map<evmc::bytes32, evmc::storage_value> const& get_address_storage(evmc::address const& _addr);
bool account_exists(evmc::address const& _addr) const noexcept final
{

View File

@ -6,6 +6,7 @@
#include <evmc/evmc.hpp>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
@ -48,7 +49,7 @@ struct MockedAccount
uint256be balance;
/// The account storage map.
std::unordered_map<bytes32, storage_value> storage;
std::map<bytes32, storage_value> storage;
/// Helper method for setting balance by numeric type.
void set_balance(uint64_t x) noexcept