Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vochain: correctly SetChainID during newTendermint #1151

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cmd/voconed/voconed.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
vc.SetChainID(config.chainID)
vc.App.SetChainID(config.chainID)
log.Infof("using chainID: %s", config.chainID)

// set treasurer address if provided
Expand Down
4 changes: 2 additions & 2 deletions vochain/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var Genesis = map[string]Vochain{
}

var devGenesis = Doc{
GenesisTime: time.Date(2023, time.October, 10, 1, 0, 0, 0, time.UTC),
ChainID: "vocdoni-dev-24",
GenesisTime: time.Date(2023, time.October, 17, 1, 0, 0, 0, time.UTC),
ChainID: "vocdoni-dev-25",
ConsensusParams: &ConsensusParams{
Block: BlockParams{
MaxBytes: 2097152,
Expand Down
5 changes: 3 additions & 2 deletions vochain/processid/process_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ func (p *ProcessID) String() string {

}

// SetChainID sets the blockchain identifier
// SetChainID sets the process blockchain identifier
func (p *ProcessID) SetChainID(chID string) {
p.chainID = chID
}

// ChainID returns blockchain identifier
// ChainID returns the process blockchain identifier
func (p *ProcessID) ChainID() string {
return p.chainID
}
Expand Down Expand Up @@ -181,6 +181,7 @@ func (p *ProcessID) EnvelopeType() *models.EnvelopeType {
}
}

// BuildProcessID returns a ProcessID constructed in a deterministic way
func BuildProcessID(proc *models.Process, state *state.State) (*ProcessID, error) {
pid := new(ProcessID)
pid.SetChainID(state.ChainID())
Expand Down
2 changes: 1 addition & 1 deletion vochain/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func newTendermint(app *BaseApplication,
return nil, fmt.Errorf("cannot unmarshal genesis file for fetching chainID")
}
log.Infow("genesis file", "genesis", tconfig.GenesisFile(), "chainID", genesisCID.ChainID)
app.chainID = genesisCID.ChainID
app.SetChainID(genesisCID.ChainID)

// assign the default tendermint methods
app.SetDefaultMethods()
Expand Down
4 changes: 2 additions & 2 deletions vochain/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ func (v *State) EventListeners() []EventListener {
return v.eventListeners
}

// SetChainID sets the blockchain identifier.
// SetChainID sets the state chainID (blockchain identifier)
func (v *State) SetChainID(chID string) {
v.chainID = chID
}

// ChainID gets the blockchain identifier.
// ChainID gets the state chainID (blockchain identifier)
func (v *State) ChainID() string {
return v.chainID
}
Expand Down
5 changes: 0 additions & 5 deletions vocone/vocone.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,6 @@ func vochainPrintInfo(sleepSecs int64, vi *vochaininfo.VochainInfo) {
}
}

// SetChainID sets the chainID for the vocone instance
func (vc *Vocone) SetChainID(chainID string) {
vc.App.SetChainID(chainID)
}

func defaultTxCosts() genesis.TransactionCosts {
return genesis.TransactionCosts{
SetProcessStatus: 1,
Expand Down