The contracts MOR
, L2TokenReceiver
and L1Sender
inherit ERC165
. This standard is used to publish and detect what interfaces a smart contract implements. Read this for more. If we take a look at MOR
and L2TokenReceiver
, we can see that they implement this standard the correct way:
But there is no such function in L1Sender.sol
.
Having no supportsInterface
function, means that the ERC165
standard is not implement correctly. This contract implements IL1Sender
and ERC165
. Lets say someone wants to check if this contract implements the IL1Sender
interface. The lack of supportsInterface
function, means that the return value will be false
, which is wrong.
When supportsInterface
is called, the output will always be false.
Do the following changes to L1Sender.sol
:
Import the IERC165
interface at the top of the file:
import {ERC165, IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
Create the following pure functions:
Full file can be found in this Gist.
Now add the following test cases to L1Sender.test.ts
Run npx hardhat test
.
As we can see, the first test fails(which is the IL1Sender
) and the second(IERC165
) passes. The second passes because in ERC165
the supportsInterface
functions is this:
However this is not the expected behaviour. Both of the tests should pass.
Manual Review, Hardhat
Make sure to implement correctly the supportsInterface
function:
Note that we add a check for IERC165
here as well, because this function is override
.
Now run npx hardhat test
again:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.