Skip to content

Commit 2d46761

Browse files
committed
add proposor
1 parent 73d7c8b commit 2d46761

File tree

13 files changed

+58
-32
lines changed

13 files changed

+58
-32
lines changed

app/app.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ func (app *QOSApp) GasHandler(ctx context.Context, payer btypes.AccAddress) (gas
307307
gasFeeUsed := btypes.NewInt(int64(gasUsed) / perGas)
308308
gasUsed = gasUsed / uint64(perGas) * uint64(perGas)
309309

310-
311310
if gasFeeUsed.GT(btypes.ZeroInt()) {
312311
accountMapper := ctx.Mapper(account.AccountMapperName).(*account.AccountMapper)
313312
account := accountMapper.GetAccount(payer).(*types.QOSAccount)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module github.com/QOSGroup/qos
44

55
require (
66
github.com/QOSGroup/kepler v0.6.0
7-
github.com/QOSGroup/qbase v0.2.4
7+
github.com/QOSGroup/qbase v0.2.5
88
github.com/go-kit/kit v0.9.0
99
github.com/gorilla/mux v1.7.3
1010
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect

module/bank/client/cmd.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package client
22

33
import (
44
bctypes "github.com/QOSGroup/qbase/client/types"
5+
"github.com/QOSGroup/qos/module/bank/txs"
56
"github.com/spf13/cobra"
67
"github.com/tendermint/go-amino"
78
)
@@ -13,5 +14,8 @@ func QueryCommands(cdc *amino.Codec) []*cobra.Command {
1314
}
1415

1516
func TxCommands(cdc *amino.Codec) []*cobra.Command {
16-
return bctypes.PostCommands(TransferCmd(cdc), InvariantCheckCmd(cdc))
17+
return bctypes.PostCustomMaxGasCommands([]*cobra.Command{TransferCmd(cdc), InvariantCheckCmd(cdc)}, []int64{
18+
txs.GasForTransfer + bctypes.DefaultMaxGas,
19+
txs.GasForInvariantCheck + bctypes.DefaultMaxGas,
20+
})
1721
}

module/gov/client/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func getProposal(cliContext context.CLIContext, pid int64) (result types.Proposa
4747
res, err := cliContext.Query(path, []byte{})
4848

4949
if err != nil {
50-
return types.Proposal{}, nil
50+
return types.Proposal{}, err
5151
}
5252

5353
if len(res) == 0 {

module/gov/types/proposal.go

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type ProposalContent interface {
3333
GetDeposit() btypes.BigInt
3434
GetProposalType() ProposalType
3535
GetProposalLevel() ProposalLevel
36+
GetProposer() btypes.AccAddress
3637
}
3738

3839
type ProposalResult string
@@ -282,6 +283,7 @@ func (tp TextProposal) GetDescription() string { return tp.Description
282283
func (tp TextProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
283284
func (tp TextProposal) GetProposalType() ProposalType { return ProposalTypeText }
284285
func (tp TextProposal) GetProposalLevel() ProposalLevel { return tp.GetProposalType().Level() }
286+
func (tp TextProposal) GetProposer() btypes.AccAddress { return tp.Proposer }
285287

286288
// TaxUsage Proposal
287289
type TaxUsageProposal struct {
@@ -307,10 +309,11 @@ func NewTaxUsageProposal(proposer btypes.AccAddress, title, description string,
307309
var _ ProposalContent = TaxUsageProposal{}
308310

309311
// nolint
310-
func (tp TaxUsageProposal) GetTitle() string { return tp.Title }
311-
func (tp TaxUsageProposal) GetDescription() string { return tp.Description }
312-
func (tp TaxUsageProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
313-
func (tp TaxUsageProposal) GetProposalType() ProposalType { return ProposalTypeTaxUsage }
312+
func (tp TaxUsageProposal) GetTitle() string { return tp.Title }
313+
func (tp TaxUsageProposal) GetDescription() string { return tp.Description }
314+
func (tp TaxUsageProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
315+
func (tp TaxUsageProposal) GetProposalType() ProposalType { return ProposalTypeTaxUsage }
316+
func (tp TaxUsageProposal) GetProposer() btypes.AccAddress { return tp.Proposer }
314317

315318
// Parameters change Proposal
316319
type ParameterProposal struct {
@@ -334,10 +337,11 @@ func NewParameterProposal(proposer btypes.AccAddress, title, description string,
334337
var _ ProposalContent = ParameterProposal{}
335338

336339
// nolint
337-
func (tp ParameterProposal) GetTitle() string { return tp.Title }
338-
func (tp ParameterProposal) GetDescription() string { return tp.Description }
339-
func (tp ParameterProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
340-
func (tp ParameterProposal) GetProposalType() ProposalType { return ProposalTypeParameterChange }
340+
func (tp ParameterProposal) GetTitle() string { return tp.Title }
341+
func (tp ParameterProposal) GetDescription() string { return tp.Description }
342+
func (tp ParameterProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
343+
func (tp ParameterProposal) GetProposalType() ProposalType { return ProposalTypeParameterChange }
344+
func (tp ParameterProposal) GetProposer() btypes.AccAddress { return tp.Proposer }
341345

342346
// Modify Inflation Phrases Proposal
343347
type ModifyInflationProposal struct {
@@ -363,10 +367,11 @@ func NewAddInflationPhrase(proposer btypes.AccAddress, title, description string
363367
var _ ProposalContent = ModifyInflationProposal{}
364368

365369
// nolint
366-
func (tp ModifyInflationProposal) GetTitle() string { return tp.Title }
367-
func (tp ModifyInflationProposal) GetDescription() string { return tp.Description }
368-
func (tp ModifyInflationProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
369-
func (tp ModifyInflationProposal) GetProposalType() ProposalType { return ProposalTypeModifyInflation }
370+
func (tp ModifyInflationProposal) GetTitle() string { return tp.Title }
371+
func (tp ModifyInflationProposal) GetDescription() string { return tp.Description }
372+
func (tp ModifyInflationProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
373+
func (tp ModifyInflationProposal) GetProposalType() ProposalType { return ProposalTypeModifyInflation }
374+
func (tp ModifyInflationProposal) GetProposer() btypes.AccAddress { return tp.Proposer }
370375

371376
type Param struct {
372377
Module string `json:"module"`
@@ -420,7 +425,8 @@ func NewSoftwareUpgradeProposal(proposer btypes.AccAddress, title, description s
420425
var _ ProposalContent = SoftwareUpgradeProposal{}
421426

422427
// nolint
423-
func (tp SoftwareUpgradeProposal) GetTitle() string { return tp.Title }
424-
func (tp SoftwareUpgradeProposal) GetDescription() string { return tp.Description }
425-
func (tp SoftwareUpgradeProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
426-
func (tp SoftwareUpgradeProposal) GetProposalType() ProposalType { return ProposalTypeSoftwareUpgrade }
428+
func (tp SoftwareUpgradeProposal) GetTitle() string { return tp.Title }
429+
func (tp SoftwareUpgradeProposal) GetDescription() string { return tp.Description }
430+
func (tp SoftwareUpgradeProposal) GetDeposit() btypes.BigInt { return tp.Deposit }
431+
func (tp SoftwareUpgradeProposal) GetProposalType() ProposalType { return ProposalTypeSoftwareUpgrade }
432+
func (tp SoftwareUpgradeProposal) GetProposer() btypes.AccAddress { return tp.Proposer }

module/params/mapper/mapper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ type Mapper struct {
2424
paramSets map[string]qtypes.ParamSet
2525

2626
Metrics *Metrics
27-
2827
}
2928

3029
func (mapper *Mapper) Copy() mapper.IMapper {

module/qcp/client/cmd.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ package client
22

33
import (
44
bctypes "github.com/QOSGroup/qbase/client/types"
5+
"github.com/QOSGroup/qos/module/qcp/txs"
56
"github.com/spf13/cobra"
67
"github.com/tendermint/go-amino"
78
)
89

910
func TxCommands(cdc *amino.Codec) []*cobra.Command {
10-
return bctypes.PostCommands(
11+
return bctypes.PostCustomMaxGasCommands([]*cobra.Command{
1112
InitQCPCmd(cdc),
12-
)
13+
}, []int64{
14+
txs.GasForCreateQCP + bctypes.DefaultMaxGas,
15+
})
1316
}
1417

1518
func QueryCommands(cdc *amino.Codec) []*cobra.Command {

module/qsc/client/cmd.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package client
22

33
import (
44
bctypes "github.com/QOSGroup/qbase/client/types"
5+
"github.com/QOSGroup/qos/module/qsc/txs"
56
"github.com/spf13/cobra"
67
"github.com/tendermint/go-amino"
78
)
@@ -14,8 +15,12 @@ func QueryCommands(cdc *amino.Codec) []*cobra.Command {
1415
}
1516

1617
func TxCommands(cdc *amino.Codec) []*cobra.Command {
17-
return bctypes.PostCommands(
18+
return bctypes.PostCustomMaxGasCommands([]*cobra.Command{
1819
CreateQSCCmd(cdc),
1920
IssueQSCCmd(cdc),
20-
)
21+
}, []int64{
22+
txs.GasForCreateQSC + bctypes.DefaultMaxGas,
23+
txs.GasForIssueQSC + bctypes.DefaultMaxGas,
24+
})
25+
2126
}

module/stake/client/cmd.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package client
22

33
import (
44
bctypes "github.com/QOSGroup/qbase/client/types"
5+
"github.com/QOSGroup/qos/module/stake/txs"
56
"github.com/spf13/cobra"
67
"github.com/tendermint/go-amino"
78
)
89

910
func TxCommands(cdc *amino.Codec) []*cobra.Command {
10-
return bctypes.PostCommands(
11+
return bctypes.PostCustomMaxGasCommands([]*cobra.Command{
1112
CreateValidatorCmd(cdc),
1213
ModifyValidatorCmd(cdc),
1314
RevokeValidatorCmd(cdc),
@@ -17,7 +18,18 @@ func TxCommands(cdc *amino.Codec) []*cobra.Command {
1718
CreateModifyCompoundCommand(cdc),
1819
CreateUnbondDelegationCommand(cdc),
1920
CreateReDelegationCommand(cdc),
20-
)
21+
}, []int64{
22+
txs.GasForCreateValidator + bctypes.DefaultMaxGas,
23+
txs.GasForModifyValidator + bctypes.DefaultMaxGas,
24+
txs.GasForRevokeValidator + bctypes.DefaultMaxGas,
25+
bctypes.DefaultMaxGas,
26+
bctypes.DefaultMaxGas,
27+
bctypes.DefaultMaxGas,
28+
bctypes.DefaultMaxGas,
29+
txs.GasForUnbond + bctypes.DefaultMaxGas,
30+
bctypes.DefaultMaxGas,
31+
})
32+
2133
}
2234

2335
func QueryCommands(cdc *amino.Codec) []*cobra.Command {

types/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const (
88
)
99

1010
var (
11-
UnitQOS = math.Pow(10, Decimal) // QOS unit
11+
UnitQOS = math.Pow(10, Decimal) // QOS unit
1212
DefaultTotalUnitQOSQuantity = int64(TotalQOSAmount * UnitQOS) // total QOS amount
1313

1414
DefaultBlockInterval = int64(5) // 5 seconds

0 commit comments

Comments
 (0)