Skip to content

Commit

Permalink
change rawSystemCall interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vladenysiuk committed Apr 2, 2024
1 parent c83f6ae commit b0eed77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
15 changes: 8 additions & 7 deletions system-contracts/contracts/EvmInterpreter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ contract EvmInterpreter {
uint32 dataStart = 0;
uint32 dataLength = 36;

bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 36, true);
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 36, 0, 32);
assembly {
if iszero(success) {
// This error should never happen
Expand Down Expand Up @@ -433,7 +433,7 @@ contract EvmInterpreter {
mstore(4, key)
mstore(36, currentValue)
}
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 68, true);
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 68, 0, 64);
assembly {
if iszero(success) {
// This error should never happen
Expand Down Expand Up @@ -2313,7 +2313,7 @@ contract EvmInterpreter {
mstore(4, _passGas)
mstore(36, _isStatic)
}
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 68, true);
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 68, 0, 0);
assembly {
if iszero(success) {
// This error should never happen
Expand All @@ -2328,7 +2328,7 @@ contract EvmInterpreter {
assembly {
mstore(0, selector)
}
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 4, true);
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 4, 0, 0);
assembly {
if iszero(success) {
// This error should never happen
Expand All @@ -2343,14 +2343,15 @@ contract EvmInterpreter {
assembly {
mstore(0, selector)
}
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 4, true);
bool success = SystemContractsCaller.rawSystemCall(uint32(gasleft()), addr, 0, 0, 4, 0, 64);
assembly {
_passGas := mload(0)
isStatic := mload(32)
if iszero(success) {
// This error should never happen
revert(0, 0)
}

_passGas := mload(0)
isStatic := mload(32)
}

if (_passGas != INF_PASS_GAS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ library SystemContractsCaller {
uint256 value,
uint32 dataStart,
uint32 dataLength,
bool returnDataCopy
uint32 returnDataStart,
uint32 returndataLength
) internal returns (bool success) {
address callAddr = SYSTEM_CALL_CALL_ADDRESS;
uint256 farCallAbi = SystemContractsCaller.getFarCallABI(
Expand Down Expand Up @@ -113,10 +114,10 @@ library SystemContractsCaller {
success := call(msgValueSimulator, callAddr, value, to, farCallAbi, forwardMask, 0)
}
}
if (success && returnDataCopy) {
if (success) {
assembly {
let returndataSize := returndatasize()
returndatacopy(0, 0, returndataSize)
returndatacopy(0, returnDataStart, returndataLength)
}
}
}
Expand All @@ -134,7 +135,7 @@ library SystemContractsCaller {
dataStart := add(data, 0x20)
}
uint32 dataLength = uint32(Utils.safeCastToU32(data.length));
success = rawSystemCall(gasLimit, to, value, dataStart, dataLength, false);
success = rawSystemCall(gasLimit, to, value, dataStart, dataLength, 0, 0);
}

/// @notice Makes a call with the `isSystem` flag.
Expand Down

0 comments on commit b0eed77

Please sign in to comment.