Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dabug test failure 2 #276

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Run foundry tests
# --ast tests enables inline configs to work https://github.com/foundry-rs/foundry/issues/7310#issuecomment-1978088200
run: |
forge test -vv --gas-report --ast
forge test -vvvvv --gas-report --ast
id: test

overrides:
Expand All @@ -70,7 +70,7 @@ jobs:
- name: Run foundry overrides test mode
# --ast tests enables inline configs to work https://github.com/foundry-rs/foundry/issues/7310#issuecomment-1978088200
run: |
DEPLOY_OVERRIDES=true forge test -vv --gas-report --ast
DEPLOY_OVERRIDES=true forge test -vvv --gas-report --ast
id: overrides

coverage:
Expand Down
6 changes: 3 additions & 3 deletions src/Synths/EulerSavingsRate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ contract EulerSavingsRate is EVCUtil, ERC4626 {
/// @notice The total assets accounted for in the vault.
uint256 internal _totalAssets;

error Reentrancy();
error Reentrancy(address me, address myCaller);

event Gulped(uint256 gulped, uint256 interestLeft);
event InterestUpdated(uint256 interestAccrued, uint256 interestLeft);

modifier nonReentrant() {
if (esrSlot.locked == LOCKED) revert Reentrancy();
modifier nonReentrant() virtual {
if (esrSlot.locked == LOCKED) revert Reentrancy(address(this), msg.sender);

esrSlot.locked = LOCKED;
_;
Expand Down
15 changes: 14 additions & 1 deletion test/unit/esr/lib/ESRTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ import {EthereumVaultConnector as EVC} from "ethereum-vault-connector/EthereumVa
import {EulerSavingsRate} from "../../../../src/Synths/EulerSavingsRate.sol";
import {MockToken} from "./MockToken.sol";

contract ESROverride is EulerSavingsRate {
constructor(address _evc, address _asset, string memory _name, string memory _symbol)
EulerSavingsRate(_evc, _asset, _name, _symbol)
{}

modifier nonReentrant() override {
if (esrSlot.locked == LOCKED) revert Reentrancy(address(this), msg.sender);
esrSlot.locked = LOCKED;
_;
esrSlot.locked = UNLOCKED;
}
}

contract ESRTest is Test {
EVC public evc;
EulerSavingsRate public esr;
Expand All @@ -20,7 +33,7 @@ contract ESRTest is Test {
function setUp() public virtual {
asset = new MockToken();
evc = new EVC();
esr = new EulerSavingsRate(address(evc), address(asset), NAME, SYMBOL);
esr = new ESROverride(address(evc), address(asset), NAME, SYMBOL);

// Set a non zero timestamp
vm.warp(420);
Expand Down
Loading