File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ abstract contract ERC2771Context is Context {
55
55
function _msgSender () internal view virtual override returns (address ) {
56
56
uint256 calldataLength = msg .data .length ;
57
57
uint256 contextSuffixLength = _contextSuffixLength ();
58
- if (isTrustedForwarder (msg .sender ) && calldataLength >= contextSuffixLength) {
59
- return address (bytes20 (msg .data [calldataLength - contextSuffixLength:]));
58
+ if (calldataLength >= contextSuffixLength && isTrustedForwarder (msg .sender )) {
59
+ unchecked {
60
+ return address (bytes20 (msg .data [calldataLength - contextSuffixLength:]));
61
+ }
60
62
} else {
61
63
return super ._msgSender ();
62
64
}
@@ -70,8 +72,10 @@ abstract contract ERC2771Context is Context {
70
72
function _msgData () internal view virtual override returns (bytes calldata ) {
71
73
uint256 calldataLength = msg .data .length ;
72
74
uint256 contextSuffixLength = _contextSuffixLength ();
73
- if (isTrustedForwarder (msg .sender ) && calldataLength >= contextSuffixLength) {
74
- return msg .data [:calldataLength - contextSuffixLength];
75
+ if (calldataLength >= contextSuffixLength && isTrustedForwarder (msg .sender )) {
76
+ unchecked {
77
+ return msg .data [:calldataLength - contextSuffixLength];
78
+ }
75
79
} else {
76
80
return super ._msgData ();
77
81
}
You can’t perform that action at this time.
0 commit comments