warp
warp copied to clipboard
Add special case for uint256(uint160(addr)) in warp
The pattern for converting an address to uint256, occurs very frequently in Solidity code bases. With changes to the address size in the solc because of StarkNet's use of a felt, warp complains when it sees this pattern.
Investigate if we can add a special case in solc typechecker for this case and pass.
Add special case in Warp's type conversion pipeline to ignore the first cast. Original request from @amanusk in https://github.com/NethermindEth/warp/issues/812
i think that i have a solution, as @JorikSchellekens pointed out would be huge problem if the address is stored like uint160(addr) and they try to read it later because will break the expectations would be a solution if we use two maps? one map that receives the full address and return the shorted 160 bits address (map(fullAddress)=>uint160Address) and other map that receives the shortened address and return the full address (map(uint160Address)=>fullAddress) so when this pattern uint160(addr) is found we can just access the map that receives a full address and return 160 bits shortened version and when this pattern is found address(uint160) we can use the map that receives the shorted version and return the full address when this pattern is found uint256(uint160(addr)) we can just ignore the uint160 conversion since it will not be stored anywhere and just store the address without using maps