Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nonce incrementation, test runner broken
Browse files Browse the repository at this point in the history
dangerousfood committed Jan 8, 2024
1 parent 8b4af46 commit 537f248
Showing 7 changed files with 128 additions and 126 deletions.
238 changes: 120 additions & 118 deletions .gas-snapshot

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/format_snapshot.yml
Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@ jobs:
run: forge fmt

- name: Snapshot
run: forge snapshot --no-match-path '*fuzz*'
run: forge snapshot --ffi --no-match-path '*fuzz*'

- name: Test
run: forge test -vvv
run: forge test -vvv --ffi

- uses: stefanzweifel/git-auto-commit-action@v4
with:
4 changes: 2 additions & 2 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
run: forge fmt --check

- name: Snapshot
run: forge snapshot --check --no-match-path '*fuzz*'
run: forge snapshot --ffi --check --no-match-path '*fuzz*'

- name: Test
run: forge test -vvv
run: forge test -vvv --ffi
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@
. "$(dirname -- "$0")/_/husky.sh"

forge fmt --check
forge snapshot --no-match-path '*fuzz*'
forge snapshot --ffi --no-match-path '*fuzz*'

git add .gas-snapshot
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
},
"scripts": {
"prepare": "husky install",
"snapshot": "forge snapshot --no-match-path '*fuzz*'"
"snapshot": "forge snapshot --ffi --no-match-path '*fuzz*'"
},
"devDependencies": {
"husky": "^8.0.0",
2 changes: 1 addition & 1 deletion src/Starport.sol
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ contract Starport is PausableNonReentrant {
* @dev Increments caveat nonce for sender and emits event
*/
function incrementCaveatNonce() external {
uint256 newNonce = caveatNonces[msg.sender] + uint256(blockhash(block.number - 1) >> 0x80);
uint256 newNonce = caveatNonces[msg.sender] + 1 + uint256(blockhash(block.number - 1) >> 0x80);
caveatNonces[msg.sender] = newNonce;
emit CaveatNonceIncremented(msg.sender, newNonce);
}
2 changes: 1 addition & 1 deletion test/unit-testing/TestStarport.sol
Original file line number Diff line number Diff line change
@@ -347,7 +347,7 @@ contract TestStarport is StarportTest, DeepEq {

function testIncrementCaveatNonce() public {
vm.roll(5);
uint256 newNonce = SP.caveatNonces(address(this)) + uint256(blockhash(block.number - 1) << 0x80);
uint256 newNonce = SP.caveatNonces(address(this)) + 1 + uint256(blockhash(block.number - 1) >> 0x80);
vm.expectEmit();
emit CaveatNonceIncremented(address(this), newNonce);
SP.incrementCaveatNonce();

0 comments on commit 537f248

Please sign in to comment.