should clear transient storage after tx execution

pull/5160/head
yann300 3 months ago committed by Aniket
parent 537a56329b
commit 2b50442501
  1. 36
      apps/remix-ide-e2e/src/tests/eip1153.test.ts
  2. 1
      libs/remix-lib/src/execution/txRunnerVM.ts

@ -31,7 +31,22 @@ module.exports = {
1: 'uint256: out2 15'
}
})
.end()
},
'Should clear transient storage after tx execution' : function (browser: NightwatchBrowser) {
browser.addFile('clear_transient.sol', { content: clearTransient })
.clickLaunchIcon('solidity')
.verifyContracts(['ClearTransient'])
.clickLaunchIcon('udapp')
.createContract('')
.clickInstance(0)
.clickFunction('get - call')
.testFunction('last',
{
'decoded output': {
0: 'uint256: 0'
}
})
}
}
@ -49,3 +64,22 @@ contract TestTransientStorage {
}
}
}`
const clearTransient = `
// SPDX-License-Identifier: none
pragma solidity 0.8.26;
import "hardhat/console.sol";
contract ClearTransient {
uint p;
constructor() {
uint256 value;
assembly { value := tload(hex"1234") }
p = value;
assembly { tstore(hex"1234", 10) }
}
function get () public view returns (uint) {
return p;
}
}`

@ -146,6 +146,7 @@ export class TxRunnerVM {
const root = await this.getVMObject().stateManager.getStateRoot()
this.runBlockInVm(tx, block, async (err, result) => {
await this.getVMObject().stateManager.setStateRoot(root)
this.getVMObject().vm.evm.transientStorage.clear()
callback(err, result)
})
} else {

Loading…
Cancel
Save