-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle calldata-related opcodes in constructor
- Loading branch information
1 parent
0419d3e
commit 707d817
Showing
5 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
system-contracts/evm-emulator/calldata-opcodes/ConstructorScope.template.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function $llvm_AlwaysInline_llvm$_calldatasize() -> size { | ||
size := 0 | ||
} | ||
|
||
function $llvm_AlwaysInline_llvm$_calldatacopy(dstOffset, sourceOffset, truncatedLen) { | ||
$llvm_AlwaysInline_llvm$_memsetToZero(dstOffset, truncatedLen) | ||
} | ||
|
||
function $llvm_AlwaysInline_llvm$_calldataload(calldataOffset) -> res { | ||
res := 0 | ||
} |
14 changes: 14 additions & 0 deletions
14
system-contracts/evm-emulator/calldata-opcodes/RuntimeScope.template.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function $llvm_AlwaysInline_llvm$_calldatasize() -> size { | ||
size := calldatasize() | ||
} | ||
|
||
function $llvm_AlwaysInline_llvm$_calldatacopy(dstOffset, sourceOffset, truncatedLen) { | ||
calldatacopy(dstOffset, sourceOffset, truncatedLen) | ||
} | ||
|
||
function $llvm_AlwaysInline_llvm$_calldataload(calldataOffset) -> res { | ||
// EraVM will revert if offset + length overflows uint32 | ||
if lt(calldataOffset, UINT32_MAX()) { | ||
res := calldataload(calldataOffset) | ||
} | ||
} |