mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-23 00:18:01 +00:00
aae25107a2
- The storage pointer values will no longer be truncated to the register size, allowing for the use of arbitrary storage keys - Failed storage value reads will now guarantee to return the zero value
56 lines
1.4 KiB
Solidity
56 lines
1.4 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8;
|
|
|
|
/* runner.json
|
|
{
|
|
"differential": true,
|
|
"actions": [
|
|
{
|
|
"Instantiate": {
|
|
"code": {
|
|
"Solidity": {
|
|
"contract": "Storage"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Call": {
|
|
"dest": {
|
|
"Instantiated": 0
|
|
},
|
|
"data": "fabc9efaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
}
|
|
},
|
|
{
|
|
"Call": {
|
|
"dest": {
|
|
"Instantiated": 0
|
|
},
|
|
"data": "558b9f9bffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
*/
|
|
|
|
contract Storage {
|
|
function transient(uint value) public returns (uint ret) {
|
|
assembly {
|
|
let slot := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
|
|
tstore(slot, value)
|
|
let success := call(0, 0, 0, 0, 0, 0, 0)
|
|
ret := tload(slot)
|
|
}
|
|
}
|
|
|
|
function persistent(uint value) public returns (uint ret) {
|
|
assembly {
|
|
let slot := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
|
|
sstore(slot, value)
|
|
ret := sload(slot)
|
|
}
|
|
}
|
|
}
|