Skip to content

Commit

Permalink
eof: Addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Jan 27, 2025
1 parent 6f3ae66 commit 39c23d8
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 48 deletions.
9 changes: 8 additions & 1 deletion libevmasm/Assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,14 @@ LinkerObject const& Assembly::assembleEOF() const

ptrdiff_t const relativeJumpOffset = static_cast<ptrdiff_t>(tagPos) - (static_cast<ptrdiff_t>(refPos) + 2);
// This cannot happen in practice because we'll run into section size limit first.
solAssert(-0x8000 <= relativeJumpOffset && relativeJumpOffset <= 0x7FFF, "Relative jump too far");
if (!(-0x8000 <= relativeJumpOffset && relativeJumpOffset <= 0x7FFF))
// TODO: Include source location. Note that origin locations we have in debug data are
// not usable for error reporting when compiling pure Yul because they point at the optimized source.
throw Error(
2703_error,
Error::Type::CodeGenerationError,
"Relative jump too far"
);
solAssert(relativeJumpOffset < -2 || 0 <= relativeJumpOffset, "Relative jump offset into immediate argument.");
setBigEndianUint16(ret.bytecode, refPos, static_cast<size_t>(static_cast<uint16_t>(relativeJumpOffset)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma abicoder v2;

contract C {
uint[][2] public tmp_i;
function i(uint[][2] calldata s) external { tmp_i = s; }
uint[][2] public tmp_i;
function i(uint[][2] calldata s) external { tmp_i = s; }
}
// ====
// compileViaYul: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pragma abicoder v2;

contract C {
uint[][] public tmp_i;
function i(uint[][] calldata s) external { tmp_i = s; }
uint[][] public tmp_i;
function i(uint[][] calldata s) external { tmp_i = s; }
}

// ====
// compileViaYul: true
// ----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ contract C {
}

// ====
// bytecodeFormat: legacy
// compileViaYul: false
// ----
// UnimplementedFeatureError 1834: (35-127): Copying nested calldata dynamic arrays to storage is not implemented in the old code generator.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ contract C {
}

// ====
// bytecodeFormat: legacy
// compileViaYul: false
// ----
// UnimplementedFeatureError 1834: (35-125): Copying nested calldata dynamic arrays to storage is not implemented in the old code generator.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ contract C {
this.f{value: 42}.address;
}
}
// ====
// bytecodeFormat: legacy
// ----
// Warning 6321: (64-68): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ contract C {
}
}
}
// ====
// bytecodeFormat: legacy
// ----
14 changes: 14 additions & 0 deletions test/libsolidity/syntaxTests/sizeLimits/eof/bytecode_too_large.sol

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ contract C {
h;
}
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 2056: (94-103): This type cannot be encoded.
// TypeError 2056: (105-106): This type cannot be encoded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ contract C {
this.f{value: 42};
}
}
// ====
// bytecodeFormat: >=EOFv1
// ----

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ contract C {
}
}
// ====
// EVMVersion: >=paris
// bytecodeFormat: >=EOFv1
// ----
// Warning 5740: (89-1400): Unreachable code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ contract C {
}
}
// ====
// EVMVersion: >=london
// bytecodeFormat: >=EOFv1
// ----
// Warning 5740: (94-1425): Unreachable code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ contract C {
}
}
// ====
// EVMVersion: >=paris
// bytecodeFormat: >=EOFv1
// ----
// Warning 5740: (94-1411): Unreachable code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ contract C {
pop(caller())
pop(callvalue())
pop(extcall(0, 1, 2, 3))
pop(extstaticcall(0, 1, 2))
pop(extdelegatecall(0, 1, 2))
log0(0, 1)
log1(0, 1, 2)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ contract C {
}
}
// ====
// EVMVersion: >=london
// bytecodeFormat: >=EOFv1
// ----
// TypeError 8961: (75-87): Function cannot be declared as view because this expression (potentially) modifies the state.
Expand Down

0 comments on commit 39c23d8

Please sign in to comment.