Commit 83c2516e authored by kf's avatar kf Committed by Kelvin Fichter

feat: have coinbase always return fee vault

parent db903270
...@@ -6,12 +6,14 @@ contract OVMContextStorage { ...@@ -6,12 +6,14 @@ contract OVMContextStorage {
mapping (uint256 => uint256) public blockNumbers; mapping (uint256 => uint256) public blockNumbers;
mapping (uint256 => uint256) public timestamps; mapping (uint256 => uint256) public timestamps;
mapping (uint256 => uint256) public difficulty; mapping (uint256 => uint256) public difficulty;
mapping (uint256 => address) public coinbases;
uint256 public index = 0; uint256 public index = 0;
fallback() external { fallback() external {
blockNumbers[index] = block.number; blockNumbers[index] = block.number;
timestamps[index] = block.timestamp; timestamps[index] = block.timestamp;
difficulty[index] = block.difficulty; difficulty[index] = block.difficulty;
coinbases[index] = block.coinbase;
index++; index++;
} }
} }
...@@ -3,6 +3,7 @@ import { expect } from 'chai' ...@@ -3,6 +3,7 @@ import { expect } from 'chai'
/* Imports: External */ /* Imports: External */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { injectL2Context } from '@eth-optimism/core-utils' import { injectL2Context } from '@eth-optimism/core-utils'
import { predeploys } from '@eth-optimism/contracts'
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
...@@ -76,6 +77,10 @@ describe('OVM Context: Layer 2 EVM Context', () => { ...@@ -76,6 +77,10 @@ describe('OVM Context: Layer 2 EVM Context', () => {
// Difficulty should always be zero. // Difficulty should always be zero.
const difficulty = await OVMContextStorage.difficulty(i) const difficulty = await OVMContextStorage.difficulty(i)
expect(difficulty.toNumber()).to.equal(0) expect(difficulty.toNumber()).to.equal(0)
// Coinbase should always be sequencer fee vault.
const coinbase = await OVMContextStorage.coinbases(i)
expect(coinbase).to.equal(predeploys.OVM_SequencerFeeVault)
} }
}).timeout(150000) // this specific test takes a while because it involves L1 to L2 txs }).timeout(150000) // this specific test takes a while because it involves L1 to L2 txs
......
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/rollup/dump"
"github.com/ethereum/go-ethereum/rollup/rcfg" "github.com/ethereum/go-ethereum/rollup/rcfg"
) )
...@@ -65,7 +66,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author ...@@ -65,7 +66,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Transfer: Transfer, Transfer: Transfer,
GetHash: GetHashFn(header, chain), GetHash: GetHashFn(header, chain),
Origin: msg.From(), Origin: msg.From(),
Coinbase: beneficiary, Coinbase: dump.OvmFeeWallet, // Coinbase is the fee vault.
BlockNumber: msg.L1BlockNumber(), BlockNumber: msg.L1BlockNumber(),
Time: new(big.Int).SetUint64(msg.L1Timestamp()), Time: new(big.Int).SetUint64(msg.L1Timestamp()),
Difficulty: new(big.Int), // Difficulty always returns zero. Difficulty: new(big.Int), // Difficulty always returns zero.
......
...@@ -5,3 +5,4 @@ import ( ...@@ -5,3 +5,4 @@ import (
) )
var OvmEthAddress = common.HexToAddress("0x4200000000000000000000000000000000000006") var OvmEthAddress = common.HexToAddress("0x4200000000000000000000000000000000000006")
var OvmFeeWallet = common.HexToAddress("0x4200000000000000000000000000000000000011")
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