Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
mutate state after the reverted subcall
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jul 27, 2021
1 parent c68475f commit 0775537
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/solidity/suites/exception/contracts/TestRevert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ contract State {
contract TestRevert {
State state;
uint256 b = 0;
uint256 c = 0;
constructor() {
state = new State();
}
Expand All @@ -26,6 +27,7 @@ contract TestRevert {
try state.set(input) {
} catch (bytes memory) {
}
c = input;
}
function set(uint256 input) public {
state.force_set(input);
Expand All @@ -36,4 +38,7 @@ contract TestRevert {
function query_b() public view returns(uint256) {
return b;
}
function query_c() public view returns(uint256) {
return c;
}
}
2 changes: 2 additions & 0 deletions tests/solidity/suites/exception/test/revert.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ contract('TestRevert', (accounts) => {
assert.equal(no, '0', 'The modification on a should be reverted')
no = await revert.query_b()
assert.equal(no, '10', 'The modification on b should not be reverted')
no = await revert.query_c()
assert.equal(no, '10', 'The modification on c should not be reverted')

await revert.set(10)
no = await revert.query_a()
Expand Down

0 comments on commit 0775537

Please sign in to comment.