mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Test Execute result decoding, reentrancy
This commit is contained in:
@@ -3,7 +3,7 @@ pragma solidity ^0.8.26;
|
||||
|
||||
import "Router.sol";
|
||||
|
||||
// Wrap the Router with a contract which exposes the address
|
||||
// Wrap the Router with a contract which exposes the createAddress function
|
||||
contract CreateAddress is Router {
|
||||
constructor() Router(bytes32(uint256(1))) { }
|
||||
|
||||
|
||||
17
processor/ethereum/router/contracts/tests/Reentrancy.sol
Normal file
17
processor/ethereum/router/contracts/tests/Reentrancy.sol
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import "Router.sol";
|
||||
|
||||
// This inherits from the Router for visibility over Reentered
|
||||
contract Reentrancy {
|
||||
error Reentered();
|
||||
|
||||
constructor() {
|
||||
(bool success, bytes memory res) =
|
||||
msg.sender.call(abi.encodeWithSelector(Router.execute4DE42904.selector, ""));
|
||||
require(!success);
|
||||
// We can't compare `bytes memory` so we hash them and compare the hashes
|
||||
require(keccak256(res) == keccak256(abi.encode(Reentered.selector)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user