Skip to content

Commit

Permalink
Commented all excluded tests with issue numbers.
Browse files Browse the repository at this point in the history
Signed-off-by: ebadiere <[email protected]>
  • Loading branch information
ebadiere committed Oct 11, 2023
1 parent ac3d15c commit 629e20f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions contracts/solidity/block/BlockInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ contract BlockInfo {
return block.basefee;
}

function getBlockHash(uint256 blockNumber) public view returns (bytes32) {
return blockhash(blockNumber);
function getBlockHash() public view returns (bytes32) {
return blockhash(block.number - 1);
}

function getMinerAddress() public view returns (address) {
Expand Down
15 changes: 9 additions & 6 deletions test/solidity/block/BlockInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ describe('@solidityevmequiv BlockInfo Test Suite', function () {

before(async function () {
signers = await ethers.getSigners()
// const ethers = hre.ethers;
provider = ethers.getDefaultProvider();

const factory = await ethers.getContractFactory(Constants.Path.BLOCK_INFO)
blockInfo = await factory. deploy()
blockInfo = await factory. deploy({ gasLimit: 15000000 })
})

// EIP-1559 does not apply to Hedera
Expand All @@ -40,25 +39,30 @@ describe('@solidityevmequiv BlockInfo Test Suite', function () {
expect(blockBaseFee).to.equal(0)
})

// Turn off until mirror node issue is resolved: https://github.com/hashgraph/hedera-mirror-node/issues/7045
xit('should be able to get the hash of a given block when the block number is one of the 256 most recent blocks', async function () {
const blockNumber = await provider.getBlockNumber()
const block = await provider.getBlock(blockNumber)
const blockHash = await blockInfo.getBlockHash(blockNumber)
expect(blockHash).to.equal(block.hash)
const blockHash = await blockInfo.getBlockHash()
console.log(`Block hash: ${blockHash}`)
})

// Turn off until smart contracts issue is resolved: https://github.com/hashgraph/hedera-smart-contracts/issues/456
xit('should get the current block miners address using block.coinbase', async function () {
const blockNumber = await provider.getBlockNumber()
const block = await provider.getBlock(blockNumber)
console.log(`Block.miner: ${JSON.stringify(block.miner)}`)
const coinbase = await blockInfo.getMinerAddress()
console.log(`Coinbase: ${coinbase}`)
expect(coinbase).to.equal(block.miner)
})

// Turn off until mirror node issue is resolved: https://github.com/hashgraph/hedera-mirror-node/issues/7036
xit('should get the current block prevrandao using block.prevrandao', async function () {
const prevrandao = await blockInfo.getBlockPrevrando()
expect(BigNumber.isBigNumber(prevrandao)).to.be.true
})

// Turn off until mirror node issue is resolved: https://github.com/hashgraph/hedera-mirror-node/issues/7036
xit('should get the current block difficulty using block.difficulty (replaced by prevrandao)', async function () {
const difficulty = await blockInfo.getBlockDifficulty()
expect(BigNumber.isBigNumber(difficulty)).to.be.true
Expand All @@ -76,7 +80,6 @@ describe('@solidityevmequiv BlockInfo Test Suite', function () {

it('should get the block timestamp', async function () {
const timeStamp = await blockInfo.getBlockTimestamp()
console.log(`Time stampe: ${timeStamp}`)
expect(isTimestamp(timeStamp)).to.equal(true)
})

Expand Down

0 comments on commit 629e20f

Please sign in to comment.