Commit db903270 authored by kf's avatar kf Committed by Kelvin Fichter

feat: have difficulty always return zero

parent 2ade9a79
......@@ -5,11 +5,13 @@ pragma solidity >=0.7.0;
contract OVMContextStorage {
mapping (uint256 => uint256) public blockNumbers;
mapping (uint256 => uint256) public timestamps;
mapping (uint256 => uint256) public difficulty;
uint256 public index = 0;
fallback() external {
blockNumbers[index] = block.number;
timestamps[index] = block.timestamp;
difficulty[index] = block.difficulty;
index++;
}
}
......@@ -72,6 +72,10 @@ describe('OVM Context: Layer 2 EVM Context', () => {
expect(receipt.blockNumber).to.deep.equal(blockNumber.toNumber())
const timestamp = await OVMContextStorage.timestamps(i)
expect(block.timestamp).to.deep.equal(timestamp.toNumber())
// Difficulty should always be zero.
const difficulty = await OVMContextStorage.difficulty(i)
expect(difficulty.toNumber()).to.equal(0)
}
}).timeout(150000) // this specific test takes a while because it involves L1 to L2 txs
......
......@@ -68,7 +68,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Coinbase: beneficiary,
BlockNumber: msg.L1BlockNumber(),
Time: new(big.Int).SetUint64(msg.L1Timestamp()),
Difficulty: new(big.Int).Set(header.Difficulty),
Difficulty: new(big.Int), // Difficulty always returns zero.
GasLimit: header.GasLimit,
GasPrice: new(big.Int).Set(msg.GasPrice()),
L1MessageSender: l1MessageSender,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment