-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* don't pass genesisBytes as arg on SetNode, NewVochain, newTendermint, etc * notably, now cometbft has it's own datadir separate from our state, allowing to wipe cometbft data without wiping our state. * drop genesis.AutoUpdateGenesis * instead of comparing local and hardcoded genesis Hash, compare ChainID to decide wether to wipe out just cometbft, whole datadir, or do nothing * cmd/node: add flags to override genesis ChainID, InitialHeight and AppHash * cmd/node: add flag to schedule an EndOfChain * move SeedNodes from genesis into config package (DefaultSeedNodes) * add config consts: DefaultCometBFTPath and DefaultGenesisPath * testsuite: use genesis.go instead of hardcoded genesis.json this increases the code coverage of testsuite and helps developing refactors of genesis.go * now testsuite network is `test` (instead of `dev`) * app.genesisDoc is now populated during newTendermint, instead of pulling from app.NodeClient.Genesis, since it's needed during Info() handshake * cometbft: removed redundant app.State.SetHeight(lastHeight) during Info() * cometbft: now Info() supports doing a chain bump, if genesis InitialHeight > lastHeight * cometbft: now ProcessProposal supports stopping the current chain at height config.Forks.EndOfChain * genesis: remove copypasted types, use upstream comettypes directly * genesis: deduplicate ConsensusParams literals using DefaultBlockParams, etc * genesis: remove useless hardcoded StateSyncParams * genesis: add a simple unit test TestSaveAsAndLoad
- Loading branch information
Showing
25 changed files
with
611 additions
and
576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,29 @@ package config | |
// These consts are defaults used in VochainCfg | ||
const ( | ||
DefaultMinerTargetBlockTimeSeconds = 10 | ||
DefaultCometBFTPath = "cometbft" | ||
DefaultGenesisPath = DefaultCometBFTPath + "/config/genesis.json" | ||
) | ||
|
||
// DefaultSeedNodes is a map indexed by network name | ||
var DefaultSeedNodes = map[string][]string{ | ||
// testsuite test network | ||
"test": { | ||
"3c3765494e758ae7baccb1f5b0661755302ddc47@seed:26656", | ||
}, | ||
// Development network | ||
"dev": { | ||
"[email protected]:26656", | ||
}, | ||
|
||
// Staging network | ||
"stage": { | ||
"[email protected]:26656", | ||
}, | ||
|
||
// LTS production network | ||
"lts": { | ||
"[email protected]:26656", | ||
"[email protected]:26656", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,50 @@ | ||
package config | ||
|
||
import ( | ||
"sync" | ||
) | ||
|
||
// ForksCfg allows applying softforks at specified heights | ||
type ForksCfg struct { | ||
VoceremonyForkBlock uint32 | ||
NullifierFromZkProof uint32 | ||
EndOfChain uint32 | ||
} | ||
|
||
// Forks is a map of chainIDs | ||
var Forks = map[string]*ForksCfg{ | ||
"vocdoni/DEV/29": { | ||
VoceremonyForkBlock: 217200, // estimated 2023-12-05T11:33:31.426638381Z | ||
}, | ||
"vocdoni/STAGE/9": { | ||
VoceremonyForkBlock: 250000, // estimated 2023-12-11T12:09:00.917676214Z | ||
NullifierFromZkProof: 439000, // estimated 2024-01-03T12:09:30.009477164Z | ||
}, | ||
"vocdoni/LTS/1.2": { | ||
VoceremonyForkBlock: 400200, // estimated 2023-12-12T09:09:31.511245938Z | ||
NullifierFromZkProof: 575800, // estimated 2024-01-03T12:09:30.009477164Z | ||
}, | ||
} | ||
var ( | ||
mu sync.RWMutex | ||
// forks is a map of chainIDs to their respective ForksCfg | ||
forks = map[string]*ForksCfg{ | ||
"vocdoni/TEST/1.2": { | ||
EndOfChain: 100, | ||
}, | ||
"vocdoni/DEV/29": { | ||
VoceremonyForkBlock: 217200, // estimated 2023-12-05T11:33:31.426638381Z | ||
}, | ||
"vocdoni/STAGE/9": { | ||
VoceremonyForkBlock: 250000, // estimated 2023-12-11T12:09:00.917676214Z | ||
NullifierFromZkProof: 439000, // estimated 2024-01-03T12:09:30.009477164Z | ||
}, | ||
"vocdoni/LTS/1.2": { | ||
VoceremonyForkBlock: 400200, // estimated 2023-12-12T09:09:31.511245938Z | ||
NullifierFromZkProof: 575800, // estimated 2024-01-03T12:09:30.009477164Z | ||
}, | ||
} | ||
) | ||
|
||
// ForksForChainID returns the ForksCfg of chainID, if found, or an empty ForksCfg otherwise | ||
func ForksForChainID(chainID string) *ForksCfg { | ||
if cfg, found := Forks[chainID]; found { | ||
mu.RLock() | ||
defer mu.RUnlock() | ||
if cfg, found := forks[chainID]; found { | ||
return cfg | ||
} | ||
return &ForksCfg{} | ||
} | ||
|
||
// SetForksForChainID sets the ForksCfg of chainID | ||
func SetForksForChainID(chainID string, forksCfg *ForksCfg) { | ||
mu.Lock() | ||
defer mu.Unlock() | ||
forks[chainID] = forksCfg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.