From 2d46761e6749ccecbfcfdbe960e09878f7a76e23 Mon Sep 17 00:00:00 2001 From: wangzhiyong Date: Fri, 6 Dec 2019 14:06:34 +0800 Subject: [PATCH 1/2] add proposor --- app/app.go | 1 - go.mod | 2 +- module/bank/client/cmd.go | 6 +++++- module/gov/client/query.go | 2 +- module/gov/types/proposal.go | 38 ++++++++++++++++++++-------------- module/params/mapper/mapper.go | 1 - module/qcp/client/cmd.go | 7 +++++-- module/qsc/client/cmd.go | 9 ++++++-- module/stake/client/cmd.go | 16 ++++++++++++-- types/const.go | 2 +- types/mapper.go | 1 - types/param.go | 2 +- version/version.go | 3 +-- 13 files changed, 58 insertions(+), 32 deletions(-) diff --git a/app/app.go b/app/app.go index 2650ac56..d19e1ce1 100644 --- a/app/app.go +++ b/app/app.go @@ -307,7 +307,6 @@ func (app *QOSApp) GasHandler(ctx context.Context, payer btypes.AccAddress) (gas gasFeeUsed := btypes.NewInt(int64(gasUsed) / perGas) gasUsed = gasUsed / uint64(perGas) * uint64(perGas) - if gasFeeUsed.GT(btypes.ZeroInt()) { accountMapper := ctx.Mapper(account.AccountMapperName).(*account.AccountMapper) account := accountMapper.GetAccount(payer).(*types.QOSAccount) diff --git a/go.mod b/go.mod index e62ee9c1..5cc8317f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ module github.com/QOSGroup/qos require ( github.com/QOSGroup/kepler v0.6.0 - github.com/QOSGroup/qbase v0.2.4 + github.com/QOSGroup/qbase v0.2.5 github.com/go-kit/kit v0.9.0 github.com/gorilla/mux v1.7.3 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/module/bank/client/cmd.go b/module/bank/client/cmd.go index f7daf2e0..d83d4891 100644 --- a/module/bank/client/cmd.go +++ b/module/bank/client/cmd.go @@ -2,6 +2,7 @@ package client import ( bctypes "github.com/QOSGroup/qbase/client/types" + "github.com/QOSGroup/qos/module/bank/txs" "github.com/spf13/cobra" "github.com/tendermint/go-amino" ) @@ -13,5 +14,8 @@ func QueryCommands(cdc *amino.Codec) []*cobra.Command { } func TxCommands(cdc *amino.Codec) []*cobra.Command { - return bctypes.PostCommands(TransferCmd(cdc), InvariantCheckCmd(cdc)) + return bctypes.PostCustomMaxGasCommands([]*cobra.Command{TransferCmd(cdc), InvariantCheckCmd(cdc)}, []int64{ + txs.GasForTransfer + bctypes.DefaultMaxGas, + txs.GasForInvariantCheck + bctypes.DefaultMaxGas, + }) } diff --git a/module/gov/client/query.go b/module/gov/client/query.go index b86c077b..768864e6 100644 --- a/module/gov/client/query.go +++ b/module/gov/client/query.go @@ -47,7 +47,7 @@ func getProposal(cliContext context.CLIContext, pid int64) (result types.Proposa res, err := cliContext.Query(path, []byte{}) if err != nil { - return types.Proposal{}, nil + return types.Proposal{}, err } if len(res) == 0 { diff --git a/module/gov/types/proposal.go b/module/gov/types/proposal.go index 5d71a455..a7e6c5b6 100644 --- a/module/gov/types/proposal.go +++ b/module/gov/types/proposal.go @@ -33,6 +33,7 @@ type ProposalContent interface { GetDeposit() btypes.BigInt GetProposalType() ProposalType GetProposalLevel() ProposalLevel + GetProposer() btypes.AccAddress } type ProposalResult string @@ -282,6 +283,7 @@ func (tp TextProposal) GetDescription() string { return tp.Description func (tp TextProposal) GetDeposit() btypes.BigInt { return tp.Deposit } func (tp TextProposal) GetProposalType() ProposalType { return ProposalTypeText } func (tp TextProposal) GetProposalLevel() ProposalLevel { return tp.GetProposalType().Level() } +func (tp TextProposal) GetProposer() btypes.AccAddress { return tp.Proposer } // TaxUsage Proposal type TaxUsageProposal struct { @@ -307,10 +309,11 @@ func NewTaxUsageProposal(proposer btypes.AccAddress, title, description string, var _ ProposalContent = TaxUsageProposal{} // nolint -func (tp TaxUsageProposal) GetTitle() string { return tp.Title } -func (tp TaxUsageProposal) GetDescription() string { return tp.Description } -func (tp TaxUsageProposal) GetDeposit() btypes.BigInt { return tp.Deposit } -func (tp TaxUsageProposal) GetProposalType() ProposalType { return ProposalTypeTaxUsage } +func (tp TaxUsageProposal) GetTitle() string { return tp.Title } +func (tp TaxUsageProposal) GetDescription() string { return tp.Description } +func (tp TaxUsageProposal) GetDeposit() btypes.BigInt { return tp.Deposit } +func (tp TaxUsageProposal) GetProposalType() ProposalType { return ProposalTypeTaxUsage } +func (tp TaxUsageProposal) GetProposer() btypes.AccAddress { return tp.Proposer } // Parameters change Proposal type ParameterProposal struct { @@ -334,10 +337,11 @@ func NewParameterProposal(proposer btypes.AccAddress, title, description string, var _ ProposalContent = ParameterProposal{} // nolint -func (tp ParameterProposal) GetTitle() string { return tp.Title } -func (tp ParameterProposal) GetDescription() string { return tp.Description } -func (tp ParameterProposal) GetDeposit() btypes.BigInt { return tp.Deposit } -func (tp ParameterProposal) GetProposalType() ProposalType { return ProposalTypeParameterChange } +func (tp ParameterProposal) GetTitle() string { return tp.Title } +func (tp ParameterProposal) GetDescription() string { return tp.Description } +func (tp ParameterProposal) GetDeposit() btypes.BigInt { return tp.Deposit } +func (tp ParameterProposal) GetProposalType() ProposalType { return ProposalTypeParameterChange } +func (tp ParameterProposal) GetProposer() btypes.AccAddress { return tp.Proposer } // Modify Inflation Phrases Proposal type ModifyInflationProposal struct { @@ -363,10 +367,11 @@ func NewAddInflationPhrase(proposer btypes.AccAddress, title, description string var _ ProposalContent = ModifyInflationProposal{} // nolint -func (tp ModifyInflationProposal) GetTitle() string { return tp.Title } -func (tp ModifyInflationProposal) GetDescription() string { return tp.Description } -func (tp ModifyInflationProposal) GetDeposit() btypes.BigInt { return tp.Deposit } -func (tp ModifyInflationProposal) GetProposalType() ProposalType { return ProposalTypeModifyInflation } +func (tp ModifyInflationProposal) GetTitle() string { return tp.Title } +func (tp ModifyInflationProposal) GetDescription() string { return tp.Description } +func (tp ModifyInflationProposal) GetDeposit() btypes.BigInt { return tp.Deposit } +func (tp ModifyInflationProposal) GetProposalType() ProposalType { return ProposalTypeModifyInflation } +func (tp ModifyInflationProposal) GetProposer() btypes.AccAddress { return tp.Proposer } type Param struct { Module string `json:"module"` @@ -420,7 +425,8 @@ func NewSoftwareUpgradeProposal(proposer btypes.AccAddress, title, description s var _ ProposalContent = SoftwareUpgradeProposal{} // nolint -func (tp SoftwareUpgradeProposal) GetTitle() string { return tp.Title } -func (tp SoftwareUpgradeProposal) GetDescription() string { return tp.Description } -func (tp SoftwareUpgradeProposal) GetDeposit() btypes.BigInt { return tp.Deposit } -func (tp SoftwareUpgradeProposal) GetProposalType() ProposalType { return ProposalTypeSoftwareUpgrade } +func (tp SoftwareUpgradeProposal) GetTitle() string { return tp.Title } +func (tp SoftwareUpgradeProposal) GetDescription() string { return tp.Description } +func (tp SoftwareUpgradeProposal) GetDeposit() btypes.BigInt { return tp.Deposit } +func (tp SoftwareUpgradeProposal) GetProposalType() ProposalType { return ProposalTypeSoftwareUpgrade } +func (tp SoftwareUpgradeProposal) GetProposer() btypes.AccAddress { return tp.Proposer } diff --git a/module/params/mapper/mapper.go b/module/params/mapper/mapper.go index b0641b77..a949c5f8 100644 --- a/module/params/mapper/mapper.go +++ b/module/params/mapper/mapper.go @@ -24,7 +24,6 @@ type Mapper struct { paramSets map[string]qtypes.ParamSet Metrics *Metrics - } func (mapper *Mapper) Copy() mapper.IMapper { diff --git a/module/qcp/client/cmd.go b/module/qcp/client/cmd.go index 3334265b..462ff037 100644 --- a/module/qcp/client/cmd.go +++ b/module/qcp/client/cmd.go @@ -2,14 +2,17 @@ package client import ( bctypes "github.com/QOSGroup/qbase/client/types" + "github.com/QOSGroup/qos/module/qcp/txs" "github.com/spf13/cobra" "github.com/tendermint/go-amino" ) func TxCommands(cdc *amino.Codec) []*cobra.Command { - return bctypes.PostCommands( + return bctypes.PostCustomMaxGasCommands([]*cobra.Command{ InitQCPCmd(cdc), - ) + }, []int64{ + txs.GasForCreateQCP + bctypes.DefaultMaxGas, + }) } func QueryCommands(cdc *amino.Codec) []*cobra.Command { diff --git a/module/qsc/client/cmd.go b/module/qsc/client/cmd.go index c77c2c31..279ab4ee 100644 --- a/module/qsc/client/cmd.go +++ b/module/qsc/client/cmd.go @@ -2,6 +2,7 @@ package client import ( bctypes "github.com/QOSGroup/qbase/client/types" + "github.com/QOSGroup/qos/module/qsc/txs" "github.com/spf13/cobra" "github.com/tendermint/go-amino" ) @@ -14,8 +15,12 @@ func QueryCommands(cdc *amino.Codec) []*cobra.Command { } func TxCommands(cdc *amino.Codec) []*cobra.Command { - return bctypes.PostCommands( + return bctypes.PostCustomMaxGasCommands([]*cobra.Command{ CreateQSCCmd(cdc), IssueQSCCmd(cdc), - ) + }, []int64{ + txs.GasForCreateQSC + bctypes.DefaultMaxGas, + txs.GasForIssueQSC + bctypes.DefaultMaxGas, + }) + } diff --git a/module/stake/client/cmd.go b/module/stake/client/cmd.go index 3e5b817b..897bea4f 100644 --- a/module/stake/client/cmd.go +++ b/module/stake/client/cmd.go @@ -2,12 +2,13 @@ package client import ( bctypes "github.com/QOSGroup/qbase/client/types" + "github.com/QOSGroup/qos/module/stake/txs" "github.com/spf13/cobra" "github.com/tendermint/go-amino" ) func TxCommands(cdc *amino.Codec) []*cobra.Command { - return bctypes.PostCommands( + return bctypes.PostCustomMaxGasCommands([]*cobra.Command{ CreateValidatorCmd(cdc), ModifyValidatorCmd(cdc), RevokeValidatorCmd(cdc), @@ -17,7 +18,18 @@ func TxCommands(cdc *amino.Codec) []*cobra.Command { CreateModifyCompoundCommand(cdc), CreateUnbondDelegationCommand(cdc), CreateReDelegationCommand(cdc), - ) + }, []int64{ + txs.GasForCreateValidator + bctypes.DefaultMaxGas, + txs.GasForModifyValidator + bctypes.DefaultMaxGas, + txs.GasForRevokeValidator + bctypes.DefaultMaxGas, + bctypes.DefaultMaxGas, + bctypes.DefaultMaxGas, + bctypes.DefaultMaxGas, + bctypes.DefaultMaxGas, + txs.GasForUnbond + bctypes.DefaultMaxGas, + bctypes.DefaultMaxGas, + }) + } func QueryCommands(cdc *amino.Codec) []*cobra.Command { diff --git a/types/const.go b/types/const.go index f1856b52..ca7e9f0f 100644 --- a/types/const.go +++ b/types/const.go @@ -8,7 +8,7 @@ const ( ) var ( - UnitQOS = math.Pow(10, Decimal) // QOS unit + UnitQOS = math.Pow(10, Decimal) // QOS unit DefaultTotalUnitQOSQuantity = int64(TotalQOSAmount * UnitQOS) // total QOS amount DefaultBlockInterval = int64(5) // 5 seconds diff --git a/types/mapper.go b/types/mapper.go index f442de0f..0e68a640 100644 --- a/types/mapper.go +++ b/types/mapper.go @@ -34,4 +34,3 @@ type ParamsInitializer interface { type MetricsMapper interface { SetUpMetrics(cfg *config.InstrumentationConfig) } - diff --git a/types/param.go b/types/param.go index 440b6ee4..be4859a2 100644 --- a/types/param.go +++ b/types/param.go @@ -27,4 +27,4 @@ type ParamSet interface { // 设置单个参数 SetKeyValue(key string, value interface{}) btypes.Error -} \ No newline at end of file +} diff --git a/version/version.go b/version/version.go index 0b0dafd1..83c3bf47 100644 --- a/version/version.go +++ b/version/version.go @@ -6,8 +6,7 @@ import ( ) var ( - - Version = "0.0.9" + Version = "0.1.0" Commit = "" ) From 6a20f44b6ebbfcc8de2b136d2f7d4c82a133d158 Mon Sep 17 00:00:00 2001 From: wangzhiyong Date: Fri, 13 Dec 2019 14:59:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0v0.1.0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 13 +++++++++++++ DOWNLOAD.md | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19cdd37b..bae41ae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## v0.1.0 +2019.12.13 + +**DOWNLOAD** + +[下载链接](https://github.com/QOSGroup/qos/blob/master/DOWNLOAD.md) + +**IMPROVEMENTS** +* [module] 增加txs,events查询API +* [module] 修改TX默认GAS费用 +* [module] 修改GAS释放策略 + + ## v0.0.9 2019.12.03 diff --git a/DOWNLOAD.md b/DOWNLOAD.md index 1e377694..eb092de7 100644 --- a/DOWNLOAD.md +++ b/DOWNLOAD.md @@ -1,6 +1,19 @@ ## Download +### v0.1.0 + +|Platform| qosd | qoscli | +|:--|:----| :-------| +|Linux-x64|[qosd-v0.1.0-linux-x64](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-linux-x64)|[qoscli-v0.1.0-linux-x64](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-linux-x64)| +|Linux-i386|[qosd-v0.1.0-linux-i386](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-linux-i386)|[qoscli-v0.1.0-linux-i386](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-linux-i386)| +|Linux-arm|[qosd-v0.1.0-linux-arm](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-linux-arm)|[qoscli-v0.1.0-linux-arm](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-linux-arm)| +|Macos-x64|[qosd-v0.1.0-macos-x64](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-macos-x64)|[qoscli-v0.1.0-macos-x64](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-macos-x64)| +|Macos-i386|[qosd-v0.1.0-macos-i386](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-macos-i386)|[qoscli-v0.1.0-macos-i386](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-macos-i386)| +|Windows-x64|[qosd-v0.1.0-windows-x64.exe](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-windows-x64.exe)|[qoscli-v0.1.0-windows-x64.exe](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-windows-x64.exe)| +|Windows-i386|[qosd-v0.1.0-windows-i386.exe](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qosd-v0.1.0-windows-i386.exe)|[qoscli-v0.1.0-windows-i386.exe](http://aoe-qos.oss-cn-beijing.aliyuncs.com/public/qos-testnet/v0.1.0/qoscli-v0.1.0-windows-i386.exe)| + + ### v0.0.9 |Platform| qosd | qoscli |