mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-20 18:56:17 +00:00
Differentially tests the behavior of deleting a struct with a member that do not occupy the full 32-byte slot. From [this issue](https://github.com/paritytech/contract-issues/issues/118) it was unclear whether the `delete` was expected to reset only the bytes occupied or the entire slot. The current behavior of resetting the entire slot is expected.
46 lines
818 B
Solidity
46 lines
818 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8;
|
|
|
|
/* runner.json
|
|
{
|
|
"differential": true,
|
|
"actions": [
|
|
{
|
|
"Instantiate": {
|
|
"code": {
|
|
"Solidity": {
|
|
"contract": "StructDeleteStorage"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Call": {
|
|
"dest": {
|
|
"Instantiated": 0
|
|
},
|
|
"data": "e70c830d"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
*/
|
|
|
|
contract StructDeleteStorage {
|
|
struct S {
|
|
uint8 a;
|
|
}
|
|
S s;
|
|
|
|
function store_and_delete() public returns (uint256 r1) {
|
|
assembly {
|
|
sstore(s.slot, 0xffffff)
|
|
}
|
|
delete s;
|
|
assembly {
|
|
r1 := sload(s.slot)
|
|
}
|
|
}
|
|
}
|