pragma solidity 0.8.20;
contract SolidityLimitTest {
mapping (address => Hack) private Hackable;
struct Hack {
uint amount;
function(uint) returns (uint) ten_x;
}
function ten_x(uint x) private pure returns (uint result) {
return x * 10;
}
// The contract compiles, but this function reverts on execution.
function rabbitHole() public returns (uint) {
uint a = Hackable[msg.sender].ten_x(1);
return a;
}
}
I was limit testing Solidity code today and found to my surprise that the above code compiles correctly (although rabbitHole()
reverts). Could this mean that there is an unofficial way to get
functions listed as properties of structs to execute as methods?