mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
* Adding in Mumbai/Mainnet precursor deb packaging for tests to use during upgrade(iterations to come) * Added changes per discussion in PR, more changes may be necessary * Adding prerelease true * Disabling goreleaser * Removing README swap file * change bor_dir and add bor user for v0.3.0 release * rollback bor user and use root * metrics: handle equal to separated config flag (#596) * metrics: handle based config path * internal/cli/server: add more context to logs * use space separated flag and value in bor.service * fixed static-nodes related buf (os independent) (#598) * fixed static-nodes related buf (os independent) * taking static-nodes as input if default not present * Update default flags (#600) * internal/cli/server: use geth's default for txpool.pricelimit and add comments * builder/files: update config.toml for mainnet * packaging/templates: update defaults for mainnet and mumbai * internal/cli/server: skip overriding cache * packaging/templates: update cache value for mainnet * packaging/templates: update gcmode for archive mumbai node * metrics: handle nil telemetry config (#601) * resolve merge conflicts * update go version in release.yml * update goversion in makefile * update Docker login for goreleaser-cross v1.19 * Cleanup for the packager to use git tag in the package profile naming. Added conditional check for directory structure, this is in prep for v0.3.1, as this will create a failure on upgrade path in package due to file exist * added a toml configuration file with comments describing each flag (#607) * added a toml configuration file with comments describing each flag * internal/cli/server: update flag description * docs/cli: update example config and description of flags * docs: update new-cli docs Co-authored-by: Manav Darji <manavdarji.india@gmail.com> * Adding of 0.3.0 package changes, control file updates, postinst changes, and packager update * added ancient datadir flag and toml field, need to decide on default value and update the conversion script * updated toml files with ancient field * Add support for new flags in new config.toml, which were present in old config.toml (#612) * added HTTPTimeouts, and TrieTimeout flag in new tol, from old toml * added RAW fields for these time.Duration flags * updated the conversion script to support these extra 4 flags * removed hcl and json config tests as we are only supporting toml config files * updated toml files with cache.timeout field * updated toml files with jsonrpc.timeouts field * tests/bor: expect a call for latest checkpoint * tests/bor: expect a call for latest checkpoint * packaging/templates: update cache values for archive nodes Co-authored-by: Manav Darji <manavdarji.india@gmail.com> * remove unwanted code * Fix docker publish authentication issue In gorelease-cross 1.19+, dockerhub authentication will require docker logion action followed by mounting docker config file. See https://github.com/goreleaser/goreleaser-cross#github-actions. * Revert "update Docker login for goreleaser-cross v1.19" This reverts commit4d19cf5342. * Bump version to stable * Revert "Merge pull request #435 from maticnetwork/POS-553" This reverts commit657d262def, reversing changes made to88dbfa1c13. * revert change for release for go1.19 * Add default values to CLI helper and docs This commit adds default values to CLI helper and docs. When the default value of a string flag, slice string flag, or map string flag is empty, its helper message won't show any default value. * Add a summary of new CLI in docs * Updating packager as binutils changed version so that apt-get installs current versions * Add state pruning to new CLI * Minor wording fix in prune state description * Bumping control file versions * Mainnet Delhi fork * Set version to stable * change delhi hardfork block number * handle future chain import and skip peer drop (#650) * handle future chain import and skip peer drop * add block import metric * params: bump version to v0.3.3-stable * Bump bor version in control files for v0.3.3 mainnet release Co-authored-by: Daniel Jones <djones@polygon.technology> Co-authored-by: Will Button <wbutton@polygon.technology> Co-authored-by: Will Button <will@willbutton.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Daniel Jones <105369507+djpolygon@users.noreply.github.com> Co-authored-by: Pratik Patil <pratikspatil024@gmail.com> Co-authored-by: Arpit Temani <temaniarpit27@gmail.com> Co-authored-by: Jerry <jerrycgh@gmail.com>
135 lines
2.7 KiB
Go
135 lines
2.7 KiB
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConfigDefault(t *testing.T) {
|
|
// the default config should work out of the box
|
|
config := DefaultConfig()
|
|
assert.NoError(t, config.loadChain())
|
|
|
|
_, err := config.buildNode()
|
|
assert.NoError(t, err)
|
|
|
|
_, err = config.buildEth(nil, nil)
|
|
assert.NoError(t, err)
|
|
}
|
|
|
|
func TestConfigMerge(t *testing.T) {
|
|
c0 := &Config{
|
|
Chain: "0",
|
|
Snapshot: true,
|
|
RequiredBlocks: map[string]string{
|
|
"a": "b",
|
|
},
|
|
TxPool: &TxPoolConfig{
|
|
LifeTime: 5 * time.Second,
|
|
},
|
|
P2P: &P2PConfig{
|
|
Discovery: &P2PDiscovery{
|
|
StaticNodes: []string{
|
|
"a",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
c1 := &Config{
|
|
Chain: "1",
|
|
RequiredBlocks: map[string]string{
|
|
"b": "c",
|
|
},
|
|
P2P: &P2PConfig{
|
|
MaxPeers: 10,
|
|
Discovery: &P2PDiscovery{
|
|
StaticNodes: []string{
|
|
"b",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
expected := &Config{
|
|
Chain: "1",
|
|
Snapshot: false,
|
|
RequiredBlocks: map[string]string{
|
|
"a": "b",
|
|
"b": "c",
|
|
},
|
|
P2P: &P2PConfig{
|
|
MaxPeers: 10,
|
|
Discovery: &P2PDiscovery{
|
|
StaticNodes: []string{
|
|
"b",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
assert.NoError(t, c0.Merge(c1))
|
|
assert.Equal(t, c0, expected)
|
|
}
|
|
|
|
func TestDefaultDatatypeOverride(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
// This test is specific to `maxpeers` flag (for now) to check
|
|
// if default datatype value (0 in case of uint64) is overridden.
|
|
c0 := &Config{
|
|
P2P: &P2PConfig{
|
|
MaxPeers: 30,
|
|
},
|
|
}
|
|
|
|
c1 := &Config{
|
|
P2P: &P2PConfig{
|
|
MaxPeers: 0,
|
|
},
|
|
}
|
|
|
|
expected := &Config{
|
|
P2P: &P2PConfig{
|
|
MaxPeers: 0,
|
|
},
|
|
}
|
|
|
|
assert.NoError(t, c0.Merge(c1))
|
|
assert.Equal(t, c0, expected)
|
|
}
|
|
|
|
var dummyEnodeAddr = "enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303"
|
|
|
|
func TestConfigBootnodesDefault(t *testing.T) {
|
|
t.Run("EmptyBootnodes", func(t *testing.T) {
|
|
// if no bootnodes are specific, we use the ones from the genesis chain
|
|
config := DefaultConfig()
|
|
assert.NoError(t, config.loadChain())
|
|
|
|
cfg, err := config.buildNode()
|
|
assert.NoError(t, err)
|
|
assert.NotEmpty(t, cfg.P2P.BootstrapNodes)
|
|
})
|
|
t.Run("NotEmptyBootnodes", func(t *testing.T) {
|
|
// if bootnodes specific, DO NOT load the genesis bootnodes
|
|
config := DefaultConfig()
|
|
config.P2P.Discovery.Bootnodes = []string{dummyEnodeAddr}
|
|
|
|
cfg, err := config.buildNode()
|
|
assert.NoError(t, err)
|
|
assert.Len(t, cfg.P2P.BootstrapNodes, 1)
|
|
})
|
|
}
|
|
|
|
func TestMakePasswordListFromFile(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
t.Run("ReadPasswordFile", func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
result, _ := MakePasswordListFromFile("./testdata/password.txt")
|
|
assert.Equal(t, []string{"test1", "test2"}, result)
|
|
})
|
|
}
|