Skip to content

Commit

Permalink
fixed the bug caused by fillBigInt and FillTime.Duration functions (#474
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pratikspatil024 authored and cffls committed Jul 30, 2022
1 parent 8378cc9 commit 694dc02
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/cli/server/config_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func readLegacyConfig(path string) (*Config, error) {
return nil, fmt.Errorf("failed to read toml config file: %v", err)
}

var conf Config
conf := *DefaultConfig()

if _, err := toml.Decode(tomlData, &conf); err != nil {
return nil, fmt.Errorf("failed to decode toml config file: %v", err)
Expand Down
130 changes: 119 additions & 11 deletions internal/cli/server/config_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"time"

"github.com/stretchr/testify/assert"

"github.com/ethereum/go-ethereum/eth/ethconfig"
)

func TestConfigLegacy(t *testing.T) {
Expand All @@ -15,30 +17,136 @@ func TestConfigLegacy(t *testing.T) {
assert.NoError(t, err)

assert.Equal(t, config, &Config{
DataDir: "./data",
Chain: "mainnet",
Identity: Hostname(),
RequiredBlocks: map[string]string{
"a": "b",
},
LogLevel: "INFO",
DataDir: "./data",
P2P: &P2PConfig{
MaxPeers: 30,
MaxPeers: 30,
MaxPendPeers: 50,
Bind: "0.0.0.0",
Port: 30303,
NoDiscover: false,
NAT: "any",
Discovery: &P2PDiscovery{
V5Enabled: false,
Bootnodes: []string{},
BootnodesV4: []string{},
BootnodesV5: []string{},
StaticNodes: []string{},
TrustedNodes: []string{},
DNS: []string{},
},
},
Heimdall: &HeimdallConfig{
URL: "http://localhost:1317",
Without: false,
},
SyncMode: "full",
GcMode: "full",
Snapshot: true,
TxPool: &TxPoolConfig{
Locals: []string{},
Rejournal: 1 * time.Hour,
LifeTime: 1 * time.Second,
Locals: []string{},
NoLocals: false,
Journal: "",
Rejournal: 1 * time.Hour,
PriceLimit: 30000000000,
PriceBump: 10,
AccountSlots: 16,
GlobalSlots: 32768,
AccountQueue: 16,
GlobalQueue: 32768,
LifeTime: 1 * time.Second,
},
Sealer: &SealerConfig{
Enabled: false,
Etherbase: "",
GasCeil: 20000000,
GasPrice: big.NewInt(30000000000),
ExtraData: "",
},
Gpo: &GpoConfig{
Blocks: 20,
Percentile: 60,
MaxPrice: big.NewInt(100),
IgnorePrice: big.NewInt(2),
},
Sealer: &SealerConfig{
Enabled: false,
GasCeil: 20000000,
GasPrice: big.NewInt(30000000000),
JsonRPC: &JsonRPCConfig{
IPCDisable: false,
IPCPath: "",
GasCap: ethconfig.Defaults.RPCGasCap,
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
Http: &APIConfig{
Enabled: false,
Port: 8545,
Prefix: "",
Host: "localhost",
API: []string{"eth", "net", "web3", "txpool", "bor"},
Cors: []string{"*"},
VHost: []string{"*"},
},
Ws: &APIConfig{
Enabled: false,
Port: 8546,
Prefix: "",
Host: "localhost",
API: []string{"web3", "net"},
Cors: []string{"*"},
VHost: []string{"*"},
},
Graphql: &APIConfig{
Enabled: false,
Cors: []string{"*"},
VHost: []string{"*"},
},
},
Ethstats: "",
Telemetry: &TelemetryConfig{
Enabled: false,
Expensive: false,
PrometheusAddr: "",
OpenCollectorEndpoint: "",
InfluxDB: &InfluxDBConfig{
V1Enabled: false,
Endpoint: "",
Database: "",
Username: "",
Password: "",
Tags: map[string]string{},
V2Enabled: false,
Token: "",
Bucket: "",
Organization: "",
},
},
Cache: &CacheConfig{
Cache: 1024,
Rejournal: 1 * time.Hour,
Cache: 1024,
PercDatabase: 50,
PercTrie: 15,
PercGc: 25,
PercSnapshot: 10,
Journal: "triecache",
Rejournal: 1 * time.Hour,
NoPrefetch: false,
Preimages: false,
TxLookupLimit: 2350000,
},
Accounts: &AccountsConfig{
Unlock: []string{},
PasswordFile: "",
AllowInsecureUnlock: false,
UseLightweightKDF: false,
DisableBorWallet: false,
},
GRPC: &GRPCConfig{
Addr: ":3131",
},
Developer: &DeveloperConfig{
Enabled: false,
Period: 0,
},
})
}
Expand Down

0 comments on commit 694dc02

Please sign in to comment.