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

validator update_time is valid but incorrect #3411

Closed
4 tasks
jbibla opened this issue Jan 28, 2019 · 5 comments · Fixed by #3706
Closed
4 tasks

validator update_time is valid but incorrect #3411

jbibla opened this issue Jan 28, 2019 · 5 comments · Fixed by #3706

Comments

@jbibla
Copy link
Contributor

jbibla commented Jan 28, 2019

Summary of Bug

when you start a network with one validator the commission update_time will default to a date that is technically Jan. 1, year 1. this is a valid but incorrect date.

alternatively, it might be best to use either the "datetime" when the validator joins the network and establishes the expected commission data for the first time, or null.

Steps to Reproduce

  1. follow steps here: https://cosmos.network/docs/gaia/deploy-testnet.html#single-node-local-manual-testnet
  2. gaiacli query staking validator <address> --trust-node
  3. returns commission.updateTime: 0001-01-01 00:00:00

thank you all!


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

alexanderbez commented Jan 28, 2019

Hmmm, I think this pertains to the way the validator was created. When a validator is created via a MsgCreateValidator either via REST or CLI, the commission time initiates with the block header BFT time:

https://github.com/cosmos/cosmos-sdk/blob/v0.30.0/x/staking/handler.go#L124-L132

	validator := NewValidator(msg.ValidatorAddr, msg.PubKey, msg.Description)
	commission := NewCommissionWithTime(
		msg.Commission.Rate, msg.Commission.MaxRate,
		msg.Commission.MaxChangeRate, ctx.BlockHeader().Time,
	)
	validator, err := validator.SetInitialCommission(commission)
	if err != nil {
		return err.Result()
	}

So this must only pertain to a local testnet?

@cwgoes
Copy link
Contributor

cwgoes commented Jan 28, 2019

There's no other conceivable time we could use.

The time being incorrect on a local testnet could be a bug in how the initial BFT time is set, but that should be filed in the Tendermint repository, not here.

@jackzampolin
Copy link
Member

jackzampolin commented Jan 28, 2019

Closing, please open an issue on Tendermint

@alexanderbez
Copy link
Contributor

alexanderbez commented Feb 21, 2019

Reopening this issue as it is indeed an SDK issue, namely:

// InitChain implements the ABCI interface. It runs the initialization logic
// directly on the CommitMultiStore.
func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain) {
        // ...

	// initialize the deliver state and check state with ChainID and run initChain
	app.setDeliverState(abci.Header{ChainID: req.ChainId})
	app.setCheckState(abci.Header{ChainID: req.ChainId})

        // ...
}

Where we pass the header, there is no time. I suppose this should be the genesis time for block 0.

@cwgoes
Copy link
Contributor

cwgoes commented Feb 22, 2019

Where we pass the header, there is no time. I suppose this should be the genesis time for block 0.

Ah indeed, my mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants