mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9053 from ethereum/generatedSources
Export generated sources
This commit is contained in:
commit
eac175c08b
@ -4,6 +4,7 @@ Language Features:
|
|||||||
|
|
||||||
|
|
||||||
Compiler Features:
|
Compiler Features:
|
||||||
|
* Export compiler-generated utility sources via standard-json or combined-json.
|
||||||
* SMTChecker: Support shifts.
|
* SMTChecker: Support shifts.
|
||||||
* SMTChecker: Support structs.
|
* SMTChecker: Support structs.
|
||||||
* SMTChecker: Support ``type(T).min``, ``type(T).max``, and ``type(I).interfaceId``.
|
* SMTChecker: Support ``type(T).min``, ``type(T).max``, and ``type(I).interfaceId``.
|
||||||
|
@ -51,8 +51,8 @@ void Compiler::compileContract(
|
|||||||
|
|
||||||
m_context.optimise(m_optimiserSettings);
|
m_context.optimise(m_optimiserSettings);
|
||||||
|
|
||||||
solAssert(m_context.requestedYulFunctionsRan(), "requestedYulFunctions() was not called.");
|
solAssert(m_context.appendYulUtilityFunctionsRan(), "appendYulUtilityFunctions() was not called.");
|
||||||
solAssert(m_runtimeContext.requestedYulFunctionsRan(), "requestedYulFunctions() was not called.");
|
solAssert(m_runtimeContext.appendYulUtilityFunctionsRan(), "appendYulUtilityFunctions() was not called.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<evmasm::Assembly> Compiler::runtimeAssemblyPtr() const
|
std::shared_ptr<evmasm::Assembly> Compiler::runtimeAssemblyPtr() const
|
||||||
|
@ -74,6 +74,9 @@ public:
|
|||||||
/// @returns Assembly items of the runtime compiler context
|
/// @returns Assembly items of the runtime compiler context
|
||||||
evmasm::AssemblyItems const& runtimeAssemblyItems() const { return m_context.assembly().sub(m_runtimeSub).items(); }
|
evmasm::AssemblyItems const& runtimeAssemblyItems() const { return m_context.assembly().sub(m_runtimeSub).items(); }
|
||||||
|
|
||||||
|
std::string generatedYulUtilityCode() const { return m_context.generatedYulUtilityCode(); }
|
||||||
|
std::string runtimeGeneratedYulUtilityCode() const { return m_runtimeContext.generatedYulUtilityCode(); }
|
||||||
|
|
||||||
/// @returns the entry label of the given function. Might return an AssemblyItem of type
|
/// @returns the entry label of the given function. Might return an AssemblyItem of type
|
||||||
/// UndefinedItem if it does not exist yet.
|
/// UndefinedItem if it does not exist yet.
|
||||||
evmasm::AssemblyItem functionEntryLabel(FunctionDefinition const& _function) const;
|
evmasm::AssemblyItem functionEntryLabel(FunctionDefinition const& _function) const;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <libsolidity/interface/Version.h>
|
#include <libsolidity/interface/Version.h>
|
||||||
|
|
||||||
#include <libyul/AsmParser.h>
|
#include <libyul/AsmParser.h>
|
||||||
|
#include <libyul/AsmPrinter.h>
|
||||||
#include <libyul/AsmAnalysis.h>
|
#include <libyul/AsmAnalysis.h>
|
||||||
#include <libyul/AsmAnalysisInfo.h>
|
#include <libyul/AsmAnalysisInfo.h>
|
||||||
#include <libyul/backends/evm/AsmCodeGen.h>
|
#include <libyul/backends/evm/AsmCodeGen.h>
|
||||||
@ -37,6 +38,7 @@
|
|||||||
#include <libyul/optimiser/Suite.h>
|
#include <libyul/optimiser/Suite.h>
|
||||||
#include <libyul/Object.h>
|
#include <libyul/Object.h>
|
||||||
#include <libyul/YulString.h>
|
#include <libyul/YulString.h>
|
||||||
|
#include <libyul/Utilities.h>
|
||||||
|
|
||||||
#include <libsolutil/Whiskers.h>
|
#include <libsolutil/Whiskers.h>
|
||||||
|
|
||||||
@ -51,9 +53,6 @@
|
|||||||
|
|
||||||
// Change to "define" to output all intermediate code
|
// Change to "define" to output all intermediate code
|
||||||
#undef SOL_OUTPUT_ASM
|
#undef SOL_OUTPUT_ASM
|
||||||
#ifdef SOL_OUTPUT_ASM
|
|
||||||
#include <libyul/AsmPrinter.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -191,14 +190,24 @@ void CompilerContext::appendMissingLowLevelFunctions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<string, set<string>> CompilerContext::requestedYulFunctions()
|
void CompilerContext::appendYulUtilityFunctions(OptimiserSettings const& _optimiserSettings)
|
||||||
{
|
{
|
||||||
solAssert(!m_requestedYulFunctionsRan, "requestedYulFunctions called more than once.");
|
solAssert(!m_appendYulUtilityFunctionsRan, "requestedYulFunctions called more than once.");
|
||||||
m_requestedYulFunctionsRan = true;
|
m_appendYulUtilityFunctionsRan = true;
|
||||||
|
|
||||||
set<string> empty;
|
string code = m_yulFunctionCollector.requestedFunctions();
|
||||||
swap(empty, m_externallyUsedYulFunctions);
|
if (!code.empty())
|
||||||
return {m_yulFunctionCollector.requestedFunctions(), std::move(empty)};
|
{
|
||||||
|
appendInlineAssembly(
|
||||||
|
yul::reindent("{\n" + move(code) + "\n}"),
|
||||||
|
{},
|
||||||
|
m_externallyUsedYulFunctions,
|
||||||
|
true,
|
||||||
|
_optimiserSettings,
|
||||||
|
yulUtilityFileName()
|
||||||
|
);
|
||||||
|
solAssert(!m_generatedYulUtilityCode.empty(), "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerContext::addVariable(
|
void CompilerContext::addVariable(
|
||||||
@ -369,7 +378,8 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
vector<string> const& _localVariables,
|
vector<string> const& _localVariables,
|
||||||
set<string> const& _externallyUsedFunctions,
|
set<string> const& _externallyUsedFunctions,
|
||||||
bool _system,
|
bool _system,
|
||||||
OptimiserSettings const& _optimiserSettings
|
OptimiserSettings const& _optimiserSettings,
|
||||||
|
string _sourceName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned startStackHeight = stackHeight();
|
unsigned startStackHeight = stackHeight();
|
||||||
@ -420,7 +430,7 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
|
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
ErrorReporter errorReporter(errors);
|
ErrorReporter errorReporter(errors);
|
||||||
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly, "--CODEGEN--"));
|
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly, _sourceName));
|
||||||
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
|
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
|
||||||
optional<langutil::SourceLocation> locationOverride;
|
optional<langutil::SourceLocation> locationOverride;
|
||||||
if (!_system)
|
if (!_system)
|
||||||
@ -469,6 +479,17 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
|
|
||||||
optimizeYul(obj, dialect, _optimiserSettings, externallyUsedIdentifiers);
|
optimizeYul(obj, dialect, _optimiserSettings, externallyUsedIdentifiers);
|
||||||
|
|
||||||
|
if (_system)
|
||||||
|
{
|
||||||
|
// Store as generated sources, but first re-parse to update the source references.
|
||||||
|
solAssert(m_generatedYulUtilityCode.empty(), "");
|
||||||
|
m_generatedYulUtilityCode = yul::AsmPrinter(dialect)(*obj.code);
|
||||||
|
string code = yul::AsmPrinter{dialect}(*obj.code);
|
||||||
|
scanner = make_shared<langutil::Scanner>(langutil::CharStream(m_generatedYulUtilityCode, _sourceName));
|
||||||
|
obj.code = yul::Parser(errorReporter, dialect).parse(scanner, false);
|
||||||
|
*obj.analysisInfo = yul::AsmAnalyzer::analyzeStrictAssertCorrect(dialect, obj);
|
||||||
|
}
|
||||||
|
|
||||||
analysisInfo = std::move(*obj.analysisInfo);
|
analysisInfo = std::move(*obj.analysisInfo);
|
||||||
parserResult = std::move(obj.code);
|
parserResult = std::move(obj.code);
|
||||||
|
|
||||||
@ -477,6 +498,12 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
cout << yul::AsmPrinter(&dialect)(*parserResult) << endl;
|
cout << yul::AsmPrinter(&dialect)(*parserResult) << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (_system)
|
||||||
|
{
|
||||||
|
// Store as generated source.
|
||||||
|
solAssert(m_generatedYulUtilityCode.empty(), "");
|
||||||
|
m_generatedYulUtilityCode = _assembly;
|
||||||
|
}
|
||||||
|
|
||||||
if (!errorReporter.errors().empty())
|
if (!errorReporter.errors().empty())
|
||||||
reportError("Failed to analyze inline assembly block.");
|
reportError("Failed to analyze inline assembly block.");
|
||||||
|
@ -163,12 +163,14 @@ public:
|
|||||||
void appendMissingLowLevelFunctions();
|
void appendMissingLowLevelFunctions();
|
||||||
ABIFunctions& abiFunctions() { return m_abiFunctions; }
|
ABIFunctions& abiFunctions() { return m_abiFunctions; }
|
||||||
YulUtilFunctions& utilFunctions() { return m_yulUtilFunctions; }
|
YulUtilFunctions& utilFunctions() { return m_yulUtilFunctions; }
|
||||||
/// @returns concatenation of all generated functions and a set of the
|
|
||||||
/// externally used functions.
|
/// Appends concatenation of all generated Yul functions to the bytecode
|
||||||
/// Clears the internal list, i.e. calling it again will result in an
|
/// and stores the Yul source code to be returned by @a generatedYulUtilityCode.
|
||||||
/// empty return value.
|
/// Should be called exactly once on each context.
|
||||||
std::pair<std::string, std::set<std::string>> requestedYulFunctions();
|
void appendYulUtilityFunctions(OptimiserSettings const& _optimiserSettings);
|
||||||
bool requestedYulFunctionsRan() const { return m_requestedYulFunctionsRan; }
|
bool appendYulUtilityFunctionsRan() const { return m_appendYulUtilityFunctionsRan; }
|
||||||
|
std::string const& generatedYulUtilityCode() const { return m_generatedYulUtilityCode; }
|
||||||
|
static std::string yulUtilityFileName() { return "#utility.yul"; }
|
||||||
|
|
||||||
/// Returns the distance of the given local variable from the bottom of the stack (of the current function).
|
/// Returns the distance of the given local variable from the bottom of the stack (of the current function).
|
||||||
unsigned baseStackOffsetOfVariable(Declaration const& _declaration) const;
|
unsigned baseStackOffsetOfVariable(Declaration const& _declaration) const;
|
||||||
@ -246,17 +248,21 @@ public:
|
|||||||
CompilerContext& operator<<(u256 const& _value) { m_asm->append(_value); return *this; }
|
CompilerContext& operator<<(u256 const& _value) { m_asm->append(_value); return *this; }
|
||||||
CompilerContext& operator<<(bytes const& _data) { m_asm->append(_data); return *this; }
|
CompilerContext& operator<<(bytes const& _data) { m_asm->append(_data); return *this; }
|
||||||
|
|
||||||
/// Appends inline assembly (strict mode).
|
/// Appends inline assembly (strict-EVM dialect for the current version).
|
||||||
/// @a _replacements are string-matching replacements that are performed prior to parsing the inline assembly.
|
/// @param _assembly the assembly text, should be a block.
|
||||||
/// @param _localVariables assigns stack positions to variables with the last one being the stack top
|
/// @param _localVariables assigns stack positions to variables with the last one being the stack top
|
||||||
/// @param _externallyUsedFunctions a set of function names that are not to be renamed or removed.
|
/// @param _externallyUsedFunctions a set of function names that are not to be renamed or removed.
|
||||||
/// @param _system if true, this is a "system-level" assembly where all functions use named labels.
|
/// @param _system if true, this is a "system-level" assembly where all functions use named labels
|
||||||
|
/// and the code is marked to be exported as "compiler-generated assembly utility file".
|
||||||
|
/// @param _optimiserSettings settings for the Yul optimiser, which is run in this function already.
|
||||||
|
/// @param _sourceName the name of the assembly file to be used for source locations
|
||||||
void appendInlineAssembly(
|
void appendInlineAssembly(
|
||||||
std::string const& _assembly,
|
std::string const& _assembly,
|
||||||
std::vector<std::string> const& _localVariables = std::vector<std::string>(),
|
std::vector<std::string> const& _localVariables = std::vector<std::string>(),
|
||||||
std::set<std::string> const& _externallyUsedFunctions = std::set<std::string>(),
|
std::set<std::string> const& _externallyUsedFunctions = std::set<std::string>(),
|
||||||
bool _system = false,
|
bool _system = false,
|
||||||
OptimiserSettings const& _optimiserSettings = OptimiserSettings::none()
|
OptimiserSettings const& _optimiserSettings = OptimiserSettings::none(),
|
||||||
|
std::string _sourceName = "--CODEGEN--"
|
||||||
);
|
);
|
||||||
|
|
||||||
/// If m_revertStrings is debug, @returns inline assembly code that
|
/// If m_revertStrings is debug, @returns inline assembly code that
|
||||||
@ -385,14 +391,17 @@ private:
|
|||||||
MultiUseYulFunctionCollector m_yulFunctionCollector;
|
MultiUseYulFunctionCollector m_yulFunctionCollector;
|
||||||
/// Set of externally used yul functions.
|
/// Set of externally used yul functions.
|
||||||
std::set<std::string> m_externallyUsedYulFunctions;
|
std::set<std::string> m_externallyUsedYulFunctions;
|
||||||
|
/// Generated Yul code used as utility. Source references from the bytecode can point here.
|
||||||
|
/// Produced from @a m_yulFunctionCollector.
|
||||||
|
std::string m_generatedYulUtilityCode;
|
||||||
/// Container for ABI functions to be generated.
|
/// Container for ABI functions to be generated.
|
||||||
ABIFunctions m_abiFunctions;
|
ABIFunctions m_abiFunctions;
|
||||||
/// Container for Yul Util functions to be generated.
|
/// Container for Yul Util functions to be generated.
|
||||||
YulUtilFunctions m_yulUtilFunctions;
|
YulUtilFunctions m_yulUtilFunctions;
|
||||||
/// The queue of low-level functions to generate.
|
/// The queue of low-level functions to generate.
|
||||||
std::queue<std::tuple<std::string, unsigned, unsigned, std::function<void(CompilerContext&)>>> m_lowLevelFunctionGenerationQueue;
|
std::queue<std::tuple<std::string, unsigned, unsigned, std::function<void(CompilerContext&)>>> m_lowLevelFunctionGenerationQueue;
|
||||||
/// Flag to check that requestedYulFunctions() was called exactly once
|
/// Flag to check that appendYulUtilityFunctions() was called exactly once
|
||||||
bool m_requestedYulFunctionsRan = false;
|
bool m_appendYulUtilityFunctionsRan = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1272,15 +1272,7 @@ void ContractCompiler::appendMissingFunctions()
|
|||||||
solAssert(m_context.nextFunctionToCompile() != function, "Compiled the wrong function?");
|
solAssert(m_context.nextFunctionToCompile() != function, "Compiled the wrong function?");
|
||||||
}
|
}
|
||||||
m_context.appendMissingLowLevelFunctions();
|
m_context.appendMissingLowLevelFunctions();
|
||||||
auto [yulFunctions, externallyUsedYulFunctions] = m_context.requestedYulFunctions();
|
m_context.appendYulUtilityFunctions(m_optimiserSettings);
|
||||||
if (!yulFunctions.empty())
|
|
||||||
m_context.appendInlineAssembly(
|
|
||||||
"{" + move(yulFunctions) + "}",
|
|
||||||
{},
|
|
||||||
externallyUsedYulFunctions,
|
|
||||||
true,
|
|
||||||
m_optimiserSettings
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContractCompiler::appendModifierOrFunctionCode()
|
void ContractCompiler::appendModifierOrFunctionCode()
|
||||||
|
@ -143,6 +143,7 @@ private:
|
|||||||
/// Pointer to the runtime compiler in case this is a creation compiler.
|
/// Pointer to the runtime compiler in case this is a creation compiler.
|
||||||
ContractCompiler* m_runtimeCompiler = nullptr;
|
ContractCompiler* m_runtimeCompiler = nullptr;
|
||||||
CompilerContext& m_context;
|
CompilerContext& m_context;
|
||||||
|
|
||||||
/// Tag to jump to for a "break" statement and the stack height after freeing the local loop variables.
|
/// Tag to jump to for a "break" statement and the stack height after freeing the local loop variables.
|
||||||
std::vector<std::pair<evmasm::AssemblyItem, unsigned>> m_breakTags;
|
std::vector<std::pair<evmasm::AssemblyItem, unsigned>> m_breakTags;
|
||||||
/// Tag to jump to for a "continue" statement and the stack height after freeing the local loop variables.
|
/// Tag to jump to for a "continue" statement and the stack height after freeing the local loop variables.
|
||||||
|
@ -57,7 +57,9 @@
|
|||||||
|
|
||||||
#include <libyul/YulString.h>
|
#include <libyul/YulString.h>
|
||||||
#include <libyul/AsmPrinter.h>
|
#include <libyul/AsmPrinter.h>
|
||||||
|
#include <libyul/AsmJsonConverter.h>
|
||||||
#include <libyul/AssemblyStack.h>
|
#include <libyul/AssemblyStack.h>
|
||||||
|
#include <libyul/AsmParser.h>
|
||||||
|
|
||||||
#include <liblangutil/Scanner.h>
|
#include <liblangutil/Scanner.h>
|
||||||
#include <liblangutil/SemVerHandler.h>
|
#include <liblangutil/SemVerHandler.h>
|
||||||
@ -591,6 +593,48 @@ evmasm::AssemblyItems const* CompilerStack::runtimeAssemblyItems(string const& _
|
|||||||
return currentContract.compiler ? &contract(_contractName).compiler->runtimeAssemblyItems() : nullptr;
|
return currentContract.compiler ? &contract(_contractName).compiler->runtimeAssemblyItems() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Json::Value CompilerStack::generatedSources(string const& _contractName, bool _runtime) const
|
||||||
|
{
|
||||||
|
if (m_stackState != CompilationSuccessful)
|
||||||
|
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));
|
||||||
|
|
||||||
|
Contract const& c = contract(_contractName);
|
||||||
|
util::LazyInit<Json::Value const> const& sources =
|
||||||
|
_runtime ?
|
||||||
|
c.runtimeGeneratedSources :
|
||||||
|
c.generatedSources;
|
||||||
|
return sources.init([&]{
|
||||||
|
Json::Value sources{Json::arrayValue};
|
||||||
|
// If there is no compiler, then no bytecode was generated and thus no
|
||||||
|
// sources were generated.
|
||||||
|
if (c.compiler)
|
||||||
|
{
|
||||||
|
string source =
|
||||||
|
_runtime ?
|
||||||
|
c.compiler->runtimeGeneratedYulUtilityCode() :
|
||||||
|
c.compiler->generatedYulUtilityCode();
|
||||||
|
if (!source.empty())
|
||||||
|
{
|
||||||
|
string sourceName = CompilerContext::yulUtilityFileName();
|
||||||
|
unsigned sourceIndex = sourceIndices()[sourceName];
|
||||||
|
ErrorList errors;
|
||||||
|
ErrorReporter errorReporter(errors);
|
||||||
|
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(source, sourceName));
|
||||||
|
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
|
||||||
|
shared_ptr<yul::Block> parserResult = yul::Parser{errorReporter, dialect}.parse(scanner, false);
|
||||||
|
solAssert(parserResult, "");
|
||||||
|
sources[0]["ast"] = yul::AsmJsonConverter{sourceIndex}(*parserResult);
|
||||||
|
sources[0]["name"] = sourceName;
|
||||||
|
sources[0]["id"] = sourceIndex;
|
||||||
|
sources[0]["language"] = "Yul";
|
||||||
|
sources[0]["contents"] = move(source);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sources;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
string const* CompilerStack::sourceMapping(string const& _contractName) const
|
string const* CompilerStack::sourceMapping(string const& _contractName) const
|
||||||
{
|
{
|
||||||
if (m_stackState != CompilationSuccessful)
|
if (m_stackState != CompilationSuccessful)
|
||||||
@ -733,6 +777,8 @@ map<string, unsigned> CompilerStack::sourceIndices() const
|
|||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
for (auto const& s: m_sources)
|
for (auto const& s: m_sources)
|
||||||
indices[s.first] = index++;
|
indices[s.first] = index++;
|
||||||
|
solAssert(!indices.count(CompilerContext::yulUtilityFileName()), "");
|
||||||
|
indices[CompilerContext::yulUtilityFileName()] = index++;
|
||||||
return indices;
|
return indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +277,10 @@ public:
|
|||||||
/// @returns runtime contract assembly items
|
/// @returns runtime contract assembly items
|
||||||
evmasm::AssemblyItems const* runtimeAssemblyItems(std::string const& _contractName) const;
|
evmasm::AssemblyItems const* runtimeAssemblyItems(std::string const& _contractName) const;
|
||||||
|
|
||||||
|
/// @returns an array containing all utility sources generated during compilation.
|
||||||
|
/// Format: [ { name: string, id: number, language: "Yul", contents: string }, ... ]
|
||||||
|
Json::Value generatedSources(std::string const& _contractName, bool _runtime = false) const;
|
||||||
|
|
||||||
/// @returns the string that provides a mapping between bytecode and sourcecode or a nullptr
|
/// @returns the string that provides a mapping between bytecode and sourcecode or a nullptr
|
||||||
/// if the contract does not (yet) have bytecode.
|
/// if the contract does not (yet) have bytecode.
|
||||||
std::string const* sourceMapping(std::string const& _contractName) const;
|
std::string const* sourceMapping(std::string const& _contractName) const;
|
||||||
@ -356,6 +360,8 @@ private:
|
|||||||
util::LazyInit<Json::Value const> storageLayout;
|
util::LazyInit<Json::Value const> storageLayout;
|
||||||
util::LazyInit<Json::Value const> userDocumentation;
|
util::LazyInit<Json::Value const> userDocumentation;
|
||||||
util::LazyInit<Json::Value const> devDocumentation;
|
util::LazyInit<Json::Value const> devDocumentation;
|
||||||
|
util::LazyInit<Json::Value const> generatedSources;
|
||||||
|
util::LazyInit<Json::Value const> runtimeGeneratedSources;
|
||||||
mutable std::optional<std::string const> sourceMapping;
|
mutable std::optional<std::string const> sourceMapping;
|
||||||
mutable std::optional<std::string const> runtimeSourceMapping;
|
mutable std::optional<std::string const> runtimeSourceMapping;
|
||||||
};
|
};
|
||||||
|
@ -230,6 +230,16 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _fil
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @returns all artifact names of the EVM object, either for creation or deploy time.
|
||||||
|
vector<string> evmObjectComponents(string const& _objectKind)
|
||||||
|
{
|
||||||
|
solAssert(_objectKind == "bytecode" || _objectKind == "deployedBytecode", "");
|
||||||
|
vector<string> components{"", ".object", ".opcodes", ".sourceMap", ".generatedSources", ".linkReferences"};
|
||||||
|
if (_objectKind == "deployedBytecode")
|
||||||
|
components.push_back(".immutableReferences");
|
||||||
|
return util::applyMap(components, [&](auto const& _s) { return "evm." + _objectKind + _s; });
|
||||||
|
}
|
||||||
|
|
||||||
/// @returns true if any binary was requested, i.e. we actually have to perform compilation.
|
/// @returns true if any binary was requested, i.e. we actually have to perform compilation.
|
||||||
bool isBinaryRequested(Json::Value const& _outputSelection)
|
bool isBinaryRequested(Json::Value const& _outputSelection)
|
||||||
{
|
{
|
||||||
@ -237,17 +247,12 @@ bool isBinaryRequested(Json::Value const& _outputSelection)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// This does not include "evm.methodIdentifiers" on purpose!
|
// This does not include "evm.methodIdentifiers" on purpose!
|
||||||
static vector<string> const outputsThatRequireBinaries{
|
static vector<string> const outputsThatRequireBinaries = vector<string>{
|
||||||
"*",
|
"*",
|
||||||
"ir", "irOptimized",
|
"ir", "irOptimized",
|
||||||
"wast", "wasm", "ewasm.wast", "ewasm.wasm",
|
"wast", "wasm", "ewasm.wast", "ewasm.wasm",
|
||||||
"evm.deployedBytecode", "evm.deployedBytecode.object", "evm.deployedBytecode.opcodes",
|
|
||||||
"evm.deployedBytecode.sourceMap", "evm.deployedBytecode.linkReferences",
|
|
||||||
"evm.deployedBytecode.immutableReferences",
|
|
||||||
"evm.bytecode", "evm.bytecode.object", "evm.bytecode.opcodes", "evm.bytecode.sourceMap",
|
|
||||||
"evm.bytecode.linkReferences",
|
|
||||||
"evm.gasEstimates", "evm.legacyAssembly", "evm.assembly"
|
"evm.gasEstimates", "evm.legacyAssembly", "evm.assembly"
|
||||||
};
|
} + evmObjectComponents("bytecode") + evmObjectComponents("deployedBytecode");
|
||||||
|
|
||||||
for (auto const& fileRequests: _outputSelection)
|
for (auto const& fileRequests: _outputSelection)
|
||||||
for (auto const& requests: fileRequests)
|
for (auto const& requests: fileRequests)
|
||||||
@ -263,15 +268,10 @@ bool isEvmBytecodeRequested(Json::Value const& _outputSelection)
|
|||||||
if (!_outputSelection.isObject())
|
if (!_outputSelection.isObject())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
static vector<string> const outputsThatRequireEvmBinaries{
|
static vector<string> const outputsThatRequireEvmBinaries = vector<string>{
|
||||||
"*",
|
"*",
|
||||||
"evm.deployedBytecode", "evm.deployedBytecode.object", "evm.deployedBytecode.opcodes",
|
|
||||||
"evm.deployedBytecode.sourceMap", "evm.deployedBytecode.linkReferences",
|
|
||||||
"evm.deployedBytecode.immutableReferences",
|
|
||||||
"evm.bytecode", "evm.bytecode.object", "evm.bytecode.opcodes", "evm.bytecode.sourceMap",
|
|
||||||
"evm.bytecode.linkReferences",
|
|
||||||
"evm.gasEstimates", "evm.legacyAssembly", "evm.assembly"
|
"evm.gasEstimates", "evm.legacyAssembly", "evm.assembly"
|
||||||
};
|
} + evmObjectComponents("bytecode") + evmObjectComponents("deployedBytecode");
|
||||||
|
|
||||||
for (auto const& fileRequests: _outputSelection)
|
for (auto const& fileRequests: _outputSelection)
|
||||||
for (auto const& requests: fileRequests)
|
for (auto const& requests: fileRequests)
|
||||||
@ -364,7 +364,12 @@ Json::Value formatImmutableReferences(map<u256, pair<string, vector<size_t>>> co
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value collectEVMObject(evmasm::LinkerObject const& _object, string const* _sourceMap, bool _runtimeObject)
|
Json::Value collectEVMObject(
|
||||||
|
evmasm::LinkerObject const& _object,
|
||||||
|
string const* _sourceMap,
|
||||||
|
Json::Value _generatedSources,
|
||||||
|
bool _runtimeObject
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Json::Value output = Json::objectValue;
|
Json::Value output = Json::objectValue;
|
||||||
output["object"] = _object.toHex();
|
output["object"] = _object.toHex();
|
||||||
@ -373,6 +378,7 @@ Json::Value collectEVMObject(evmasm::LinkerObject const& _object, string const*
|
|||||||
output["linkReferences"] = formatLinkReferences(_object.linkReferences);
|
output["linkReferences"] = formatLinkReferences(_object.linkReferences);
|
||||||
if (_runtimeObject)
|
if (_runtimeObject)
|
||||||
output["immutableReferences"] = formatImmutableReferences(_object.immutableReferences);
|
output["immutableReferences"] = formatImmutableReferences(_object.immutableReferences);
|
||||||
|
output["generatedSources"] = move(_generatedSources);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,12 +1080,13 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
|
|||||||
_inputsAndSettings.outputSelection,
|
_inputsAndSettings.outputSelection,
|
||||||
file,
|
file,
|
||||||
name,
|
name,
|
||||||
{ "evm.bytecode", "evm.bytecode.object", "evm.bytecode.opcodes", "evm.bytecode.sourceMap", "evm.bytecode.linkReferences" },
|
evmObjectComponents("bytecode"),
|
||||||
wildcardMatchesExperimental
|
wildcardMatchesExperimental
|
||||||
))
|
))
|
||||||
evmData["bytecode"] = collectEVMObject(
|
evmData["bytecode"] = collectEVMObject(
|
||||||
compilerStack.object(contractName),
|
compilerStack.object(contractName),
|
||||||
compilerStack.sourceMapping(contractName),
|
compilerStack.sourceMapping(contractName),
|
||||||
|
compilerStack.generatedSources(contractName),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1087,12 +1094,13 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
|
|||||||
_inputsAndSettings.outputSelection,
|
_inputsAndSettings.outputSelection,
|
||||||
file,
|
file,
|
||||||
name,
|
name,
|
||||||
{ "evm.deployedBytecode", "evm.deployedBytecode.object", "evm.deployedBytecode.opcodes", "evm.deployedBytecode.sourceMap", "evm.deployedBytecode.linkReferences", "evm.deployedBytecode.immutableReferences" },
|
evmObjectComponents("deployedBytecode"),
|
||||||
wildcardMatchesExperimental
|
wildcardMatchesExperimental
|
||||||
))
|
))
|
||||||
evmData["deployedBytecode"] = collectEVMObject(
|
evmData["deployedBytecode"] = collectEVMObject(
|
||||||
compilerStack.runtimeObject(contractName),
|
compilerStack.runtimeObject(contractName),
|
||||||
compilerStack.runtimeSourceMapping(contractName),
|
compilerStack.runtimeSourceMapping(contractName),
|
||||||
|
compilerStack.generatedSources(contractName, true),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1176,23 +1184,18 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
|
|||||||
tie(object, runtimeObject) = stack.assembleAndGuessRuntime();
|
tie(object, runtimeObject) = stack.assembleAndGuessRuntime();
|
||||||
|
|
||||||
for (string const& objectKind: vector<string>{"bytecode", "deployedBytecode"})
|
for (string const& objectKind: vector<string>{"bytecode", "deployedBytecode"})
|
||||||
{
|
|
||||||
auto artifacts = util::applyMap(
|
|
||||||
vector<string>{"", ".object", ".opcodes", ".sourceMap", ".linkReferences"},
|
|
||||||
[&](auto const& _s) { return "evm." + objectKind + _s; }
|
|
||||||
);
|
|
||||||
if (isArtifactRequested(
|
if (isArtifactRequested(
|
||||||
_inputsAndSettings.outputSelection,
|
_inputsAndSettings.outputSelection,
|
||||||
sourceName,
|
sourceName,
|
||||||
contractName,
|
contractName,
|
||||||
artifacts,
|
evmObjectComponents(objectKind),
|
||||||
wildcardMatchesExperimental
|
wildcardMatchesExperimental
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
MachineAssemblyObject const& o = objectKind == "bytecode" ? object : runtimeObject;
|
MachineAssemblyObject const& o = objectKind == "bytecode" ? object : runtimeObject;
|
||||||
if (o.bytecode)
|
if (o.bytecode)
|
||||||
output["contracts"][sourceName][contractName]["evm"][objectKind] = collectEVMObject(*o.bytecode, o.sourceMappings.get(), false);
|
output["contracts"][sourceName][contractName]["evm"][objectKind] =
|
||||||
}
|
collectEVMObject(*o.bytecode, o.sourceMappings.get(), Json::arrayValue, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "irOptimized", wildcardMatchesExperimental))
|
if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "irOptimized", wildcardMatchesExperimental))
|
||||||
|
@ -127,6 +127,8 @@ static string const g_strEVM = "evm";
|
|||||||
static string const g_strEVM15 = "evm15";
|
static string const g_strEVM15 = "evm15";
|
||||||
static string const g_strEVMVersion = "evm-version";
|
static string const g_strEVMVersion = "evm-version";
|
||||||
static string const g_strEwasm = "ewasm";
|
static string const g_strEwasm = "ewasm";
|
||||||
|
static string const g_strGeneratedSources = "generated-sources";
|
||||||
|
static string const g_strGeneratedSourcesRuntime = "generated-sources-runtime";
|
||||||
static string const g_strGas = "gas";
|
static string const g_strGas = "gas";
|
||||||
static string const g_strHelp = "help";
|
static string const g_strHelp = "help";
|
||||||
static string const g_strImportAst = "import-ast";
|
static string const g_strImportAst = "import-ast";
|
||||||
@ -238,6 +240,8 @@ static set<string> const g_combinedJsonArgs
|
|||||||
g_strBinary,
|
g_strBinary,
|
||||||
g_strBinaryRuntime,
|
g_strBinaryRuntime,
|
||||||
g_strCompactJSON,
|
g_strCompactJSON,
|
||||||
|
g_strGeneratedSources,
|
||||||
|
g_strGeneratedSourcesRuntime,
|
||||||
g_strInterface,
|
g_strInterface,
|
||||||
g_strMetadata,
|
g_strMetadata,
|
||||||
g_strNatspecUser,
|
g_strNatspecUser,
|
||||||
@ -1523,6 +1527,10 @@ void CommandLineInterface::handleCombinedJSON()
|
|||||||
contractData[g_strAsm] = m_compiler->assemblyJSON(contractName);
|
contractData[g_strAsm] = m_compiler->assemblyJSON(contractName);
|
||||||
if (requests.count(g_strStorageLayout) && m_compiler->compilationSuccessful())
|
if (requests.count(g_strStorageLayout) && m_compiler->compilationSuccessful())
|
||||||
contractData[g_strStorageLayout] = jsonCompactPrint(m_compiler->storageLayout(contractName));
|
contractData[g_strStorageLayout] = jsonCompactPrint(m_compiler->storageLayout(contractName));
|
||||||
|
if (requests.count(g_strGeneratedSources) && m_compiler->compilationSuccessful())
|
||||||
|
contractData[g_strGeneratedSources] = m_compiler->generatedSources(contractName, false);
|
||||||
|
if (requests.count(g_strGeneratedSourcesRuntime) && m_compiler->compilationSuccessful())
|
||||||
|
contractData[g_strGeneratedSourcesRuntime] = m_compiler->generatedSources(contractName, true);
|
||||||
if (requests.count(g_strSrcMap) && m_compiler->compilationSuccessful())
|
if (requests.count(g_strSrcMap) && m_compiler->compilationSuccessful())
|
||||||
{
|
{
|
||||||
auto map = m_compiler->sourceMapping(contractName);
|
auto map = m_compiler->sourceMapping(contractName);
|
||||||
|
@ -124,6 +124,7 @@ function test_solc_behaviour()
|
|||||||
sed -i.bak -e '/^Warning (3805): This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
|
sed -i.bak -e '/^Warning (3805): This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
|
||||||
sed -i.bak -e 's/\(^[ ]*auxdata: \)0x[0-9a-f]*$/\1AUXDATA REMOVED/' "$stdout_path"
|
sed -i.bak -e 's/\(^[ ]*auxdata: \)0x[0-9a-f]*$/\1AUXDATA REMOVED/' "$stdout_path"
|
||||||
sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path"
|
sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path"
|
||||||
|
sed -i.bak -e 's/"version": "[^"]*"/"version": "VERSION REMOVED"/' "$stdout_path"
|
||||||
# Remove trailing empty lines. Needs a line break to make OSX sed happy.
|
# Remove trailing empty lines. Needs a line break to make OSX sed happy.
|
||||||
sed -i.bak -e '1{/^$/d
|
sed -i.bak -e '1{/^$/d
|
||||||
}' "$stderr_path"
|
}' "$stderr_path"
|
||||||
|
1
test/cmdlineTests/combined_json_generated_sources/args
Normal file
1
test/cmdlineTests/combined_json_generated_sources/args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--combined-json generated-sources,generated-sources-runtime --pretty-json
|
5
test/cmdlineTests/combined_json_generated_sources/err
Normal file
5
test/cmdlineTests/combined_json_generated_sources/err
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
|
||||||
|
--> combined_json_generated_sources/input.sol
|
||||||
|
|
||||||
|
Warning: Source file does not specify required compiler version!
|
||||||
|
--> combined_json_generated_sources/input.sol
|
1
test/cmdlineTests/combined_json_generated_sources/exit
Normal file
1
test/cmdlineTests/combined_json_generated_sources/exit
Normal file
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1,5 @@
|
|||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function f(uint[] calldata) pure external {}
|
||||||
|
}
|
735
test/cmdlineTests/combined_json_generated_sources/output
Normal file
735
test/cmdlineTests/combined_json_generated_sources/output
Normal file
@ -0,0 +1,735 @@
|
|||||||
|
{
|
||||||
|
"contracts":
|
||||||
|
{
|
||||||
|
"combined_json_generated_sources/input.sol:C":
|
||||||
|
{
|
||||||
|
"generated-sources": [],
|
||||||
|
"generated-sources-runtime":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ast":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "0:823:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "114:277:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "163:16:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"expression":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "172:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "175:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "revert",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "165:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "165:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulExpressionStatement",
|
||||||
|
"src": "165:12:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "142:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "150:4:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0x1f"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "add",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "138:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "138:17:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "end",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "157:3:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "slt",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "134:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "134:27:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "iszero",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "127:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "127:35:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulIf",
|
||||||
|
"src": "124:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nodeType": "YulAssignment",
|
||||||
|
"src": "188:30:1",
|
||||||
|
"value":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "211:6:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "calldataload",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "198:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "198:20:1"
|
||||||
|
},
|
||||||
|
"variableNames":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "length",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "188:6:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "261:16:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"expression":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "270:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "273:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "revert",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "263:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "263:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulExpressionStatement",
|
||||||
|
"src": "263:12:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "length",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "233:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "241:18:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0xffffffffffffffff"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "gt",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "230:2:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "230:30:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulIf",
|
||||||
|
"src": "227:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nodeType": "YulAssignment",
|
||||||
|
"src": "286:29:1",
|
||||||
|
"value":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "302:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "310:4:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0x20"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "add",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "298:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "298:17:1"
|
||||||
|
},
|
||||||
|
"variableNames":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "arrayPos",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "286:8:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "369:16:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"expression":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "378:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "381:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "revert",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "371:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "371:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulExpressionStatement",
|
||||||
|
"src": "371:12:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "arrayPos",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "334:8:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "length",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "348:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "356:4:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0x20"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "mul",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "344:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "344:17:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "add",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "330:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "330:32:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "end",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "364:3:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "gt",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "327:2:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "327:41:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulIf",
|
||||||
|
"src": "324:2:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr",
|
||||||
|
"nodeType": "YulFunctionDefinition",
|
||||||
|
"parameters":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "81:6:1",
|
||||||
|
"type": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "end",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "89:3:1",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"returnVariables":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "arrayPos",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "97:8:1",
|
||||||
|
"type": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "length",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "107:6:1",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"src": "24:367:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "498:322:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "544:16:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"expression":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "553:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "556:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "revert",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "546:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "546:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulExpressionStatement",
|
||||||
|
"src": "546:12:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "dataEnd",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "519:7:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "headStart",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "528:9:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "sub",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "515:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "515:23:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "540:2:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "32"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "slt",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "511:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "511:32:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulIf",
|
||||||
|
"src": "508:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "570:243:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"nodeType": "YulVariableDeclaration",
|
||||||
|
"src": "584:45:1",
|
||||||
|
"value":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "headStart",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "615:9:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "626:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "add",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "611:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "611:17:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "calldataload",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "598:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "598:31:1"
|
||||||
|
},
|
||||||
|
"variables":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "588:6:1",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body":
|
||||||
|
{
|
||||||
|
"nodeType": "YulBlock",
|
||||||
|
"src": "676:16:1",
|
||||||
|
"statements":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"expression":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "685:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "688:1:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "revert",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "678:6:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "678:12:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulExpressionStatement",
|
||||||
|
"src": "678:12:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"condition":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "648:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "number",
|
||||||
|
"nodeType": "YulLiteral",
|
||||||
|
"src": "656:18:1",
|
||||||
|
"type": "",
|
||||||
|
"value": "0xffffffffffffffff"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "gt",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "645:2:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "645:30:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulIf",
|
||||||
|
"src": "642:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nodeType": "YulAssignment",
|
||||||
|
"src": "705:98:1",
|
||||||
|
"value":
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "headStart",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "775:9:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "offset",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "786:6:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "add",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "771:3:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "771:22:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dataEnd",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "795:7:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functionName":
|
||||||
|
{
|
||||||
|
"name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "723:47:1"
|
||||||
|
},
|
||||||
|
"nodeType": "YulFunctionCall",
|
||||||
|
"src": "723:80:1"
|
||||||
|
},
|
||||||
|
"variableNames":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "value0",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "705:6:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "value1",
|
||||||
|
"nodeType": "YulIdentifier",
|
||||||
|
"src": "713:6:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr",
|
||||||
|
"nodeType": "YulFunctionDefinition",
|
||||||
|
"parameters":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "headStart",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "460:9:1",
|
||||||
|
"type": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dataEnd",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "471:7:1",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"returnVariables":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "value0",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "483:6:1",
|
||||||
|
"type": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "value1",
|
||||||
|
"nodeType": "YulTypedName",
|
||||||
|
"src": "491:6:1",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"src": "397:423:1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"contents": "{\n\n // uint256[]\n function abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(offset, end) -> arrayPos, length {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n length := calldataload(offset)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n arrayPos := add(offset, 0x20)\n if gt(add(arrayPos, mul(length, 0x20)), end) { revert(0, 0) }\n }\n\n function abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n value0, value1 := abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n}\n",
|
||||||
|
"id": 1,
|
||||||
|
"language": "Yul",
|
||||||
|
"name": "#utility.yul"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "VERSION REMOVED"
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
||||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
||||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"B2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
||||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure
|
||||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||||
^------------------------------------------^
|
^------------------------------------------^
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||||
|
20
test/cmdlineTests/standard_generatedSources/input.json
Normal file
20
test/cmdlineTests/standard_generatedSources/input.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"language": "Solidity",
|
||||||
|
"sources": {
|
||||||
|
"a.sol": {
|
||||||
|
"content": "// SPDX-License-Identifier: GPL-3.0\npragma experimental ABIEncoderV2; contract A { function f(uint[] memory) public view returns (uint256) { } }"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"evmVersion": "petersburg",
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"A": [
|
||||||
|
"evm.bytecode.object",
|
||||||
|
"evm.deployedBytecode.generatedSources",
|
||||||
|
"evm.bytecode.generatedSources"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
test/cmdlineTests/standard_generatedSources/output.json
Normal file
77
test/cmdlineTests/standard_generatedSources/output.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
|||||||
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"generatedSources":[],"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}}
|
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"language": "Solidity",
|
||||||
|
"sources": {
|
||||||
|
"a.sol": {
|
||||||
|
"content": "// SPDX-License-Identifier: GPL-3.0\npragma experimental ABIEncoderV2; contract A { function f(uint[] memory) public view returns (uint256) { } }"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"evmVersion": "petersburg",
|
||||||
|
"optimizer": { "enabled": true },
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"A": [
|
||||||
|
"evm.bytecode.object",
|
||||||
|
"evm.deployedBytecode.generatedSources",
|
||||||
|
"evm.bytecode.generatedSources"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@
|
|||||||
sstore
|
sstore
|
||||||
/* \"A\":0:42 */
|
/* \"A\":0:42 */
|
||||||
pop
|
pop
|
||||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
","bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||||
code {
|
code {
|
||||||
let x := mload(0)
|
let x := mload(0)
|
||||||
sstore(add(x, 0), 0)
|
sstore(add(x, 0), 0)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
pop
|
pop
|
||||||
stop
|
stop
|
||||||
data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263
|
data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263
|
||||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
","bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
||||||
code {
|
code {
|
||||||
let x := dataoffset(\"DataName\")
|
let x := dataoffset(\"DataName\")
|
||||||
sstore(add(x, 0), 0)
|
sstore(add(x, 0), 0)
|
||||||
|
@ -22,7 +22,7 @@ sub_0: assembly {
|
|||||||
/* \"A\":137:149 */
|
/* \"A\":137:149 */
|
||||||
revert
|
revert
|
||||||
}
|
}
|
||||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"deployedBytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
","bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"deployedBytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
||||||
code {
|
code {
|
||||||
let x := dataoffset(\"DataName\")
|
let x := dataoffset(\"DataName\")
|
||||||
sstore(add(x, 0), 0)
|
sstore(add(x, 0), 0)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/* \"A\":20:40 */
|
/* \"A\":20:40 */
|
||||||
sstore
|
sstore
|
||||||
pop
|
pop
|
||||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
","bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||||
code {
|
code {
|
||||||
let x := mload(0)
|
let x := mload(0)
|
||||||
sstore(add(x, 0), 0)
|
sstore(add(x, 0), 0)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
mload
|
mload
|
||||||
/* \"A\":20:40 */
|
/* \"A\":20:40 */
|
||||||
sstore
|
sstore
|
||||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
","bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||||
code {
|
code {
|
||||||
let x := mload(0)
|
let x := mload(0)
|
||||||
sstore(add(x, 0), 0)
|
sstore(add(x, 0), 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user