Skip to content

Commit

Permalink
Merge pull request #2766 from oasislabs/ptrus/feature/txsource-delega…
Browse files Browse the repository at this point in the history
…tion-commission

go/txsource: commission schedule amendments workload
  • Loading branch information
ptrus authored Mar 24, 2020
2 parents ea2c74d + f0da05c commit 57b86bb
Show file tree
Hide file tree
Showing 10 changed files with 466 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/2766.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go/txsource: add a commission schedule amendments workload

The added workload generated commission schedule amendment requests.
5 changes: 5 additions & 0 deletions go/consensus/tendermint/apps/staking/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Query interface {
Delegations(context.Context, signature.PublicKey) (map[signature.PublicKey]*staking.Delegation, error)
DebondingDelegations(context.Context, signature.PublicKey) (map[signature.PublicKey][]*staking.DebondingDelegation, error)
Genesis(context.Context) (*staking.Genesis, error)
ConsensusParameters(context.Context) (*staking.ConsensusParameters, error)
}

// QueryFactory is the staking query factory.
Expand Down Expand Up @@ -105,6 +106,10 @@ func (sq *stakingQuerier) DebondingDelegations(ctx context.Context, id signature
return sq.state.DebondingDelegationsFor(id)
}

func (sq *stakingQuerier) ConsensusParameters(ctx context.Context) (*staking.ConsensusParameters, error) {
return sq.state.ConsensusParameters()
}

func (app *stakingApplication) QueryFactory() interface{} {
return &QueryFactory{app}
}
8 changes: 8 additions & 0 deletions go/consensus/tendermint/staking/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ func (tb *tendermintBackend) StateToGenesis(ctx context.Context, height int64) (
return q.Genesis(ctx)
}

func (tb *tendermintBackend) ConsensusParameters(ctx context.Context, height int64) (*api.ConsensusParameters, error) {
q, err := tb.querier.QueryAt(ctx, height)
if err != nil {
return nil, err
}

return q.ConsensusParameters(ctx)
}
func (tb *tendermintBackend) Cleanup() {
<-tb.closedCh
}
Expand Down
Loading

0 comments on commit 57b86bb

Please sign in to comment.