Skip to content

Commit

Permalink
Enable London in AllEthashProtocolChanges (erigontech#5891)
Browse files Browse the repository at this point in the history
`AllEthashProtocolChanges` should contain all the EIPs accepted by the
core developers into the Ethash consensus, including the
[London](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md)
protocol upgrade.
  • Loading branch information
yperbasis authored Oct 28, 2022
1 parent 0074ad0 commit dd43d48
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 45 deletions.
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func NewSimulatedBackendWithConfig(alloc core.GenesisAlloc, config *params.Chain

// A simulated backend always uses chainID 1337.
func NewSimulatedBackend(t *testing.T, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
b := NewSimulatedBackendWithConfig(alloc, params.AllEthashProtocolChanges, gasLimit)
b := NewSimulatedBackendWithConfig(alloc, params.TestChainConfig, gasLimit)
t.Cleanup(func() {
b.m.DB.Close()
})
Expand Down
26 changes: 13 additions & 13 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestSimulatedBackend(t *testing.T) {
// generate a transaction and confirm you can retrieve it
code := `6060604052600a8060106000396000f360606040526008565b00`
var gas uint64 = 3000000
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewContractCreation(0, u256.Num0, gas, u256.Num1, common.FromHex(code))
tx, _ = types.SignTx(tx, *signer, key)

Expand Down Expand Up @@ -126,12 +126,12 @@ func TestNewSimulatedBackend(t *testing.T) {
expectedBal := uint256.NewInt(10000000000)
sim := simTestBackend(t, testAddr)

if sim.m.ChainConfig != params.AllEthashProtocolChanges {
t.Errorf("expected sim config to equal params.AllEthashProtocolChanges, got %v", sim.m.ChainConfig)
if sim.m.ChainConfig != params.TestChainConfig {
t.Errorf("expected sim config to equal params.TestChainConfig, got %v", sim.m.ChainConfig)
}

if sim.m.ChainConfig != params.AllEthashProtocolChanges {
t.Errorf("expected sim blockchain config to equal params.AllEthashProtocolChanges, got %v", sim.m.ChainConfig)
if sim.m.ChainConfig != params.TestChainConfig {
t.Errorf("expected sim blockchain config to equal params.TestChainConfig, got %v", sim.m.ChainConfig)
}
tx, err1 := sim.DB().BeginRo(context.Background())
if err1 != nil {
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestNewSimulatedBackend_AdjustTimeFail(t *testing.T) {
// Create tx and send
amount, _ := uint256.FromBig(big.NewInt(1000))
gasPrice, _ := uint256.FromBig(big.NewInt(1))
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(0, testAddr, amount, params.TxGas, gasPrice, nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -298,7 +298,7 @@ func TestSimulatedBackend_NonceAt(t *testing.T) {
}

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(nonce, testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -339,7 +339,7 @@ func TestSimulatedBackend_SendTransaction(t *testing.T) {
bgCtx := context.Background()

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -373,7 +373,7 @@ func TestSimulatedBackend_TransactionByHash(t *testing.T) {
bgCtx := context.Background()

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -681,7 +681,7 @@ func TestSimulatedBackend_TransactionCount(t *testing.T) {
}

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -736,7 +736,7 @@ func TestSimulatedBackend_TransactionInBlock(t *testing.T) {
}

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -791,7 +791,7 @@ func TestSimulatedBackend_PendingNonceAt(t *testing.T) {
}

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down Expand Up @@ -843,7 +843,7 @@ func TestSimulatedBackend_TransactionReceipt(t *testing.T) {
bgCtx := context.Background()

// create a signed transaction to send
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(uint64(0), testAddr, uint256.NewInt(1000), params.TxGas, uint256.NewInt(1), nil)
signedTx, err := types.SignTx(tx, *signer, testKey)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestWaitDeployed(t *testing.T) {
// Create the transaction.
// Create the transaction.
var tx types.Transaction = types.NewContractCreation(0, u256.Num0, test.gas, u256.Num1, common.FromHex(test.code))
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
tx, _ = types.SignTx(tx, *signer, testKey)

// Wait for it to get mined in the background.
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestWaitDeployedCornerCases(t *testing.T) {

// Create a transaction to an account.
code := "6060604052600a8060106000396000f360606040526008565b00"
signer := types.MakeSigner(params.AllEthashProtocolChanges, 1)
signer := types.MakeSigner(params.TestChainConfig, 1)
var tx types.Transaction = types.NewTransaction(0, common.HexToAddress("0x01"), u256.Num0, 3000000, u256.Num1, common.FromHex(code))
tx, _ = types.SignTx(tx, *signer, testKey)
ctx, cancel := context.WithCancel(context.Background())
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/commands/eth_callMany_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestCallMany(t *testing.T) {
address1 = crypto.PubkeyToAddress(key1.PublicKey)
address2 = crypto.PubkeyToAddress(key2.PublicKey)
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{
address: {Balance: big.NewInt(9000000000000000000)},
address1: {Balance: big.NewInt(200000000000000000)},
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/commands/eth_call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func chainWithDeployedContract(t *testing.T) (*stages.MockSentry, common.Address
bankFunds = big.NewInt(1e9)
contract = hexutil.MustDecode("0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033")
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{bankAddress: {Balance: bankFunds}},
}
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/rpcdaemontest/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func CreateTestSentry(t *testing.T) (*stages.MockSentry, *core.ChainPack, []*cor

var (
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{
address: {Balance: big.NewInt(9000000000000000000)},
address1: {Balance: big.NewInt(200000000000000000)},
Expand Down
2 changes: 1 addition & 1 deletion core/state/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ func TestRecreateAndRewind(t *testing.T) {
address = crypto.PubkeyToAddress(key.PublicKey)
funds = big.NewInt(1000000000)
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{
address: core.GenesisAccount{Balance: funds},
},
Expand Down
4 changes: 2 additions & 2 deletions eth/stagedsync/stage_senders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestSenders(t *testing.T) {
}

// prepare tx so it works with our test
signer1 := types.MakeSigner(params.MainnetChainConfig, params.MainnetChainConfig.BerlinBlock.Uint64())
signer1 := types.MakeSigner(params.TestChainConfig, params.TestChainConfig.BerlinBlock.Uint64())
require.NoError(rawdb.WriteBody(tx, common.HexToHash("01"), 1, &types.Body{
Transactions: []types.Transaction{
mustSign(&types.AccessListTx{
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestSenders(t *testing.T) {
}))
require.NoError(rawdb.WriteCanonicalHash(tx, common.HexToHash("01"), 1))

signer2 := types.MakeSigner(params.MainnetChainConfig, params.MainnetChainConfig.BerlinBlock.Uint64())
signer2 := types.MakeSigner(params.TestChainConfig, params.TestChainConfig.BerlinBlock.Uint64())
require.NoError(rawdb.WriteBody(tx, common.HexToHash("02"), 2, &types.Body{
Transactions: []types.Transaction{
mustSign(&types.AccessListTx{
Expand Down
23 changes: 4 additions & 19 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ var (
ChainID: big.NewInt(1337),
Consensus: EtHashConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: common.Hash{},
SpuriousDragonBlock: big.NewInt(0),
Expand All @@ -129,10 +127,10 @@ var (
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: nil,
ArrowGlacierBlock: nil,
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
Ethash: new(EthashConfig),
Clique: nil,
}

// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
Expand All @@ -141,8 +139,6 @@ var (
ChainID: big.NewInt(1337),
Consensus: CliqueConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: common.Hash{},
SpuriousDragonBlock: big.NewInt(0),
Expand All @@ -153,8 +149,6 @@ var (
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
Ethash: nil,
Clique: &CliqueConfig{Period: 0, Epoch: 30000},
}

Expand All @@ -169,11 +163,9 @@ var (
CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "")

TestChainConfig = &ChainConfig{
ChainID: big.NewInt(1),
ChainID: big.NewInt(1337),
Consensus: EtHashConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: common.Hash{},
SpuriousDragonBlock: big.NewInt(0),
Expand All @@ -183,18 +175,13 @@ var (
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: nil,
ArrowGlacierBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
}

TestChainAuraConfig = &ChainConfig{
ChainID: big.NewInt(1),
Consensus: AuRaConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: common.Hash{},
SpuriousDragonBlock: big.NewInt(0),
Expand All @@ -204,8 +191,6 @@ var (
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: nil,
ArrowGlacierBlock: nil,
Aura: &AuRaConfig{},
}

Expand Down
4 changes: 2 additions & 2 deletions turbo/stages/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ func TestDoubleAccountRemoval(t *testing.T) {
input = hexutil.MustDecode("0xadbd8465")
kill = hexutil.MustDecode("0x41c0e1b5")
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{bankAddress: {Balance: bankFunds}},
}
)
Expand Down Expand Up @@ -1913,7 +1913,7 @@ func TestEIP2718Transition(t *testing.T) {
address = crypto.PubkeyToAddress(key.PublicKey)
funds = big.NewInt(1000000000)
gspec = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{
address: {Balance: funds},
// The address 0xAAAA sloads 0x00 and 0x01
Expand Down
4 changes: 2 additions & 2 deletions turbo/stages/mock_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func Mock(t *testing.T) *MockSentry {
funds := big.NewInt(1 * params.Ether)
key, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
address := crypto.PubkeyToAddress(key.PublicKey)
chainConfig := params.AllEthashProtocolChanges
chainConfig := params.TestChainConfig
gspec := &core.Genesis{
Config: chainConfig,
Alloc: core.GenesisAlloc{
Expand All @@ -457,7 +457,7 @@ func MockWithTxPool(t *testing.T) *MockSentry {
funds := big.NewInt(1 * params.Ether)
key, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
address := crypto.PubkeyToAddress(key.PublicKey)
chainConfig := params.AllEthashProtocolChanges
chainConfig := params.TestChainConfig
gspec := &core.Genesis{
Config: chainConfig,
Alloc: core.GenesisAlloc{
Expand Down

0 comments on commit dd43d48

Please sign in to comment.