mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2589 from ethereum/rename-onchainmetadata
Rename onChainMetadata to metadata
This commit is contained in:
@@ -476,12 +476,12 @@ Json::Value CompilerStack::methodIdentifiers(string const& _contractName) const
|
||||
return methodIdentifiers;
|
||||
}
|
||||
|
||||
string const& CompilerStack::onChainMetadata(string const& _contractName) const
|
||||
string const& CompilerStack::metadata(string const& _contractName) const
|
||||
{
|
||||
if (m_stackState != CompilationSuccessful)
|
||||
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));
|
||||
|
||||
return contract(_contractName).onChainMetadata;
|
||||
return contract(_contractName).metadata;
|
||||
}
|
||||
|
||||
Scanner const& CompilerStack::scanner(string const& _sourceName) const
|
||||
@@ -675,11 +675,11 @@ void CompilerStack::compileContract(
|
||||
|
||||
shared_ptr<Compiler> compiler = make_shared<Compiler>(m_optimize, m_optimizeRuns);
|
||||
Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
|
||||
string onChainMetadata = createOnChainMetadata(compiledContract);
|
||||
string metadata = createMetadata(compiledContract);
|
||||
bytes cborEncodedMetadata =
|
||||
// CBOR-encoding of {"bzzr0": dev::swarmHash(onChainMetadata)}
|
||||
// CBOR-encoding of {"bzzr0": dev::swarmHash(metadata)}
|
||||
bytes{0xa1, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} +
|
||||
dev::swarmHash(onChainMetadata).asBytes();
|
||||
dev::swarmHash(metadata).asBytes();
|
||||
solAssert(cborEncodedMetadata.size() <= 0xffff, "Metadata too large");
|
||||
// 16-bit big endian length
|
||||
cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2);
|
||||
@@ -712,7 +712,7 @@ void CompilerStack::compileContract(
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Assembly exception for deployed bytecode"));
|
||||
}
|
||||
|
||||
compiledContract.onChainMetadata = onChainMetadata;
|
||||
compiledContract.metadata = metadata;
|
||||
_compiledContracts[compiledContract.contract] = &compiler->assembly();
|
||||
|
||||
try
|
||||
@@ -773,7 +773,7 @@ CompilerStack::Source const& CompilerStack::source(string const& _sourceName) co
|
||||
return it->second;
|
||||
}
|
||||
|
||||
string CompilerStack::createOnChainMetadata(Contract const& _contract) const
|
||||
string CompilerStack::createMetadata(Contract const& _contract) const
|
||||
{
|
||||
Json::Value meta;
|
||||
meta["version"] = 1;
|
||||
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
/// @returns a JSON representing a map of method identifiers (hashes) to function names.
|
||||
Json::Value methodIdentifiers(std::string const& _contractName) const;
|
||||
|
||||
std::string const& onChainMetadata(std::string const& _contractName) const;
|
||||
std::string const& metadata(std::string const& _contractName) const;
|
||||
void useMetadataLiteralSources(bool _metadataLiteralSources) { m_metadataLiteralSources = _metadataLiteralSources; }
|
||||
|
||||
/// @returns a JSON representing the estimated gas usage for contract creation, internal and external functions
|
||||
@@ -223,7 +223,7 @@ private:
|
||||
eth::LinkerObject object;
|
||||
eth::LinkerObject runtimeObject;
|
||||
eth::LinkerObject cloneObject;
|
||||
std::string onChainMetadata; ///< The metadata json that will be hashed into the chain.
|
||||
std::string metadata; ///< The metadata json that will be hashed into the chain.
|
||||
mutable std::unique_ptr<Json::Value const> abi;
|
||||
mutable std::unique_ptr<Json::Value const> userDocumentation;
|
||||
mutable std::unique_ptr<Json::Value const> devDocumentation;
|
||||
@@ -255,7 +255,7 @@ private:
|
||||
/// does not exist.
|
||||
ContractDefinition const& contractDefinition(std::string const& _contractName) const;
|
||||
|
||||
std::string createOnChainMetadata(Contract const& _contract) const;
|
||||
std::string createMetadata(Contract const& _contract) const;
|
||||
std::string computeSourceMapping(eth::AssemblyItems const& _items) const;
|
||||
Json::Value const& contractABI(Contract const&) const;
|
||||
Json::Value const& natspec(Contract const&, DocumentationType _type) const;
|
||||
|
||||
@@ -386,7 +386,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
|
||||
// ABI, documentation and metadata
|
||||
Json::Value contractData(Json::objectValue);
|
||||
contractData["abi"] = m_compilerStack.contractABI(contractName);
|
||||
contractData["metadata"] = m_compilerStack.onChainMetadata(contractName);
|
||||
contractData["metadata"] = m_compilerStack.metadata(contractName);
|
||||
contractData["userdoc"] = m_compilerStack.natspec(contractName, DocumentationType::NatspecUser);
|
||||
contractData["devdoc"] = m_compilerStack.natspec(contractName, DocumentationType::NatspecDev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user