Skip to content

Commit 2b6cd7e

Browse files
ceyonurDarioush Jalali
andauthored
Coreth 0.12.4 x apply (#720)
Co-authored-by: Darioush Jalali <[email protected]>
1 parent bc50ccf commit 2b6cd7e

33 files changed

+216
-207
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
shell: bash
1919
- uses: actions/setup-go@v3
2020
with:
21-
go-version: "1.20"
21+
go-version: "1.19"
2222
- name: golangci-lint
2323
uses: golangci/golangci-lint-action@v3
2424
with:
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/checkout@v3
3434
- uses: actions/setup-go@v3
3535
with:
36-
go-version: "1.20"
36+
go-version: "1.19"
3737
- run: go mod download
3838
shell: bash
3939
- run: ./scripts/build.sh ./build/subnetevm
@@ -64,7 +64,7 @@ jobs:
6464
- name: Set up Go
6565
uses: actions/setup-go@v3
6666
with:
67-
go-version: "1.20"
67+
go-version: "1.19"
6868
- name: Use Node.js
6969
uses: actions/setup-node@v3
7070
with:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
ARG AVALANCHE_VERSION
66

77
# ============= Compilation Stage ================
8-
FROM golang:1.20.1-buster AS builder
8+
FROM golang:1.19.6-buster AS builder
99
RUN apt-get update && apt-get install -y --no-install-recommends bash=5.0-4 make=4.2.1-1.2 gcc=4:8.3.0-1 musl-dev=1.1.21-2 ca-certificates=20200601~deb10u2 linux-headers-amd64
1010

1111
WORKDIR /build

accounts/abi/bind/backends/simulated.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ type SimulatedBackend struct {
107107
// and uses a simulated blockchain for testing purposes.
108108
// A simulated backend always uses chainID 1337.
109109
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
110-
cpcfg := params.SimulatedTestChainConfig
111-
if cpcfg.FeeConfig.GasLimit.Uint64() != gasLimit {
112-
cpcfg.FeeConfig.GasLimit = big.NewInt(int64(gasLimit))
113-
}
110+
copyConfig := *params.TestChainConfig
111+
copyConfig.ChainID = big.NewInt(1337)
112+
copyConfig.FeeConfig.GasLimit = big.NewInt(int64(gasLimit))
114113
genesis := core.Genesis{
115-
Config: params.SimulatedTestChainConfig,
114+
Config: &copyConfig,
116115
GasLimit: gasLimit,
117116
Alloc: alloc,
118117
}

accounts/abi/bind/backends/simulated_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,6 @@ func TestNewSimulatedBackend(t *testing.T) {
137137
sim := simTestBackend(testAddr)
138138
defer sim.Close()
139139

140-
if sim.config != params.SimulatedTestChainConfig {
141-
t.Errorf("expected sim config to equal params.AllEthashProtocolChanges, got %v", sim.config)
142-
}
143-
144-
if sim.blockchain.Config() != params.SimulatedTestChainConfig {
145-
t.Errorf("expected sim blockchain config to equal params.AllEthashProtocolChanges, got %v", sim.config)
146-
}
147-
148140
stateDB, _ := sim.blockchain.State()
149141
bal := stateDB.GetBalance(testAddr)
150142
if bal.Cmp(expectedBal) != 0 {

accounts/keystore/account_cache_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var (
6060
}
6161
)
6262

63+
// waitWatcherStart waits up to 1s for the keystore watcher to start.
6364
func waitWatcherStart(ks *KeyStore) bool {
6465
// On systems where file watch is not supported, just return "ok".
6566
if !ks.cache.watcher.enabled() {

core/bench_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
"github.com/ethereum/go-ethereum/common"
4242
"github.com/ethereum/go-ethereum/common/math"
4343
"github.com/ethereum/go-ethereum/crypto"
44-
"github.com/stretchr/testify/require"
4544
)
4645

4746
func BenchmarkInsertChain_empty_memdb(b *testing.B) {
@@ -175,8 +174,7 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) {
175174

176175
// Time the insertion of the new chain.
177176
// State and blocks are stored in the same DB.
178-
chainman, err := NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
179-
require.NoError(b, err)
177+
chainman, _ := NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
180178
defer chainman.Stop()
181179
b.ReportAllocs()
182180
b.ResetTimer()

core/blockchain.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ func NewBlockChain(
310310
if cacheConfig == nil {
311311
return nil, errCacheConfigNotSpecified
312312
}
313-
314313
// Open trie database with provided config
315314
triedb := trie.NewDatabaseWithConfig(db, &trie.Config{
316315
Cache: cacheConfig.TrieCleanLimit,

core/blockchain_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ func TestTrieCleanJournal(t *testing.T) {
143143
// Ensure that key1 has some funds in the genesis block.
144144
genesisBalance := big.NewInt(1000000)
145145
gspec := &Genesis{
146-
Config: &params.ChainConfig{HomesteadBlock: new(big.Int), FeeConfig: params.DefaultFeeConfig},
147-
Alloc: GenesisAlloc{addr1: {Balance: genesisBalance}},
148-
GasLimit: params.DefaultFeeConfig.GasLimit.Uint64(),
146+
Config: &params.ChainConfig{HomesteadBlock: new(big.Int)},
147+
Alloc: GenesisAlloc{addr1: {Balance: genesisBalance}},
149148
}
150149

151150
blockchain, err := create(chainDB, gspec, common.Hash{})
@@ -639,9 +638,8 @@ func TestTransactionIndices(t *testing.T) {
639638
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
640639
funds = big.NewInt(10000000000000)
641640
gspec = &Genesis{
642-
Config: &params.ChainConfig{HomesteadBlock: new(big.Int), FeeConfig: params.DefaultFeeConfig},
643-
Alloc: GenesisAlloc{addr1: {Balance: funds}},
644-
GasLimit: params.DefaultFeeConfig.GasLimit.Uint64(),
641+
Config: &params.ChainConfig{HomesteadBlock: new(big.Int)},
642+
Alloc: GenesisAlloc{addr1: {Balance: funds}},
645643
}
646644
signer = types.LatestSigner(gspec.Config)
647645
)
@@ -1077,8 +1075,7 @@ func TestEIP3651(t *testing.T) {
10771075
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
10781076
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
10791077
gspec = &Genesis{
1080-
Config: params.TestChainConfig,
1081-
GasLimit: params.TestChainConfig.FeeConfig.GasLimit.Uint64(),
1078+
Config: params.TestChainConfig,
10821079
Alloc: GenesisAlloc{
10831080
addr1: {Balance: funds},
10841081
addr2: {Balance: funds},
@@ -1110,6 +1107,7 @@ func TestEIP3651(t *testing.T) {
11101107
Balance: big.NewInt(0),
11111108
},
11121109
},
1110+
GasLimit: params.TestChainConfig.FeeConfig.GasLimit.Uint64(),
11131111
}
11141112
)
11151113

core/chain_makers_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ func ExampleGenerateChain() {
8181
}
8282

8383
// Import the chain. This runs all block validation rules.
84-
blockchain, err := NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
85-
if err != nil {
86-
fmt.Printf("could not create blockchain: %v\n", err)
87-
return
88-
}
84+
blockchain, _ := NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
8985
defer blockchain.Stop()
9086

9187
if i, err := blockchain.InsertChain(chain); err != nil {

core/genesis.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ func SetupGenesisBlock(
187187
if genesis.Config.IsSubnetEVM(genesis.Timestamp) {
188188
gasLimitConfig := genesis.Config.FeeConfig.GasLimit.Uint64()
189189
if gasLimitConfig != genesis.GasLimit {
190-
return nil, common.Hash{}, fmt.Errorf("gas limit in fee config (%d) does not match gas limit in header (%d)", gasLimitConfig, genesis.GasLimit)
190+
return nil, common.Hash{}, fmt.Errorf(
191+
"gas limit in fee config (%d) does not match gas limit in header (%d)",
192+
gasLimitConfig,
193+
genesis.GasLimit,
194+
)
191195
}
192196
// Verify config
193197
if err := genesis.Config.Verify(); err != nil {
@@ -227,7 +231,9 @@ func SetupGenesisBlock(
227231
return newcfg, common.Hash{}, err
228232
}
229233
storedcfg := rawdb.ReadChainConfig(db, stored)
234+
// If there is no previously stored chain config, write the chain config to disk.
230235
if storedcfg == nil {
236+
// Note: this can happen since we did not previously write the genesis block and chain config in the same batch.
231237
log.Warn("Found genesis block without chain config")
232238
rawdb.WriteChainConfig(db, stored, newcfg)
233239
return newcfg, stored, nil

0 commit comments

Comments
 (0)