Skip to content

Commit

Permalink
fix: fixing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre committed Jul 29, 2023
1 parent 387983c commit 4332456
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 28 deletions.
2 changes: 0 additions & 2 deletions committee/committee.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ func (c *committee) Update(lastRound int16, joined []*validator.Validator) {
} else {
committeeVal.UpdateLastSortitionHeight(val.LastSortitionHeight())

// TODO: PRoofread the comments here
//
// Ensure that a validator's stake and bonding properties
// remain unchanged while they are part of the committee.
// Refer to the Bond executor for additional details.
Expand Down
2 changes: 1 addition & 1 deletion execution/executor/sortition.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (e *SortitionExecutor) Execute(trx *tx.Tx, sb sandbox.Sandbox) error {
return errors.Errorf(errors.ErrInvalidSequence,
"expected: %v, got: %v", val.Sequence()+1, trx.Sequence())
}
// Check for the duplicated sortition transactions
// Check for the duplicated or expired sortition transactions
if sortitionHeight <= val.LastSortitionHeight() {
return errors.Errorf(errors.ErrInvalidTx,
"duplicated sortition transaction")
Expand Down
2 changes: 0 additions & 2 deletions types/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ func (acc *Account) AddToBalance(amt int64) {
acc.data.Balance += amt
}

// IncSequence increments the account's sequence every time it signs a transaction.
// IncSequence increases the sequence anytime this account signs a transaction.
func (acc *Account) IncSequence() {
acc.data.Sequence++
}

// Hash returns the hash of this account.
// Hash calculates and returns the hash of the account.
func (acc *Account) Hash() hash.Hash {
bs, err := acc.Bytes()
Expand Down
10 changes: 1 addition & 9 deletions www/http/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ func (s *Server) BlockchainHandler(w http.ResponseWriter, _ *http.Request) {
tm.addRowAmount("Committee Power", res.CommitteePower)
for i, val := range res.CommitteeValidators {
tm.addRowInt("--- Validator", i+1)
tm.addRowString("Public Key", val.PublicKey)
tm.addRowValAddress("Address", val.Address)
tm.addRowInt("Number", int(val.Number))
tm.addRowInt("Sequence", int(val.Sequence))
tm.addRowAmount("Stake", val.Stake)
tm.addRowInt("LastBondingHeight", int(val.LastBondingHeight))
tm.addRowInt("LastSortitionHeight", int(val.LastSortitionHeight))
tm.addRowInt("UnbondingHeight", int(val.UnbondingHeight))
tm.addRowBytes("Hash", val.Hash)
s.writeValidatorTable(w, val)
}

s.writeHTML(w, tm.html())
Expand Down
19 changes: 5 additions & 14 deletions www/http/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,7 @@ func (s *Server) GetValidatorHandler(w http.ResponseWriter, r *http.Request) {
return
}

val := res.Validator
tm := newTableMaker()
tm.addRowString("Public Key", val.PublicKey)
tm.addRowValAddress("Address", val.Address)
tm.addRowInt("Number", int(val.Number))
tm.addRowInt("Sequence", int(val.Sequence))
tm.addRowAmount("Stake", val.Stake)
tm.addRowInt("LastBondingHeight", int(val.LastBondingHeight))
tm.addRowInt("LastSortitionHeight", int(val.LastSortitionHeight))
tm.addRowInt("UnbondingHeight", int(val.UnbondingHeight))
tm.addRowBytes("Hash", val.Hash)

s.writeHTML(w, tm.html())
s.writeValidatorTable(w, res.Validator)
}

// GetValidatorByNumberHandler returns a handler to get validator by number.
Expand All @@ -51,7 +39,10 @@ func (s *Server) GetValidatorByNumberHandler(w http.ResponseWriter, r *http.Requ
return
}

val := res.Validator
s.writeValidatorTable(w, res.Validator)
}

func (s *Server) writeValidatorTable(w http.ResponseWriter, val *pactus.ValidatorInfo) {
tm := newTableMaker()
tm.addRowString("Public Key", val.PublicKey)
tm.addRowValAddress("Address", val.Address)
Expand Down

0 comments on commit 4332456

Please sign in to comment.