@@ -540,15 +540,7 @@ describe("hardhat ethers provider", function () {
540
540
blockTag : blockNumber - 1 ,
541
541
} ) ;
542
542
543
- const gasEstimationBigInt = await this . env . ethers . provider . estimateGas ( {
544
- from : signer . address ,
545
- to : await contract . getAddress ( ) ,
546
- data : "0x371303c0" , // inc()
547
- blockTag : BigInt ( blockNumber - 1 ) ,
548
- } ) ;
549
-
550
543
assertWithin ( Number ( gasEstimationBefore ) , 65_000 , 70_000 ) ;
551
- assert . strictEqual ( gasEstimationBefore , gasEstimationBigInt ) ;
552
544
} ) ;
553
545
554
546
it ( "should accept a block hash" , async function ( ) {
@@ -696,6 +688,43 @@ describe("hardhat ethers provider", function () {
696
688
) ;
697
689
} ) ;
698
690
691
+ it ( "should accept a block number as a bigint" , async function ( ) {
692
+ const signer = await this . env . ethers . provider . getSigner ( 0 ) ;
693
+ const factory = new this . env . ethers . ContractFactory < [ ] , ExampleContract > (
694
+ EXAMPLE_CONTRACT . abi ,
695
+ EXAMPLE_CONTRACT . deploymentBytecode ,
696
+ signer
697
+ ) ;
698
+ const contract = await factory . deploy ( ) ;
699
+ await contract . inc ( ) ;
700
+
701
+ const blockNumber = await this . env . ethers . provider . getBlockNumber ( ) ;
702
+
703
+ const resultAfter = await this . env . ethers . provider . call ( {
704
+ from : signer . address ,
705
+ to : contract ,
706
+ data : "0x3fa4f245" , // value()
707
+ blockTag : "latest" ,
708
+ } ) ;
709
+
710
+ assert . strictEqual (
711
+ resultAfter ,
712
+ "0x0000000000000000000000000000000000000000000000000000000000000001"
713
+ ) ;
714
+
715
+ const resultBefore = await this . env . ethers . provider . call ( {
716
+ from : signer . address ,
717
+ to : contract ,
718
+ data : "0x3fa4f245" , // value()
719
+ blockTag : BigInt ( blockNumber - 1 ) ,
720
+ } ) ;
721
+
722
+ assert . strictEqual (
723
+ resultBefore ,
724
+ "0x0000000000000000000000000000000000000000000000000000000000000000"
725
+ ) ;
726
+ } ) ;
727
+
699
728
it ( "should accept a block hash" , async function ( ) {
700
729
const signer = await this . env . ethers . provider . getSigner ( 0 ) ;
701
730
const factory = new this . env . ethers . ContractFactory < [ ] , ExampleContract > (
0 commit comments