nomad-xyz / excessivelysafecall Goto Github PK
View Code? Open in Web Editor NEWexcessively safe solidity calls
excessively safe solidity calls
function noReturnCall(
address _target,
uint256 _gas,
bytes memory _calldata
) internal returns (bool) {
// set up for assembly call
bool _success;
// dispatch message to recipient
// by assembly calling "handle" function
// we call via assembly to avoid memcopying a very large returndata
// returned by a malicious contract
assembly {
_success := call(
_gas, // gas
_target, // recipient
0, // ether value
add(_calldata, 0x20), // inloc
mload(_calldata), // inlen
0, // outloc
0 // outlen
)
}
return _success;
}
contract Attacker {
function bomb() external pure {
assembly {
revert(0, 100000000)
}
}
contract Caller is Test {
// init stuff
function testCallBombNoRet() external returns (bool success) {
success = counter.noReturnCall(gasleft(), abi.encodeWithSignature("bomb()"));
}
}
Tried making a function in the lib with inspiration from excessivelySafeCall as I want to make a call without using the return value but this does not work. Any help would be appreciated. Note: I tried the same thing with excessively safe call it did not work either.
I have a use case to use try catch in a function and this function is called by a contract which uses excessivelySafeCall. The execution is failing. Is there a way to handle this?
The importantCleanup
function is mentioned in the readme, however, is not implemented. I see no OOG happening in the functions, thus, considering it's better to eliminate the mentions.
The size is limited to _maxCopy
bytes, not 256
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.