Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libevmasm/AssemblyItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength) const
return 1 + _addressLength;
case PushLibraryAddress:
case PushDeployTimeAddress:
return 1 + 20;
return 1 + 22;
case PushImmutable:
return 1 + 32;
case AssignImmutable:
Expand Down
8 changes: 4 additions & 4 deletions libsolidity/codegen/CompilerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound
{
combineExternalFunctionType(true);
m_context << Instruction::DUP2 << Instruction::MSTORE;
m_context << u256(_padToWordBoundaries ? 32 : 24) << Instruction::ADD;
m_context << u256(_type.calldataEncodedSize(_padToWordBoundaries)) << Instruction::ADD;
}
else if (_type.isValueType())
{
Expand Down Expand Up @@ -714,10 +714,10 @@ void CompilerUtils::splitExternalFunctionType(bool _leftAligned)
if (_leftAligned)
{
m_context << Instruction::DUP1;
rightShiftNumberOnStack(64 + 32);
rightShiftNumberOnStack(48 + 32);
// <input> <address>
m_context << Instruction::SWAP1;
rightShiftNumberOnStack(64);
rightShiftNumberOnStack(48);
}
else
{
Expand All @@ -737,7 +737,7 @@ void CompilerUtils::combineExternalFunctionType(bool _leftAligned)
leftShiftNumberOnStack(32);
m_context << Instruction::OR;
if (_leftAligned)
leftShiftNumberOnStack(64);
leftShiftNumberOnStack(48);
}

void CompilerUtils::pushCombinedFunctionEntryLabel(Declaration const& _function, bool _runtimeOnly)
Expand Down
6 changes: 3 additions & 3 deletions libsolidity/codegen/ContractCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ size_t ContractCompiler::deployLibrary(ContractDefinition const& _contract)
m_context.appendInlineAssembly(
Whiskers(R"(
{
// If code starts at 11, an mstore(0) writes to the full PUSH20 plus data
// If code starts at 9, an mstore(0) writes to the full PUSH22 plus data
// without the need for a shift.
let codepos := 11
let codepos := 9
codecopy(codepos, subOffset, subSize)
// Check that the first opcode is a PUSH22
if iszero(eq(0x75, byte(0, mload(codepos)))) {
Expand Down Expand Up @@ -306,7 +306,7 @@ void ContractCompiler::appendConstructor(FunctionDefinition const& _constructor)
void ContractCompiler::appendDelegatecallCheck()
{
// Special constant that will be replaced by the address at deploy time.
// At compilation time, this is just "PUSH20 00...000".
// At compilation time, this is just "PUSH22 00...000".
m_context.appendDeployTimeAddress();
m_context << Instruction::ADDRESS << Instruction::EQ;
// The result on the stack is
Expand Down
6 changes: 2 additions & 4 deletions libsolidity/formal/SMTEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,11 @@ void SMTEncoder::visitCryptoFunction(FunctionCall const& _funCall)
{
auto e = state().cryptoFunction("ecrecover");
auto arg0 = expr(*_funCall.arguments().at(0));
auto arg1 = expr(*_funCall.arguments().at(1));
auto arg2 = expr(*_funCall.arguments().at(2));
auto arg3 = expr(*_funCall.arguments().at(3));
auto arg1 = expr(*_funCall.arguments().at(1), TypeProvider::bytesStorage());
auto inputSort = dynamic_cast<smtutil::ArraySort&>(*e.sort).domain;
auto ecrecoverInput = smtutil::Expression::tuple_constructor(
smtutil::Expression(make_shared<smtutil::SortSort>(inputSort), ""),
{arg0, arg1, arg2, arg3}
{arg0, arg1}
);
result = smtutil::Expression::select(e, ecrecoverInput);
}
Expand Down
6 changes: 2 additions & 4 deletions libsolidity/formal/SymbolicState.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,10 @@ class SymbolicState
{"ecrecover", std::make_shared<smtutil::ArraySort>(
std::make_shared<smtutil::TupleSort>(
"ecrecover_input_type",
std::vector<std::string>{"hash", "v", "r", "s"},
std::vector<std::string>{"hash", "signature"},
std::vector<smtutil::SortPointer>{
smt::smtSort(*TypeProvider::fixedBytes(32)),
smt::smtSort(*TypeProvider::uint(8)),
smt::smtSort(*TypeProvider::fixedBytes(32)),
smt::smtSort(*TypeProvider::fixedBytes(32))
smt::smtSort(*TypeProvider::bytesStorage())
}
),
smtSort(*TypeProvider::address())
Expand Down
2 changes: 1 addition & 1 deletion libsolidity/interface/StandardCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Json::Value formatLinkReferences(std::map<size_t, std::string> const& linkRefere

Json::Value entry = Json::objectValue;
entry["start"] = Json::UInt(ref.first);
entry["length"] = 20;
entry["length"] = 22;

libraryArray.append(entry);
fileObject[name] = libraryArray;
Expand Down
2 changes: 1 addition & 1 deletion libyul/backends/evm/AbstractAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AbstractAssembly
/// Returns a label identified by the given name. Creates it if it does not yet exist.
virtual LabelID namedLabel(std::string const& _name) = 0;
/// Append a reference to a to-be-linked symbol.
/// Currently, we assume that the value is always a 20 byte number.
/// Currently, we assume that the value is always a 22 byte number.
virtual void appendLinkerSymbol(std::string const& _name) = 0;

/// Append a jump instruction.
Expand Down
2 changes: 1 addition & 1 deletion libyul/backends/evm/EVMAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class EVMAssembly: public AbstractAssembly
/// Returns a label identified by the given name. Creates it if it does not yet exist.
LabelID namedLabel(std::string const& _name) override;
/// Append a reference to a to-be-linked symbol.
/// Currently, we assume that the value is always a 20 byte number.
/// Currently, we assume that the value is always a 22 byte number.
void appendLinkerSymbol(std::string const& _name) override;

/// Append a jump instruction.
Expand Down
Loading