Files
xermicus 95ae938ddf Add missing 63/64 rule documentation and a test (#462)
- Prominently point out the important differences of the `pallet-revive`
runtime.
- Add a test case illustrating the problem.

See also: https://github.com/paritytech/contract-issues/issues/257

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-27 19:43:14 +01:00

58 lines
1.5 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/* runner.json
{
"differential": true,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "RevertDataOob"
}
}
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "eb8ac921000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "eb8ac92100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000"
}
}
]
}
*/
contract RevertDataOob {
function test(uint256 offset, uint256 len) external {
assembly {
mstore(0, 0xcc572cf9)
mstore(32, offset)
mstore(64, len)
let stipend := mul(div(gas(), 64), 63) // On EVM this isn't necessary
let success := call(stipend, address(), 0, 28, 68, 0, 0)
mstore(0, 0xdeadbeef)
return(0, 32)
}
}
function main(uint256 offset, uint256 len) external pure {
assembly {
mstore(0x40, 0)
revert(offset, len)
}
}
}