diff --git a/Changelog.md b/Changelog.md index 8f0d3f82b..0855f466b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Language Features: Compiler Features: * eWasm: Highly experimental eWasm output using ``--ewasm`` in the commandline interface or output selection of ``ewasm.wast`` in standard-json. + * Metadata: Update the swarm hash, changes ``bzzr0`` to ``bzzr1`` and urls to use ``bzz-raw://``. diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index af0126180..f2c7ea590 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -784,7 +784,7 @@ h256 const& CompilerStack::Source::keccak256() const h256 const& CompilerStack::Source::swarmHash() const { if (swarmHashCached == h256{}) - swarmHashCached = dev::bzzr0Hash(scanner->source()); + swarmHashCached = dev::bzzr1Hash(scanner->source()); return swarmHashCached; } @@ -1085,7 +1085,7 @@ string CompilerStack::createMetadata(Contract const& _contract) const else { meta["sources"][s.first]["urls"] = Json::arrayValue; - meta["sources"][s.first]["urls"].append("bzzr://" + toHex(s.second.swarmHash().asBytes())); + meta["sources"][s.first]["urls"].append("bzz-raw://" + toHex(s.second.swarmHash().asBytes())); meta["sources"][s.first]["urls"].append(s.second.ipfsUrl()); } } @@ -1232,7 +1232,7 @@ private: bytes CompilerStack::createCBORMetadata(string const& _metadata, bool _experimentalMode) { MetadataCBOREncoder encoder; - encoder.pushBytes("bzzr0", dev::bzzr0Hash(_metadata).asBytes()); + encoder.pushBytes("bzzr1", dev::bzzr1Hash(_metadata).asBytes()); if (_experimentalMode) encoder.pushBool("experimental", true); if (m_release) diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index 02568872a..8aad4fab7 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -40,18 +40,18 @@ namespace test #define CHECK_DEPLOY_GAS(_gasNoOpt, _gasOpt) \ do \ { \ - u256 bzzr0Cost = GasMeter::dataGas(dev::bzzr0Hash(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: " + \ diff --git a/test/libsolidity/Metadata.cpp b/test/libsolidity/Metadata.cpp index 9303091e5..89093e035 100644 --- a/test/libsolidity/Metadata.cpp +++ b/test/libsolidity/Metadata.cpp @@ -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::bzzr0Hash(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::bzzr0Hash(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"); } diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index c6dd11b6d..e9d8613a4 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -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);