You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
This is clearly related to #436 - there, it was not possible to set storage, but it seems like it's now too easy to delete storage on a forked chain!
Expected Behavior
Emptying a storage slot in a contract on a forked chain should not affect other contracts.
Current Behavior
Emptying a storage slot in a contract on a forked chain seems to empty that storage slot on all other contracts.
Possible Solution
Steps to Reproduce (for bugs)
Once again using:
pragma solidity 0.5.8;
contract ContractEditing {
function setStorageSlot(uint256 _slot, bytes32 _value) public {
uint x = _slot;
bytes32 y = _value;
assembly {
sstore(x, y)
}
}
}
From a truffle console, connected to a ganache instance forking mainnet
a1="0x5346D0f80e2816FaD329F2c140c870ffc3c3E2Ef" // This is our contract
dai="0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" // This is the DAI contract
web3.eth.getStorageAt(a1, 7)
> '0x0000000000000000000000000000000000000000000000000000000000000003'
web3.eth.getStorageAt(dai, 7)
> '0x44616920537461626c65636f696e2076312e3000000000000000000000000000'
Looks good so far...
ce = await ContractEditing.new({from: f}) // Get f from web3.eth.getAccounts();
ce.setStorageSlot(7, "0xdeadbeef", {from:f})
web3.eth.getStorageAt(ce.address, 7)
> '0xdeadbeef00000000000000000000000000000000000000000000000000000000'
web3.eth.getStorageAt(a1, 7)
> '0x0000000000000000000000000000000000000000000000000000000000000003'
web3.eth.getStorageAt(dai, 7)
> '0x44616920537461626c65636f696e2076312e3000000000000000000000000000'
Not very familiar with the forking code, but it looks like this is because the database keeping track of which storage slots have been deleted on the fork is the same for all forked storage trees, but only indexes by key which appears to just be the storage slot.
This is clearly related to #436 - there, it was not possible to set storage, but it seems like it's now too easy to delete storage on a forked chain!
Expected Behavior
Emptying a storage slot in a contract on a forked chain should not affect other contracts.
Current Behavior
Emptying a storage slot in a contract on a forked chain seems to empty that storage slot on all other contracts.
Possible Solution
Steps to Reproduce (for bugs)
Once again using:
From a truffle console, connected to a ganache instance forking mainnet
Looks good so far...
Again, looks good. Now let's empty the slot
Great!
Oh no...
Context
This obviously makes using a forked network in many meaningful ways impossible!
Your Environment
Ganache CLI v6.8.1-beta.0 (ganache-core: 2.9.1-beta.0)
The text was updated successfully, but these errors were encountered: