Skip to content

Commit

Permalink
Merge remote-tracking branch 'ml/main' into grw/impl-debug-tracecall
Browse files Browse the repository at this point in the history
  • Loading branch information
grw-ms committed Sep 29, 2023
2 parents 5df1eae + f19fe6c commit 6af778d
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 82 deletions.
6 changes: 3 additions & 3 deletions e2e-tests/test/evm-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("evm_increaseTime", function () {
to: userWallet.address,
value: ethers.utils.parseEther("0.1"),
});
expectedTimestamp += 1; // New transaction will add a second block
expectedTimestamp += 2; // New transaction will add two blocks

// Assert
const newBlockTimestamp = (await provider.getBlock("latest")).timestamp;
Expand All @@ -60,7 +60,7 @@ describe("evm_setNextBlockTimestamp", function () {
to: userWallet.address,
value: ethers.utils.parseEther("0.1"),
});
expectedTimestamp += 1; // New transaction will add a second block
expectedTimestamp += 2; // New transaction will add two blocks

// Assert
const newBlockTimestamp = (await provider.getBlock("latest")).timestamp;
Expand All @@ -84,7 +84,7 @@ describe("evm_setTime", function () {
to: userWallet.address,
value: ethers.utils.parseEther("0.1"),
});
expectedTimestamp += 1; // New transaction will add a second block
expectedTimestamp += 2; // New transaction will add two blocks

// Assert
const newBlockTimestamp = (await provider.getBlock("latest")).timestamp;
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/hardhat-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("hardhat_mine", function () {
const latestBlock = await provider.getBlock("latest");
expect(latestBlock.number).to.equal(startingBlock.number + numberOfBlocks, "Block number mismatch");
expect(latestBlock.timestamp).to.equal(
startingTimestamp + (numberOfBlocks - 1) * intervalInSeconds * 1000,
startingTimestamp + (numberOfBlocks - 1) * intervalInSeconds * 1000 + 1,
"Timestamp mismatch"
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ mod tests {
.expect("block exists");

assert_eq!(start_block.number + 1, current_block.number);
assert_eq!(start_block.timestamp + 1000, current_block.timestamp);
assert_eq!(start_block.timestamp + 1, current_block.timestamp);

let result = evm.evm_mine().await.expect("evm_mine");
assert_eq!(&result, "0x0");
Expand All @@ -478,6 +478,6 @@ mod tests {
.expect("block exists");

assert_eq!(start_block.number + 2, current_block.number);
assert_eq!(start_block.timestamp + 2000, current_block.timestamp);
assert_eq!(start_block.timestamp + 2, current_block.timestamp);
}
}
6 changes: 3 additions & 3 deletions src/hardhat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ mod tests {
.expect("block exists");

assert_eq!(start_block.number + 1, current_block.number);
assert_eq!(start_block.timestamp + 1000, current_block.timestamp);
assert_eq!(start_block.timestamp + 1, current_block.timestamp);
let result = hardhat
.hardhat_mine(None, None)
.await
Expand All @@ -330,7 +330,7 @@ mod tests {
.expect("block exists");

assert_eq!(start_block.number + 2, current_block.number);
assert_eq!(start_block.timestamp + 2000, current_block.timestamp);
assert_eq!(start_block.timestamp + 2, current_block.timestamp);
}

#[tokio::test]
Expand All @@ -347,7 +347,7 @@ mod tests {

let num_blocks = 5;
let interval = 3;
let start_timestamp = start_block.timestamp + 1_000;
let start_timestamp = start_block.timestamp + 1;

let result = hardhat
.hardhat_mine(Some(U64::from(num_blocks)), Some(U64::from(interval)))
Expand Down
Loading

0 comments on commit 6af778d

Please sign in to comment.