Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add callee params to lsp20 & EXECUTE_RELAY_CALL permission & mapping reentrancyStatus #729

Merged
merged 25 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0825ae3
feat!: add callee params to lsp20
skimaharvey Sep 26, 2023
7b27c64
chore: update lsp6 to with new lsp20 interface
skimaharvey Sep 26, 2023
79b7b06
test: update tests to work with new lsp20 interface
skimaharvey Sep 26, 2023
b0552a4
refactor: update constants.ts file
skimaharvey Sep 26, 2023
f5bfd09
test: fix failing tests
skimaharvey Sep 26, 2023
5b52316
test: fix foundry tests
skimaharvey Sep 26, 2023
62e2679
docs: generate lsp6 new abi docs
skimaharvey Sep 26, 2023
085dbad
docs: update lsp6 interfaceID
skimaharvey Sep 26, 2023
5889edf
feat!: add EXECUTE_RELAY_CALL permission
skimaharvey Sep 26, 2023
234fb6e
refactor: move `EXECUTE_RELAY_CALL` permission as last bit in permiss…
CJ42 Sep 27, 2023
a0545ab
test: fix lsp6 tests
skimaharvey Sep 27, 2023
4a0696a
feat!: add LSP6ExecuteRelayCallModule to LSP6
skimaharvey Sep 30, 2023
e72566b
test: add EXECUTE_RELAY_CALL test
skimaharvey Sep 30, 2023
ca9c9dd
test: modify reentrancy tests with EXECUTE_RELAY_CALL permission
skimaharvey Sep 30, 2023
69556c3
Merge branch 'develop' of https://github.com/lukso-network/lsp-smart-…
skimaharvey Sep 30, 2023
8736873
refactor: use uint8 for reentrancyStatus
skimaharvey Sep 30, 2023
550b608
docs: build lsp6 docs
skimaharvey Sep 30, 2023
09c283e
test: fix reentrancy test
skimaharvey Oct 1, 2023
32ae896
refactor: use mapping for reentrancyStatus
skimaharvey Oct 1, 2023
8cb66d4
refactor: rename callee to targetContract
skimaharvey Oct 1, 2023
91fcc47
docs: update docs with targetContract
skimaharvey Oct 1, 2023
685872c
refactor: use uint256 for `reentrancyStatus`
skimaharvey Oct 2, 2023
7850888
Merge branch 'develop' of github.com:lukso-network/lsp-smart-contract…
skimaharvey Oct 2, 2023
7ae6051
refactor: use bool for reentrancyStatus
skimaharvey Oct 2, 2023
8e9963c
reactor: remove cast to bytes1 in _verifyCall
skimaharvey Oct 2, 2023
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
59 changes: 30 additions & 29 deletions constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const INTERFACE_IDS = {
ERC725Y: '0x629aa694',
LSP0ERC725Account: '0x24871b3d',
LSP1UniversalReceiver: '0x6bb56a14',
LSP6KeyManager: '0x66918867',
LSP6KeyManager: '0xe7424397',
LSP7DigitalAsset: '0x05519512',
LSP8IdentifiableDigitalAsset: '0x1ae9ba1f',
LSP9Vault: '0x28af17e6',
Expand All @@ -35,7 +35,7 @@ export const INTERFACE_IDS = {
LSP17Extendable: '0xa918fa6b',
LSP17Extension: '0xcee78b40',
LSP20CallVerification: '0x1a0eb6a5',
LSP20CallVerifier: '0x480c0ec2',
LSP20CallVerifier: '0xc9dfc532',
LSP25ExecuteRelayCall: '0x5ac79908',
};

Expand All @@ -60,10 +60,10 @@ export const ERC1271_VALUES = {
*/
export const LSP20_MAGIC_VALUES = {
VERIFY_CALL: {
// bytes3(keccak256("lsp20VerifyCall(address,uint256,bytes)")) + "0x01"
WITH_POST_VERIFICATION: '0x9bf04b01',
// bytes3(keccak256("lsp20VerifyCall(address,uint256,bytes)")) + "0x00"
NO_POST_VERIFICATION: '0x9bf04b00',
// bytes3(keccak256("lsp20VerifyCall(address,address,uint256,bytes)")) + "0x00"
NO_POST_VERIFICATION: '0x1a238000',
// bytes3(keccak256("lsp20VerifyCall(address,address,uint256,bytes)")) + "0x01"
WITH_POST_VERIFICATION: '0x1a238001',
},
// bytes4(keccak256("lsp20VerifyCallResult(bytes32,bytes)"))
VERIFY_CALL_RESULT: '0xd3fc45d3',
Expand Down Expand Up @@ -274,7 +274,7 @@ export const CALLTYPE = {
/**
* @dev `bytes32` hex value for all the LSP6 permissions excluding REENTRANCY, DELEGATECALL and SUPER_DELEGATECALL for security (these should be set manually)
*/
export const ALL_PERMISSIONS = '0x00000000000000000000000000000000000000000000000000000000003f3f7f';
export const ALL_PERMISSIONS = '0x00000000000000000000000000000000000000000000000000000000007f3f7f';
skimaharvey marked this conversation as resolved.
Show resolved Hide resolved

export type LSP6PermissionName = keyof typeof PERMISSIONS;

Expand All @@ -283,28 +283,29 @@ export type LSP6PermissionName = keyof typeof PERMISSIONS;
*/
// prettier-ignore
export const PERMISSIONS = {
CHANGEOWNER: "0x0000000000000000000000000000000000000000000000000000000000000001",
ADDCONTROLLER: "0x0000000000000000000000000000000000000000000000000000000000000002",
EDITPERMISSIONS: "0x0000000000000000000000000000000000000000000000000000000000000004",
ADDEXTENSIONS: "0x0000000000000000000000000000000000000000000000000000000000000008",
CHANGEEXTENSIONS: "0x0000000000000000000000000000000000000000000000000000000000000010",
ADDUNIVERSALRECEIVERDELEGATE: "0x0000000000000000000000000000000000000000000000000000000000000020",
CHANGEUNIVERSALRECEIVERDELEGATE: "0x0000000000000000000000000000000000000000000000000000000000000040",
REENTRANCY: "0x0000000000000000000000000000000000000000000000000000000000000080",
SUPER_TRANSFERVALUE: "0x0000000000000000000000000000000000000000000000000000000000000100",
TRANSFERVALUE: "0x0000000000000000000000000000000000000000000000000000000000000200",
SUPER_CALL: "0x0000000000000000000000000000000000000000000000000000000000000400",
CALL: "0x0000000000000000000000000000000000000000000000000000000000000800",
SUPER_STATICCALL: "0x0000000000000000000000000000000000000000000000000000000000001000",
STATICCALL: "0x0000000000000000000000000000000000000000000000000000000000002000",
SUPER_DELEGATECALL: "0x0000000000000000000000000000000000000000000000000000000000004000",
DELEGATECALL: "0x0000000000000000000000000000000000000000000000000000000000008000",
DEPLOY: "0x0000000000000000000000000000000000000000000000000000000000010000",
SUPER_SETDATA: "0x0000000000000000000000000000000000000000000000000000000000020000",
SETDATA: "0x0000000000000000000000000000000000000000000000000000000000040000",
ENCRYPT: "0x0000000000000000000000000000000000000000000000000000000000080000",
DECRYPT: "0x0000000000000000000000000000000000000000000000000000000000100000",
SIGN: "0x0000000000000000000000000000000000000000000000000000000000200000",
CHANGEOWNER: '0x0000000000000000000000000000000000000000000000000000000000000001', // .... .... .... .... .... 0001
ADDCONTROLLER: '0x0000000000000000000000000000000000000000000000000000000000000002', // .... .... .... .... .... 0010
EDITPERMISSIONS: '0x0000000000000000000000000000000000000000000000000000000000000004', // .... .... .... .... .... 0100
ADDEXTENSIONS: '0x0000000000000000000000000000000000000000000000000000000000000008', // .... .... .... .... .... 1000
CHANGEEXTENSIONS: '0x0000000000000000000000000000000000000000000000000000000000000010', // .... .... .... .... 0001 0000
ADDUNIVERSALRECEIVERDELEGATE: '0x0000000000000000000000000000000000000000000000000000000000000020', // .... .... .... .... 0010 0000
CHANGEUNIVERSALRECEIVERDELEGATE: '0x0000000000000000000000000000000000000000000000000000000000000040', // .... .... .... .... 0100 0000
REENTRANCY: '0x0000000000000000000000000000000000000000000000000000000000000080', // .... .... .... .... 1000 0000
SUPER_TRANSFERVALUE: '0x0000000000000000000000000000000000000000000000000000000000000100', // .... .... .... 0001 0000 0000
TRANSFERVALUE: '0x0000000000000000000000000000000000000000000000000000000000000200', // .... .... .... 0010 0000 0000
SUPER_CALL: '0x0000000000000000000000000000000000000000000000000000000000000400', // .... .... .... 0100 0000 0000
CALL: '0x0000000000000000000000000000000000000000000000000000000000000800', // .... .... .... 1000 0000 0000
SUPER_STATICCALL: '0x0000000000000000000000000000000000000000000000000000000000001000', // .... .... 0001 0000 0000 0000
STATICCALL: '0x0000000000000000000000000000000000000000000000000000000000002000', // .... .... 0010 0000 0000 0000
SUPER_DELEGATECALL: '0x0000000000000000000000000000000000000000000000000000000000004000', // .... .... 0100 0000 0000 0000
DELEGATECALL: '0x0000000000000000000000000000000000000000000000000000000000008000', // .... .... 1000 0000 0000 0000
DEPLOY: '0x0000000000000000000000000000000000000000000000000000000000010000', // .... 0001 0000 0000 0000 0000
SUPER_SETDATA: '0x0000000000000000000000000000000000000000000000000000000000020000', // .... 0010 0000 0000 0000 0000
SETDATA: '0x0000000000000000000000000000000000000000000000000000000000040000', // .... 0100 0000 0000 0000 0000
ENCRYPT: '0x0000000000000000000000000000000000000000000000000000000000080000', // .... 1000 0000 0000 0000 0000
DECRYPT: '0x0000000000000000000000000000000000000000000000000000000000100000', // 0001 0000 0000 0000 0000 0000
SIGN: '0x0000000000000000000000000000000000000000000000000000000000200000', // 0010 0000 0000 0000 0000 0000
EXECUTE_RELAY_CALL: '0x0000000000000000000000000000000000000000000000000000000000400000', // 0100 0000 0000 0000 0000 0000
}

/**
Expand Down
2 changes: 2 additions & 0 deletions contracts/LSP20CallVerification/ILSP20CallVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ interface ILSP20CallVerifier {
* the function is allowed, concatened with a byte that determines if the lsp20VerifyCallResult function should
* be called after the original function call. The byte that invoke the lsp20VerifyCallResult function is strictly `0x01`.
*
* @param callee The address of the contract that implements the `LSP20CallVerifier` interface
* @param caller The address who called the function on the msg.sender
* @param value The value sent by the caller to the function called on the msg.sender
* @param receivedCalldata The receivedCalldata sent by the caller to the msg.sender
*/
function lsp20VerifyCall(
address callee,
skimaharvey marked this conversation as resolved.
Show resolved Hide resolved
address caller,
uint256 value,
bytes memory receivedCalldata
Expand Down
10 changes: 9 additions & 1 deletion contracts/LSP20CallVerification/LSP20CallVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract contract LSP20CallVerification {
(bool success, bytes memory returnedData) = logicVerifier.call(
abi.encodeWithSelector(
ILSP20.lsp20VerifyCall.selector,
address(this),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to make the LSP20 modules reusable, I would suggest to parameterize in _verifyCall all the lsp20 functions parameter, because not in all scenarios the address(this) will be the target or msg.sender is the one to verify permissions for.

But probably can be done in later PRs, just a note

msg.sender,
msg.value,
msg.data
Expand Down Expand Up @@ -60,7 +61,14 @@ abstract contract LSP20CallVerification {
(bool success, bytes memory returnedData) = logicVerifier.call(
abi.encodeWithSelector(
ILSP20.lsp20VerifyCallResult.selector,
keccak256(abi.encodePacked(msg.sender, msg.value, msg.data)),
keccak256(
abi.encodePacked(
address(this),
msg.sender,
msg.value,
msg.data
)
),
callResult
)
);
Expand Down
8 changes: 4 additions & 4 deletions contracts/LSP20CallVerification/LSP20Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ pragma solidity ^0.8.4;
// bytes4(keccak256("LSP20CallVerification"))
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFICATION = 0x1a0eb6a5;

// `lsp20VerifyCall(address,uint256,bytes)` selector XOR `lsp20VerifyCallResult(bytes32,bytes)` selector
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFIER = 0x480c0ec2;
// `lsp20VerifyCall(address,address,uint256,bytes)` selector XOR `lsp20VerifyCallResult(bytes32,bytes)` selector
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFIER = 0xc9dfc532;

// bytes4(bytes.concat(bytes3(ILSP20.lsp20VerifyCall.selector), hex"01"))
bytes4 constant _LSP20_VERIFY_CALL_MAGIC_VALUE_WITH_POST_VERIFICATION = 0x9bf04b01;
bytes4 constant _LSP20_VERIFY_CALL_MAGIC_VALUE_WITH_POST_VERIFICATION = 0x1a238001;

// bytes4(bytes.concat(bytes3(ILSP20.lsp20VerifyCall.selector), hex"00"))
bytes4 constant _LSP20_VERIFY_CALL_MAGIC_VALUE_WITHOUT_POST_VERIFICATION = 0x9bf04b00;
bytes4 constant _LSP20_VERIFY_CALL_MAGIC_VALUE_WITHOUT_POST_VERIFICATION = 0x1a238000;

// bytes4(ILSP20.lsp20VerifyCallResult.selector)
bytes4 constant _LSP20_VERIFY_CALL_RESULT_MAGIC_VALUE = 0xd3fc45d3;
5 changes: 3 additions & 2 deletions contracts/LSP6KeyManager/LSP6Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

// --- ERC165 interface ids
bytes4 constant _INTERFACEID_LSP6 = 0x66918867;
bytes4 constant _INTERFACEID_LSP6 = 0xe7424397;

// --- ERC725Y Data Keys

Expand Down Expand Up @@ -52,9 +52,10 @@ bytes32 constant _PERMISSION_SETDATA = 0x000000000000000
bytes32 constant _PERMISSION_ENCRYPT = 0x0000000000000000000000000000000000000000000000000000000000080000;
bytes32 constant _PERMISSION_DECRYPT = 0x0000000000000000000000000000000000000000000000000000000000100000;
bytes32 constant _PERMISSION_SIGN = 0x0000000000000000000000000000000000000000000000000000000000200000;
bytes32 constant _PERMISSION_EXECUTE_RELAY_CALL = 0x0000000000000000000000000000000000000000000000000000000000400000;

// All Permissions currently exclude REENTRANCY, DELEGATECALL and SUPER_DELEGATECALL for security
bytes32 constant ALL_REGULAR_PERMISSIONS = 0x00000000000000000000000000000000000000000000000000000000003f3f7f;
bytes32 constant ALL_REGULAR_PERMISSIONS = 0x00000000000000000000000000000000000000000000000000000000007f3f7f;

// AllowedCalls types
bytes4 constant _ALLOWEDCALLS_TRANSFERVALUE = 0x00000001; // 0000 0001
Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP6KeyManager/LSP6KeyManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ contract LSP6KeyManager is LSP6KeyManagerCore {
constructor(address target_) {
if (target_ == address(0)) revert InvalidLSP6Target();
_target = target_;
_setupLSP6ReentrancyGuard();
_setupLSP6ReentrancyGuard(target_);
}
}
70 changes: 45 additions & 25 deletions contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {LSP6SetDataModule} from "./LSP6Modules/LSP6SetDataModule.sol";
import {LSP6ExecuteModule} from "./LSP6Modules/LSP6ExecuteModule.sol";
import {
LSP6ExecuteRelayCallModule
} from "./LSP6Modules/LSP6ExecuteRelayCallModule.sol";
import {LSP6OwnershipModule} from "./LSP6Modules/LSP6OwnershipModule.sol";
import {
LSP25MultiChannelNonce
Expand Down Expand Up @@ -83,6 +86,7 @@ abstract contract LSP6KeyManagerCore is
ILSP25,
LSP6SetDataModule,
LSP6ExecuteModule,
LSP6ExecuteRelayCallModule,
LSP6OwnershipModule,
LSP25MultiChannelNonce
{
Expand All @@ -94,9 +98,9 @@ abstract contract LSP6KeyManagerCore is

// Variables, methods and modifier used for ReentrancyGuard are taken from the link below and modified accordingly.
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/security/ReentrancyGuard.sol
uint8 internal _reentrancyStatus;
uint8 internal constant _NOT_ENTERED = 1;
uint8 internal constant _ENTERED = 2;
mapping(address => uint256) internal _reentrancyStatus;
uint256 internal constant _NOT_ENTERED = 1;
uint256 internal constant _ENTERED = 2;

/**
* @inheritdoc ILSP6
Expand Down Expand Up @@ -315,28 +319,27 @@ abstract contract LSP6KeyManagerCore is
* on the {`target`} contract (while sending `msgValue` alongside the call).
*
* If the permissions have been verified successfully and `caller` is authorized, one of the following two LSP20 magic value will be returned:
* - `0x9bf04b00`: LSP20 magic value **without** post verification (last byte is `0x00`).
* - `0x9bf04b01`: LSP20 magic value **with** post-verification (last byte is `0x01`).
* - `0x1a238000`: LSP20 magic value **without** post verification (last byte is `0x00`).
* - `0x1a238001`: LSP20 magic value **with** post-verification (last byte is `0x01`).
*/
function lsp20VerifyCall(
address targetContract,
address caller,
uint256 msgValue,
bytes calldata data
) external virtual returns (bytes4) {
bool isSetData = bytes4(data) == IERC725Y.setData.selector ||
bytes4(data) == IERC725Y.setDataBatch.selector;

address targetContract = _target;

// If target is invoking the verification, emit the event and change the reentrancy guard
if (msg.sender == targetContract) {
uint8 reentrancyStatus = _nonReentrantBefore(
uint256 reentrancyStatus = _nonReentrantBefore(
targetContract,
isSetData,
caller
);

_verifyPermissions(targetContract, caller, msgValue, data);
_verifyPermissions(targetContract, caller, msgValue, false, data);
emit PermissionsVerified(caller, msgValue, bytes4(data));

// if it's a setData call, do not invoke the `lsp20VerifyCallResult(..)` function
Expand All @@ -348,7 +351,7 @@ abstract contract LSP6KeyManagerCore is
/// @dev If a different address is invoking the verification,
/// do not change the state or emit the event to allow read-only verification
else {
uint8 reentrancyStatus = _reentrancyStatus;
uint256 reentrancyStatus = _reentrancyStatus[targetContract];

if (reentrancyStatus == _ENTERED) {
_requirePermissions(
Expand All @@ -358,7 +361,7 @@ abstract contract LSP6KeyManagerCore is
);
}

_verifyPermissions(targetContract, caller, msgValue, data);
_verifyPermissions(targetContract, caller, msgValue, false, data);

// if it's a setData call, do not invoke the `lsp20VerifyCallResult(..)` function
return
Expand All @@ -378,7 +381,7 @@ abstract contract LSP6KeyManagerCore is
// If it's the target calling, set back the reentrancy guard
// to false, if not return the magic value
if (msg.sender == _target) {
_nonReentrantAfter();
_nonReentrantAfter(msg.sender);
}
return _LSP20_VERIFY_CALL_RESULT_MAGIC_VALUE;
}
Expand All @@ -396,13 +399,20 @@ abstract contract LSP6KeyManagerCore is

address targetContract = _target;

uint8 reentrancyStatus = _nonReentrantBefore(
uint256 reentrancyStatus = _nonReentrantBefore(
targetContract,
isSetData,
msg.sender
);

_verifyPermissions(targetContract, msg.sender, msgValue, payload);
_verifyPermissions(
targetContract,
msg.sender,
msgValue,
false,
payload
);

emit PermissionsVerified(msg.sender, msgValue, bytes4(payload));

bytes memory result = _executePayload(
Expand All @@ -412,7 +422,7 @@ abstract contract LSP6KeyManagerCore is
);

if (reentrancyStatus == _NOT_ENTERED && !isSetData) {
_nonReentrantAfter();
_nonReentrantAfter(targetContract);
}

return result;
Expand Down Expand Up @@ -466,13 +476,13 @@ abstract contract LSP6KeyManagerCore is
bool isSetData = bytes4(payload) == IERC725Y.setData.selector ||
bytes4(payload) == IERC725Y.setDataBatch.selector;

uint8 reentrancyStatus = _nonReentrantBefore(
uint256 reentrancyStatus = _nonReentrantBefore(
targetContract,
isSetData,
signer
);

_verifyPermissions(targetContract, signer, msgValue, payload);
_verifyPermissions(targetContract, signer, msgValue, true, payload);
emit PermissionsVerified(signer, msgValue, bytes4(payload));

bytes memory result = _executePayload(
Expand All @@ -482,7 +492,7 @@ abstract contract LSP6KeyManagerCore is
);

if (reentrancyStatus == _NOT_ENTERED && !isSetData) {
_nonReentrantAfter();
_nonReentrantAfter(targetContract);
}

return result;
Expand Down Expand Up @@ -520,11 +530,19 @@ abstract contract LSP6KeyManagerCore is
address targetContract,
address from,
uint256 msgValue,
bool isRelayedCall,
bytes calldata payload
) internal view virtual {
bytes32 permissions = ERC725Y(targetContract).getPermissionsFor(from);
if (permissions == bytes32(0)) revert NoPermissionsSet(from);

if (isRelayedCall) {
LSP6ExecuteRelayCallModule._verifyExecuteRelayCallPermission(
from,
permissions
);
}

bytes4 erc725Function = bytes4(payload);

// ERC725Y.setData(bytes32,bytes)
Expand Down Expand Up @@ -589,8 +607,10 @@ abstract contract LSP6KeyManagerCore is
/**
* @dev Initialise _reentrancyStatus to _NOT_ENTERED.
skimaharvey marked this conversation as resolved.
Show resolved Hide resolved
*/
function _setupLSP6ReentrancyGuard() internal virtual {
_reentrancyStatus = 1;
function _setupLSP6ReentrancyGuard(
address targetContract
) internal virtual {
_reentrancyStatus[targetContract] = 1;
skimaharvey marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -602,8 +622,8 @@ abstract contract LSP6KeyManagerCore is
address targetContract,
bool isSetData,
address from
) internal virtual returns (uint8 reentrancyStatus) {
reentrancyStatus = _reentrancyStatus;
) internal virtual returns (uint256 reentrancyStatus) {
reentrancyStatus = _reentrancyStatus[targetContract];
if (reentrancyStatus == _ENTERED) {
// CHECK the caller has REENTRANCY permission
_requirePermissions(
Expand All @@ -613,7 +633,7 @@ abstract contract LSP6KeyManagerCore is
);
} else {
if (!isSetData) {
_reentrancyStatus = _ENTERED;
_reentrancyStatus[targetContract] = _ENTERED;
}
}
}
Expand All @@ -622,10 +642,10 @@ abstract contract LSP6KeyManagerCore is
* @dev Resets the status to `_NOT_ENTERED`
* Used in the end of the `nonReentrant` modifier after the method execution is terminated
*/
function _nonReentrantAfter() internal virtual {
function _nonReentrantAfter(address targetContract) internal virtual {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_reentrancyStatus = _NOT_ENTERED;
_reentrancyStatus[targetContract] = _NOT_ENTERED;
}

/**
Expand Down
Loading
Loading