Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
80eb15b
refactor(shared): centralized config_protos
deblasis Dec 15, 2022
35b128a
feat(test_artifacts): deterministic keygen
deblasis Dec 15, 2022
df5c92e
refactor(runtime): refactored to use centralized configs
deblasis Dec 15, 2022
97803dd
refactor(Consensus): refactored to use centralized config
deblasis Dec 15, 2022
d439459
refactor(logger): refactored to use centralized logging
deblasis Dec 15, 2022
807086f
refactor(P2P): refactored to use centralized configs
deblasis Dec 15, 2022
774e9fd
refactor(Persistence): refactored to use centralized configs
deblasis Dec 15, 2022
c88f455
refactor(RPC): refactored to use centralized configs
deblasis Dec 15, 2022
d2f3ba7
refactor(telemetry): refactored to use centralized configs
deblasis Dec 15, 2022
ab115f6
refactor(Utility): refactored to use centralized configs
deblasis Dec 15, 2022
80a7ba2
refactor(shared): refactored to use centralized configs
deblasis Dec 15, 2022
6187b29
style(shared): 🧹
deblasis Dec 15, 2022
fe88719
refactor(config): removed baseconfig, added max_mempool_count
deblasis Dec 19, 2022
375fcac
refactor(config): removed base_config
deblasis Dec 19, 2022
2ea6b95
refactor(genesis): single genesis
deblasis Dec 19, 2022
f599882
refactor(core): core types
deblasis Dec 19, 2022
43c560f
refactor(shared): core types
deblasis Dec 19, 2022
f60517b
refactor(genesis): centralized genesis
deblasis Dec 19, 2022
a689e90
refactor(consensus): removed converter
deblasis Dec 19, 2022
b4a5fd9
refactor(persistence): removed converter
deblasis Dec 19, 2022
535130d
chore(go.mod): tidy
deblasis Dec 19, 2022
00de795
refactor(consensus): centralized genesis + core types
deblasis Dec 19, 2022
0165bd4
refactor(persistence): centralized genesis + core types
deblasis Dec 19, 2022
2248e74
refactor(p2p): centralized genesis + core types
deblasis Dec 19, 2022
fa09298
refactor(runtime): centralized genesis + core types
deblasis Dec 19, 2022
f71d831
refactor(utility): centralized genesis + core types
deblasis Dec 19, 2022
910b20e
refactor(shared): centralized genesis + core types
deblasis Dec 19, 2022
4da6cbb
chore(telemetry): simplified interface
deblasis Dec 19, 2022
75fa712
refactor(makefile): updated to handle relocated protos
deblasis Dec 19, 2022
31a4013
wip new RPC endpoints
deblasis Dec 19, 2022
0b56298
test(consensus): fixes
deblasis Dec 19, 2022
f52182f
chore(consensus): 🧹
deblasis Dec 19, 2022
8e02599
chore(runtime): 🧹
deblasis Dec 19, 2022
04c75d4
chore(Makefile): | | |
deblasis Dec 19, 2022
b54cc52
refactor(persistence): genesis stakedActorsInsertConfigs
deblasis Dec 20, 2022
052c491
style(persistence): nit
deblasis Dec 21, 2022
01a1fb2
style(persistence): nits
deblasis Dec 21, 2022
b6d86fd
style(persistence): nits
deblasis Dec 21, 2022
27db554
style(persistence): nits
deblasis Dec 21, 2022
20f862d
style(runtime): nits
deblasis Dec 21, 2022
7396e81
docs(runtime): changelog
deblasis Dec 21, 2022
f37f02a
docs(consensus): changelog
deblasis Dec 21, 2022
b50bd6a
docs(persistence): changelog
deblasis Dec 21, 2022
2b04333
chore(persistence): 🧹
deblasis Dec 21, 2022
a49a8cd
chore(utility): spacing
deblasis Dec 21, 2022
cf55682
docs(utility): changelog
deblasis Dec 21, 2022
285932f
docs(P2P): changelog
deblasis Dec 21, 2022
4e2cc72
chore(P2P): nits
deblasis Dec 21, 2022
829e2ff
docs(RPC): changelog
deblasis Dec 21, 2022
a89f218
docs(shared): changelog
deblasis Dec 21, 2022
9dfafb9
refactor(consensus): ValidatorMap pointers vs values
deblasis Dec 26, 2022
7cb47dc
chore(persistence): cleanup
deblasis Dec 26, 2022
a09c234
chore(runtime): nits
deblasis Dec 26, 2022
7b576df
chore(runtime): fixed issue reference
deblasis Dec 26, 2022
0a9f151
chore(core): added todo reference
deblasis Dec 26, 2022
eb685fb
refactor(core): protos using core, utilTypes phased out
deblasis Dec 26, 2022
ceb768e
refactor(CLI): updated to use coreTypes instead of utilTypes
deblasis Dec 26, 2022
82e463c
refactor(runtime): updated to use coreTypes instead of utilTypes
deblasis Dec 26, 2022
555bdc2
refactor(core): ActorType.GetName()
deblasis Dec 26, 2022
b8b6674
refactor(utility): updated to use coreTypes instead of utilTypes
deblasis Dec 26, 2022
c7d1326
fix(core): pool_names value fix
deblasis Dec 26, 2022
469635a
refactor(core): enum simplification, removed trailing _POOL
deblasis Dec 27, 2022
d9da996
Update Makefile
deblasis Dec 27, 2022
5bef1b1
Update persistence/genesis.go
deblasis Dec 27, 2022
8ceecb3
refactor(runtime): factoring instead of sync.Once
deblasis Dec 27, 2022
8561177
chore(runtime): cleanup
deblasis Dec 27, 2022
5df685c
refactor(runtime): parseGenesisJSON -> parseGenesis
deblasis Dec 27, 2022
f5694ab
refactor(shared): node -> serviceNode
deblasis Dec 27, 2022
196845e
refactor(runtime): simplified keygen
deblasis Dec 27, 2022
d16a455
fix(persistence): genesis pool handling
deblasis Dec 27, 2022
7f64ccb
Update runtime/test_artifacts/generator.go
deblasis Dec 27, 2022
ece9cf8
fix(persistence): added missing actortype to queries
deblasis Dec 27, 2022
8305e6e
fix(P2P): ActorsToAddrBook considers only validators
deblasis Dec 27, 2022
048ebbc
fix(core): PoolNames FriendlyName()
deblasis Dec 27, 2022
0db801d
docs(demos): iteration 3 demo keys management
deblasis Dec 27, 2022
5bacd1b
fix(P2P): added missing ActorType in tests
deblasis Dec 27, 2022
8a9c0ae
fix(utility): poolName friendlyName
deblasis Dec 27, 2022
505a104
test(persistence): updated statehash in deterministic test
deblasis Dec 27, 2022
3cfd657
refactor(runtime): default config handling and separation
deblasis Dec 28, 2022
2c420c7
feat(genesis): params are not hardcoded anymore
deblasis Dec 28, 2022
0d62c5b
test(utility): defaults from test_artifacts
deblasis Dec 28, 2022
10e04cc
fix(config): removed redundant cfg (now we have defaults logic)
deblasis Dec 28, 2022
e9cc6e8
Update utility/types/proto/stake_status.proto
deblasis Dec 28, 2022
1e6ceab
Revert "Update utility/types/proto/stake_status.proto"
deblasis Dec 28, 2022
623999f
docs(utility): linked issue #258 to todo item
deblasis Dec 28, 2022
e9ebc6e
refactor(test_artifacts): DRY config generation logic
deblasis Dec 28, 2022
4e24c6a
docs(build): CHANGELOG
deblasis Dec 28, 2022
b26663f
docs(build): typo
deblasis Dec 28, 2022
be6ba7d
docs(logger): CHANGELOG
deblasis Dec 28, 2022
df13c44
docs(telemetry): CHANGELOG
deblasis Dec 28, 2022
c47ddfa
docs(consensus): CHANGELOG
deblasis Dec 28, 2022
31c79db
docs(P2P): CHANGELOG
deblasis Dec 28, 2022
00dc7f4
docs(persistence): CHANGELOG
deblasis Dec 28, 2022
ea999af
docs(RPC): CHANGELOG
deblasis Dec 28, 2022
9edd1e4
docs(runtime): CHANGELOG
deblasis Dec 28, 2022
2d58822
docs(shared): CHANGELOG
deblasis Dec 28, 2022
834b885
docs(utility): CHANGELOG
deblasis Dec 28, 2022
f6100ad
docs(persistence): CHANGELOG consolidation
deblasis Dec 28, 2022
c91a7ad
Merge remote-tracking branch 'upstream/main' into issue/396-consolida…
deblasis Dec 28, 2022
a4fa535
docs(CLI): CHANGELOG
deblasis Dec 28, 2022
8d02ad5
fix(CLI): CHANGELOG versioning
deblasis Dec 28, 2022
ff57847
Update docs/demos/iteration_3_end_to_end_tx.md
deblasis Dec 30, 2022
4bddf5f
Update docs/demos/iteration_3_end_to_end_tx.md
deblasis Dec 30, 2022
0532b07
Update persistence/docs/CHANGELOG.md
deblasis Dec 30, 2022
c86f8c5
refactor(persistence): s/InitParams/InitGenesisParams
deblasis Dec 30, 2022
69cb8eb
docs(runtime): config options godoc
deblasis Dec 30, 2022
00ae143
refactor(runtime): default values in defaults package
deblasis Dec 30, 2022
5b237f2
refactor(core): poolNames -> pools
deblasis Dec 30, 2022
8d9cb1a
docs(P2P): added TODO
deblasis Dec 30, 2022
d7a521e
refactor(persistence): actorType from schema
deblasis Dec 30, 2022
b8d1946
chore(shared): CHANGELOG 📆
deblasis Dec 30, 2022
fb42810
test(persistence): added test for GetAllStakedActors
deblasis Jan 3, 2023
6ff3c3a
refactor(persistence): actorType set in getActorForRow
deblasis Jan 3, 2023
414276a
chore(persistence): argument types in InsertFn
deblasis Jan 3, 2023
d82b018
docs(shared): CHANGELOGs dates
deblasis Jan 3, 2023
6dea794
chore(shared): rm val keys
deblasis Jan 3, 2023
52b500b
chore(gitignore): added validator keys
deblasis Jan 3, 2023
ac0e99d
docs(iteration3demo): updated to source keys from /tmp/
deblasis Jan 3, 2023
3524dc9
docs(P2P): added todo #426
deblasis Jan 3, 2023
636638f
docs(CLI): updated README
deblasis Jan 3, 2023
2f73d5e
docs(runtime): updated README
deblasis Jan 3, 2023
26ef163
docs(development): README
deblasis Jan 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,7 @@ protogen_local: go_protoc-go-inject-tag
protoc --go_opt=paths=source_relative -I=./utility/types/proto --go_out=./utility/types ./utility/types/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./consensus/types/proto --go_out=./consensus/types ./consensus/types/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./p2p/raintree/types/proto --go_out=./p2p/types ./p2p/raintree/types/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./p2p/types/proto --go_out=./p2p/types ./p2p/types/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./telemetry/proto --go_out=./telemetry ./telemetry/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./logger/proto --go_out=./logger ./logger/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./rpc/types/proto --go_out=./rpc/types ./rpc/types/proto/*.proto --experimental_allow_proto3_optional
protoc --go_opt=paths=source_relative -I=./runtime/configs/proto --go_out=./runtime/configs ./runtime/configs/proto/*.proto --experimental_allow_proto3_optional
echo "View generated proto files by running: make protogen_show"

.PHONY: protogen_docker_m1
Expand Down
5 changes: 2 additions & 3 deletions consensus/consensus_tests/pacemaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ func TestTinyPacemakerTimeouts(t *testing.T) {
paceMakerTimeout := 50 * time.Millisecond
runtimeMgrs := GenerateNodeRuntimeMgrs(t, numValidators, clockMock)
for _, runtimeConfig := range runtimeMgrs {
if consCfg, ok := runtimeConfig.GetConfig().GetConsensusConfig().(consensus.HasPacemakerConfig); ok {
consCfg.GetPacemakerConfig().SetTimeoutMsec(paceMakerTimeoutMsec)
}
consCfg := runtimeConfig.GetConfig().Consensus.PacemakerConfig
consCfg.TimeoutMsec = paceMakerTimeoutMsec
}

// Create & start test pocket nodes
Expand Down
23 changes: 12 additions & 11 deletions consensus/consensus_tests/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/pokt-network/pocket/consensus"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/runtime"
"github.com/pokt-network/pocket/runtime/configs"
"github.com/pokt-network/pocket/runtime/test_artifacts"
"github.com/pokt-network/pocket/shared"
"github.com/pokt-network/pocket/shared/codec"
Expand Down Expand Up @@ -66,17 +67,17 @@ func GenerateNodeRuntimeMgrs(_ *testing.T, validatorCount int, clockMgr clock.Cl
runtimeMgrs := make([]runtime.Manager, validatorCount)
var validatorKeys []string
genesisState, validatorKeys := test_artifacts.NewGenesisState(validatorCount, 1, 1, 1)
configs := test_artifacts.NewDefaultConfigs(validatorKeys)
for i, config := range configs {
runtime.WithConsensusConfig(&typesCons.ConsensusConfig{
PrivateKey: config.GetBaseConfig().GetPrivateKey(),
cfgs := test_artifacts.NewDefaultConfigs(validatorKeys)
for i, config := range cfgs {
config.Consensus = &configs.ConsensusConfig{
PrivateKey: config.PrivateKey,
MaxMempoolBytes: 500000000,
PacemakerConfig: &typesCons.PacemakerConfig{
PacemakerConfig: &configs.PacemakerConfig{
TimeoutMsec: 5000,
Manual: false,
DebugTimeBetweenStepsMsec: 0,
},
})(config)
}
runtimeMgrs[i] = *runtime.NewManager(config, genesisState, runtime.WithClock(clockMgr))
}
return runtimeMgrs
Expand All @@ -91,9 +92,9 @@ func CreateTestConsensusPocketNodes(
// TODO(design): The order here is important in order for NodeId to be set correctly below.
// This logic will need to change once proper leader election is implemented.
sort.Slice(runtimeMgrs, func(i, j int) bool {
pk, err := cryptoPocket.NewPrivateKey(runtimeMgrs[i].GetConfig().GetBaseConfig().GetPrivateKey())
pk, err := cryptoPocket.NewPrivateKey(runtimeMgrs[i].GetConfig().PrivateKey)
require.NoError(t, err)
pk2, err := cryptoPocket.NewPrivateKey(runtimeMgrs[j].GetConfig().GetBaseConfig().GetPrivateKey())
pk2, err := cryptoPocket.NewPrivateKey(runtimeMgrs[j].GetConfig().PrivateKey)
require.NoError(t, err)
return pk.Address().String() < pk2.Address().String()
})
Expand All @@ -114,9 +115,9 @@ func CreateTestConsensusPocketNodesNew(
// TODO(design): The order here is important in order for NodeId to be set correctly below.
// This logic will need to change once proper leader election is implemented.
sort.Slice(runtimeMgrs, func(i, j int) bool {
pk, err := cryptoPocket.NewPrivateKey(runtimeMgrs[i].GetConfig().GetBaseConfig().GetPrivateKey())
pk, err := cryptoPocket.NewPrivateKey(runtimeMgrs[i].GetConfig().PrivateKey)
require.NoError(t, err)
pk2, err := cryptoPocket.NewPrivateKey(runtimeMgrs[j].GetConfig().GetBaseConfig().GetPrivateKey())
pk2, err := cryptoPocket.NewPrivateKey(runtimeMgrs[j].GetConfig().PrivateKey)
require.NoError(t, err)
return pk.Address().String() < pk2.Address().String()
})
Expand Down Expand Up @@ -149,7 +150,7 @@ func CreateTestConsensusPocketNode(

require.NoError(t, err)

pk, err := cryptoPocket.NewPrivateKey(runtimeMgr.GetConfig().GetBaseConfig().GetPrivateKey())
pk, err := cryptoPocket.NewPrivateKey(runtimeMgr.GetConfig().PrivateKey)
require.NoError(t, err)

pocketNode := shared.NewNodeWithP2PAddress(pk.Address())
Expand Down
2 changes: 1 addition & 1 deletion consensus/hotstuff_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (m *consensusModule) validatePartialSignature(msg *typesCons.HotstuffMessag
// and does not recursively determine the size of all the underlying elements
// Add proper tests and implementation once the mempool is implemented.
func (m *consensusModule) tempIndexHotstuffMessage(msg *typesCons.HotstuffMessage) {
if m.consCfg.GetMaxMempoolBytes() < uint64(unsafe.Sizeof(m.messagePool)) {
if m.consCfg.MaxMempoolBytes < uint64(unsafe.Sizeof(m.messagePool)) {
m.nodeLogError(typesCons.DisregardHotstuffMessage, typesCons.ErrConsensusMempoolFull)
return
}
Expand Down
30 changes: 8 additions & 22 deletions consensus/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/pokt-network/pocket/consensus/leader_election"
consensusTelemetry "github.com/pokt-network/pocket/consensus/telemetry"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/runtime/configs"
"github.com/pokt-network/pocket/shared/codec"
cryptoPocket "github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/shared/modules"
Expand All @@ -21,8 +22,8 @@ const (
)

var (
_ modules.ConsensusModule = &consensusModule{}
_ modules.ConsensusConfig = &typesCons.ConsensusConfig{}
_ modules.ConsensusModule = &consensusModule{}
// _ modules.ConsensusConfig = &typesCons.ConsensusConfig{}
_ modules.ConsensusGenesisState = &typesCons.ConsensusGenesisState{}
_ ConsensusDebugModule = &consensusModule{}
)
Expand All @@ -31,7 +32,7 @@ type consensusModule struct {
bus modules.Bus
privateKey cryptoPocket.Ed25519PrivateKey

consCfg modules.ConsensusConfig
consCfg *configs.ConsensusConfig
consGenesis modules.ConsensusGenesisState

// m is a mutex used to control synchronization when multiple goroutines are accessing the struct and its fields / properties.
Expand Down Expand Up @@ -117,11 +118,7 @@ func Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {
func (*consensusModule) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {
var m *consensusModule

cfg := runtimeMgr.GetConfig()
if err := m.ValidateConfig(cfg); err != nil {
return nil, fmt.Errorf("config validation failed: %w", err)
}
consensusCfg := cfg.GetConsensusConfig()
consensusCfg := runtimeMgr.GetConfig().Consensus

genesis := runtimeMgr.GetGenesis()
if err := m.ValidateGenesis(genesis); err != nil {
Expand All @@ -142,7 +139,7 @@ func (*consensusModule) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, e

valMap := typesCons.ActorListToValidatorMap(consensusGenesis.GetVals())

privateKey, err := cryptoPocket.NewPrivateKey(consensusCfg.GetPrivateKey())
privateKey, err := cryptoPocket.NewPrivateKey(consensusCfg.PrivateKey)
if err != nil {
return nil, err
}
Expand All @@ -155,7 +152,7 @@ func (*consensusModule) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, e
bus: nil,

privateKey: privateKey.(cryptoPocket.Ed25519PrivateKey),
consCfg: cfg.GetConsensusConfig(),
consCfg: consensusCfg,
consGenesis: genesis.GetConsensusGenesisState(),

height: 0,
Expand Down Expand Up @@ -233,11 +230,6 @@ func (m *consensusModule) SetBus(pocketBus modules.Bus) {
m.leaderElectionMod.SetBus(pocketBus)
}

func (*consensusModule) ValidateConfig(cfg modules.Config) error {
// TODO (#334): implement this
return nil
}

func (*consensusModule) ValidateGenesis(genesis modules.GenesisState) error {
// Sort the validators by their generic param (i.e. service URL)
vals := genesis.GetConsensusGenesisState().GetVals()
Expand All @@ -264,7 +256,7 @@ func (*consensusModule) ValidateGenesis(genesis modules.GenesisState) error {
}

func (m *consensusModule) GetPrivateKey() (cryptoPocket.PrivateKey, error) {
return cryptoPocket.NewPrivateKey(m.consCfg.GetPrivateKey())
return cryptoPocket.NewPrivateKey(m.consCfg.PrivateKey)
}

func (m *consensusModule) HandleMessage(message *anypb.Any) error {
Expand Down Expand Up @@ -327,9 +319,3 @@ func (m *consensusModule) loadPersistedState() error {

return nil
}

// HasPacemakerConfig is used to determine if a ConsensusConfig includes a PacemakerConfig without having to cast to the struct
// (which would break mocks and/or pollute the codebase with mock types casts and checks)
type HasPacemakerConfig interface {
GetPacemakerConfig() *typesCons.PacemakerConfig
}
28 changes: 8 additions & 20 deletions consensus/pacemaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package consensus

import (
"context"
"fmt"
"log"
timePkg "time"

consensusTelemetry "github.com/pokt-network/pocket/consensus/telemetry"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/runtime/configs"
"github.com/pokt-network/pocket/shared/modules"
)

Expand All @@ -31,10 +31,8 @@ type Pacemaker interface {
}

var (
_ modules.Module = &paceMaker{}
_ modules.ConfigurableModule = &paceMaker{}
_ PacemakerDebug = &paceMaker{}
_ modules.PacemakerConfig = &typesCons.PacemakerConfig{}
_ modules.Module = &paceMaker{}
_ PacemakerDebug = &paceMaker{}
)

type paceMaker struct {
Expand All @@ -46,7 +44,7 @@ type paceMaker struct {
// a great idea in production code.
consensusMod *consensusModule

pacemakerCfg modules.PacemakerConfig
pacemakerCfg *configs.PacemakerConfig

stepCancelFunc context.CancelFunc

Expand All @@ -61,11 +59,8 @@ func CreatePacemaker(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {

func (m *paceMaker) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {
cfg := runtimeMgr.GetConfig()
if err := m.ValidateConfig(cfg); err != nil {
log.Fatalf("config validation failed: %v", err)
}

pacemakerCfg := cfg.GetConsensusConfig().(HasPacemakerConfig).GetPacemakerConfig()
pacemakerCfg := cfg.Consensus.PacemakerConfig

return &paceMaker{
bus: nil,
Expand All @@ -76,8 +71,8 @@ func (m *paceMaker) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error
stepCancelFunc: nil, // Only set on restarts

paceMakerDebug: paceMakerDebug{
manualMode: pacemakerCfg.GetManual(),
debugTimeBetweenStepsMsec: pacemakerCfg.GetDebugTimeBetweenStepsMsec(),
manualMode: pacemakerCfg.Manual,
debugTimeBetweenStepsMsec: pacemakerCfg.DebugTimeBetweenStepsMsec,
quorumCertificate: nil,
},
}, nil
Expand Down Expand Up @@ -106,13 +101,6 @@ func (m *paceMaker) GetBus() modules.Bus {
return m.bus
}

func (*paceMaker) ValidateConfig(cfg modules.Config) error {
if _, ok := cfg.GetConsensusConfig().(HasPacemakerConfig); !ok {
return fmt.Errorf("cannot cast to PacemakeredConsensus")
}
return nil
}

func (m *paceMaker) SetConsensusModule(c *consensusModule) {
m.consensusMod = c
}
Expand Down Expand Up @@ -259,6 +247,6 @@ func (p *paceMaker) startNextView(qc *typesCons.QuorumCertificate, forceNextView

// TODO(olshansky): Increase timeout using exponential backoff.
func (p *paceMaker) getStepTimeout(round uint64) timePkg.Duration {
baseTimeout := timePkg.Duration(int64(timePkg.Millisecond) * int64(p.pacemakerCfg.GetTimeoutMsec()))
baseTimeout := timePkg.Duration(int64(timePkg.Millisecond) * int64(p.pacemakerCfg.TimeoutMsec))
return baseTimeout
}
4 changes: 0 additions & 4 deletions consensus/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ func GetValAddrToIdMap(validatorMap ValidatorMap) (ValAddrToIdMap, IdToValAddrMa
return valToIdMap, idToValMap
}

func (x *PacemakerConfig) SetTimeoutMsec(u uint64) {
x.TimeoutMsec = u
}

func ValidatorMapToModulesValidatorMap(validatorMap ValidatorMap) (vm modules.ValidatorMap) {
vm = make(modules.ValidatorMap)
for _, v := range validatorMap {
Expand Down
33 changes: 17 additions & 16 deletions logger/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"os"
"strings"

"github.com/pokt-network/pocket/runtime/configs"
"github.com/pokt-network/pocket/shared/modules"
"github.com/rs/zerolog"
)

type loggerModule struct {
bus modules.Bus
logger modules.Logger
config modules.LoggerConfig
config *configs.LoggerConfig
}

// All loggers branch out of mainLogger, that way configuration changes to mainLogger propagate to others.
Expand All @@ -28,19 +29,19 @@ const (
ModuleName = "logger"
)

var pocketLogLevelToZeroLog = map[LogLevel]zerolog.Level{
LogLevel_LOG_LEVEL_UNSPECIFIED: zerolog.NoLevel,
LogLevel_LOG_LEVEL_DEBUG: zerolog.DebugLevel,
LogLevel_LOG_LEVEL_INFO: zerolog.InfoLevel,
LogLevel_LOG_LEVEL_WARN: zerolog.WarnLevel,
LogLevel_LOG_LEVEL_ERROR: zerolog.ErrorLevel,
LogLevel_LOG_LEVEL_FATAL: zerolog.FatalLevel,
LogLevel_LOG_LEVEL_PANIC: zerolog.PanicLevel,
var pocketLogLevelToZeroLog = map[configs.LogLevel]zerolog.Level{
configs.LogLevel_LOG_LEVEL_UNSPECIFIED: zerolog.NoLevel,
configs.LogLevel_LOG_LEVEL_DEBUG: zerolog.DebugLevel,
configs.LogLevel_LOG_LEVEL_INFO: zerolog.InfoLevel,
configs.LogLevel_LOG_LEVEL_WARN: zerolog.WarnLevel,
configs.LogLevel_LOG_LEVEL_ERROR: zerolog.ErrorLevel,
configs.LogLevel_LOG_LEVEL_FATAL: zerolog.FatalLevel,
configs.LogLevel_LOG_LEVEL_PANIC: zerolog.PanicLevel,
}

var pocketLogFormatToEnum = map[string]LogFormat{
"json": LogFormat_LOG_FORMAT_JSON,
"pretty": LogFormat_LOG_FORMAT_PRETTY,
var pocketLogFormatToEnum = map[string]configs.LogFormat{
"json": configs.LogFormat_LOG_FORMAT_JSON,
"pretty": configs.LogFormat_LOG_FORMAT_PRETTY,
}

func Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {
Expand All @@ -54,19 +55,19 @@ func (*loggerModule) CreateLoggerForModule(moduleName string) modules.Logger {
func (*loggerModule) Create(runtimeMgr modules.RuntimeMgr) (modules.Module, error) {
cfg := runtimeMgr.GetConfig()
m := loggerModule{
config: cfg.GetLoggerConfig(),
config: cfg.Logger,
}

m.InitLogger()

// Mapping config string value to the proto enum
if pocketLogLevel, ok := LogLevel_value[`LogLevel_LOG_LEVEL_`+strings.ToUpper(m.config.GetLevel())]; ok {
zerolog.SetGlobalLevel(pocketLogLevelToZeroLog[LogLevel(pocketLogLevel)])
if pocketLogLevel, ok := configs.LogLevel_value[`LogLevel_LOG_LEVEL_`+strings.ToUpper(m.config.Level)]; ok {
zerolog.SetGlobalLevel(pocketLogLevelToZeroLog[configs.LogLevel(pocketLogLevel)])
} else {
zerolog.SetGlobalLevel(zerolog.NoLevel)
}

if pocketLogFormatToEnum[m.config.GetFormat()] == LogFormat_LOG_FORMAT_PRETTY {
if pocketLogFormatToEnum[m.config.Format] == configs.LogFormat_LOG_FORMAT_PRETTY {
mainLogger = mainLogger.Output(zerolog.ConsoleWriter{Out: os.Stderr})
mainLogger.Info().Msg("using pretty log format")
}
Expand Down
5 changes: 3 additions & 2 deletions p2p/addrbook_provider/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/pokt-network/pocket/p2p/transport"
typesP2P "github.com/pokt-network/pocket/p2p/types"
"github.com/pokt-network/pocket/runtime/configs"
cryptoPocket "github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/shared/modules"
)
Expand All @@ -15,11 +16,11 @@ var _ typesP2P.AddrBookProvider = &persistenceAddrBookProvider{}

type persistenceAddrBookProvider struct {
bus modules.Bus
p2pCfg modules.P2PConfig
p2pCfg *configs.P2PConfig
connFactory typesP2P.ConnectionFactory
}

func NewPersistenceAddrBookProvider(bus modules.Bus, p2pCfg modules.P2PConfig, options ...func(*persistenceAddrBookProvider)) *persistenceAddrBookProvider {
func NewPersistenceAddrBookProvider(bus modules.Bus, p2pCfg *configs.P2PConfig, options ...func(*persistenceAddrBookProvider)) *persistenceAddrBookProvider {
pabp := &persistenceAddrBookProvider{
bus: bus,
p2pCfg: p2pCfg,
Expand Down
Loading