Skip to content

Commit

Permalink
Merge pull request #110 from nomoixyz/chore/remove-block-difficulty
Browse files Browse the repository at this point in the history
Remove everything related to block difficulty
  • Loading branch information
gnkz authored May 8, 2023
2 parents 9bd6262 + 1d95764 commit 9e91ad8
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 35 deletions.
2 changes: 1 addition & 1 deletion docs/src/modules/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Test, ctx } from "vulcan/test.sol";
contract TestMyContract is Test {
function testMyContract() external {
// Update block state
ctx.setBlockTimestamp(123).setBlockNumber(456).setBlockDifficulty(789);
ctx.setBlockTimestamp(123).setBlockNumber(456);
// Use snapshots
uint256 snapshotId = ctx.snapshot();
Expand Down
8 changes: 0 additions & 8 deletions docs/src/reference/modules/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ sets the `block.basefee` to `baseFee`

sets the `block.basefee` to `baseFee`

#### **`setBlockDifficulty(Context self, uint256 difficulty) → (Context)`**

sets the `block.difficulty` to `difficulty`

#### **`setBlockDifficulty(uint256 difficulty) → (Context)`**

sets the `block.difficulty` to `difficulty`

#### **`setChainId(Context self, uint64 chainId) → (Context)`**

sets the `block.chainid` to `chainId`
Expand Down
13 changes: 0 additions & 13 deletions src/_modules/Context.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,6 @@ library ctx {
return setBlockBaseFee(Context.wrap(0), baseFee);
}

/// @dev sets the `block.difficulty` to `difficulty`
/// @param difficulty the new block difficulty
function setBlockDifficulty(Context self, uint256 difficulty) internal returns (Context) {
vulcan.hevm.difficulty(difficulty);
return self;
}

/// @dev sets the `block.difficulty` to `difficulty`
/// @param difficulty the new block difficulty
function setBlockDifficulty(uint256 difficulty) internal returns (Context) {
return setBlockDifficulty(Context.wrap(0), difficulty);
}

/// @dev sets the `block.chainid` to `chainId`
/// @param chainId the new block chain id
function setChainId(Context self, uint64 chainId) internal returns (Context) {
Expand Down
7 changes: 0 additions & 7 deletions test/ExampleTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ contract ExampleTest is Test {
expect(block.basefee).toEqual(baseFee);
}

function testSetBlockDifficulty() external {
uint256 difficulty = 1337;
ctx.setBlockDifficulty(difficulty);

expect(block.difficulty).toEqual(difficulty);
}

function testSetChainId() external {
uint64 chainId = 1337;
ctx.setChainId(chainId);
Expand Down
6 changes: 0 additions & 6 deletions test/_modules/Context.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ contract ContextTest is Test {
expect(block.basefee).toEqual(baseFee);
}

function testItCanSetTheBlockDifficulty(uint256 difficulty) external {
ctx.setBlockDifficulty(difficulty);

expect(block.difficulty).toEqual(difficulty);
}

function testItCanSetTheChainId(uint64 chainId) external {
ctx.setChainId(chainId);

Expand Down

0 comments on commit 9e91ad8

Please sign in to comment.