mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-20 18:56:17 +00:00
- 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>
58 lines
1.5 KiB
Solidity
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)
|
|
}
|
|
}
|
|
}
|