mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
@@ -40,18 +40,18 @@ namespace test
|
||||
#define CHECK_DEPLOY_GAS(_gasNoOpt, _gasOpt) \
|
||||
do \
|
||||
{ \
|
||||
u256 bzzr0Cost = GasMeter::dataGas(dev::swarmHash(m_compiler.metadata(m_compiler.lastContractName())).asBytes(), true); \
|
||||
u256 bzzr1Cost = GasMeter::dataGas(dev::bzzr1Hash(m_compiler.metadata(m_compiler.lastContractName())).asBytes(), true); \
|
||||
u256 gasOpt{_gasOpt}; \
|
||||
u256 gasNoOpt{_gasNoOpt}; \
|
||||
u256 gas = m_optimiserSettings == OptimiserSettings::minimal() ? gasNoOpt : gasOpt; \
|
||||
BOOST_CHECK_MESSAGE( \
|
||||
m_gasUsed >= bzzr0Cost, \
|
||||
m_gasUsed >= bzzr1Cost, \
|
||||
"Gas used: " + \
|
||||
m_gasUsed.str() + \
|
||||
" is less than the data cost for the bzzr0 hash: " + \
|
||||
u256(bzzr0Cost).str() \
|
||||
" is less than the data cost for the bzzr1 hash: " + \
|
||||
u256(bzzr1Cost).str() \
|
||||
); \
|
||||
u256 gasUsed = m_gasUsed - bzzr0Cost; \
|
||||
u256 gasUsed = m_gasUsed - bzzr1Cost; \
|
||||
BOOST_CHECK_MESSAGE( \
|
||||
gas == gasUsed, \
|
||||
"Gas used: " + \
|
||||
|
||||
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
|
||||
bytes const& bytecode = compilerStack.runtimeObject("test").bytecode;
|
||||
std::string const& metadata = compilerStack.metadata("test");
|
||||
BOOST_CHECK(dev::test::isValidMetadata(metadata));
|
||||
bytes hash = dev::swarmHash(metadata).asBytes();
|
||||
bytes hash = dev::bzzr1Hash(metadata).asBytes();
|
||||
BOOST_REQUIRE(hash.size() == 32);
|
||||
auto const cborMetadata = requireParsedCBORMetadata(bytecode);
|
||||
BOOST_CHECK(cborMetadata.size() == 2);
|
||||
@@ -79,8 +79,8 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
|
||||
BOOST_CHECK(cborMetadata.at("solc") == toHex(VersionCompactBytes));
|
||||
else
|
||||
BOOST_CHECK(cborMetadata.at("solc") == VersionStringStrict);
|
||||
BOOST_CHECK(cborMetadata.count("bzzr0") == 1);
|
||||
BOOST_CHECK(cborMetadata.at("bzzr0") == toHex(hash));
|
||||
BOOST_CHECK(cborMetadata.count("bzzr1") == 1);
|
||||
BOOST_CHECK(cborMetadata.at("bzzr1") == toHex(hash));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(metadata_stamp_experimental)
|
||||
bytes const& bytecode = compilerStack.runtimeObject("test").bytecode;
|
||||
std::string const& metadata = compilerStack.metadata("test");
|
||||
BOOST_CHECK(dev::test::isValidMetadata(metadata));
|
||||
bytes hash = dev::swarmHash(metadata).asBytes();
|
||||
bytes hash = dev::bzzr1Hash(metadata).asBytes();
|
||||
BOOST_REQUIRE(hash.size() == 32);
|
||||
auto const cborMetadata = requireParsedCBORMetadata(bytecode);
|
||||
BOOST_CHECK(cborMetadata.size() == 3);
|
||||
@@ -114,8 +114,8 @@ BOOST_AUTO_TEST_CASE(metadata_stamp_experimental)
|
||||
BOOST_CHECK(cborMetadata.at("solc") == toHex(VersionCompactBytes));
|
||||
else
|
||||
BOOST_CHECK(cborMetadata.at("solc") == VersionStringStrict);
|
||||
BOOST_CHECK(cborMetadata.count("bzzr0") == 1);
|
||||
BOOST_CHECK(cborMetadata.at("bzzr0") == toHex(hash));
|
||||
BOOST_CHECK(cborMetadata.count("bzzr1") == 1);
|
||||
BOOST_CHECK(cborMetadata.at("bzzr1") == toHex(hash));
|
||||
BOOST_CHECK(cborMetadata.count("experimental") == 1);
|
||||
BOOST_CHECK(cborMetadata.at("experimental") == "true");
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
"tag_1:\n /* \"fileA\":0:14 contract A { } */\n pop\n dataSize(sub_0)\n dup1\n "
|
||||
"dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n "
|
||||
"/* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n 0x00\n "
|
||||
"dup1\n revert\n\n auxdata: 0xa265627a7a72305820"
|
||||
"dup1\n revert\n\n auxdata: 0xa265627a7a72315820"
|
||||
) == 0);
|
||||
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
|
||||
BOOST_CHECK_EQUAL(contract["evm"]["gasEstimates"].size(), 1);
|
||||
|
||||
Reference in New Issue
Block a user