Skip to content

Commit

Permalink
Merge pull request #198 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.10.0
  • Loading branch information
danil-lashin authored Jan 21, 2019
2 parents d6068ac + 46e701f commit 1f21eb6
Show file tree
Hide file tree
Showing 68 changed files with 772 additions and 2,140 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 0.10.0
*Jan 10th, 2019*

BREAKING CHANGES

- [core] Add EditCandidate transaction
- [core] Make validators count logic conforms to mainnet
- [tendermint] Update to [v0.28.1](https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0281)

BUG FIXES

- [core] Various bug fixes

IMPROVEMENT

- [mempool] Add variable min gas price threshold
- [p2p] Lower FlushThrottleTimeout to 10 ms
- [rpc] RPC errors are now delivered with 500 HTTP code
- [rpc] Prettify RPC errors

## 0.9.6
*Dec 27th, 2018*

Expand Down
26 changes: 14 additions & 12 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 3 additions & 30 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/btcsuite/btcd"
Expand All @@ -38,12 +11,12 @@
version = "^1.6.0"

[[constraint]]
name = "github.com/tendermint/iavl"
version = "0.12.0"
name = "github.com/danil-lashin/iavl"
branch = "master"

[[constraint]]
name = "github.com/tendermint/tendermint"
version = "0.27.4"
version = "0.28.1"

[[constraint]]
name = "github.com/MinterTeam/go-amino"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _NOTE: This is alpha software. Please contact us if you intend to run it in prod

## Installation

You can get official installation instructions in our [docs](https://minter-go-node.readthedocs.io/en/dev/install.html).
You can get official installation instructions in our [docs](https://docs.minter.network/#section/Install-Minter).

1. Download Minter

Expand All @@ -32,7 +32,7 @@ You can get official installation instructions in our [docs](https://minter-go-n

## Resources

- [Documentation](https://minter-go-node.readthedocs.io/en/dev/)
- [Documentation](https://docs.minter.network)
- [Official site](https://minter.network)
- [About Minter Blockchain](https://about.minter.network)
- [Minter Console](https://testnet.console.minter.network)
Expand Down
2 changes: 1 addition & 1 deletion api/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type AddressResponse struct {
func Address(address types.Address, height int) (*AddressResponse, error) {
cState, err := GetStateForHeight(height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "State at given height not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "State at given height not found", Data: err.Error()}
}

response := AddressResponse{
Expand Down
9 changes: 5 additions & 4 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var Routes = map[string]*rpcserver.RPCFunc{
"estimate_tx_commission": rpcserver.NewRPCFunc(EstimateTxCommission, "tx,height"),
"unconfirmed_txs": rpcserver.NewRPCFunc(UnconfirmedTxs, "limit"),
"max_gas": rpcserver.NewRPCFunc(MaxGas, "height"),
"min_gas_price": rpcserver.NewRPCFunc(MinGasPrice, ""),
}

func RunApi(b *minter.Blockchain, tmRPC *rpc.Local) {
Expand Down Expand Up @@ -132,15 +133,15 @@ func RegisterCryptoAmino(cdc *amino.Codec) {
// These are all written here instead of
cdc.RegisterInterface((*crypto.PubKey)(nil), nil)
cdc.RegisterConcrete(ed25519.PubKeyEd25519{},
ed25519.PubKeyAminoRoute, nil)
ed25519.PubKeyAminoName, nil)
cdc.RegisterConcrete(secp256k1.PubKeySecp256k1{},
secp256k1.PubKeyAminoRoute, nil)
secp256k1.PubKeyAminoName, nil)
cdc.RegisterConcrete(multisig.PubKeyMultisigThreshold{},
multisig.PubKeyMultisigThresholdAminoRoute, nil)

cdc.RegisterInterface((*crypto.PrivKey)(nil), nil)
cdc.RegisterConcrete(ed25519.PrivKeyEd25519{},
ed25519.PrivKeyAminoRoute, nil)
ed25519.PrivKeyAminoName, nil)
cdc.RegisterConcrete(secp256k1.PrivKeySecp256k1{},
secp256k1.PrivKeyAminoRoute, nil)
secp256k1.PrivKeyAminoName, nil)
}
6 changes: 3 additions & 3 deletions api/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Block(height int64) (*BlockResponse, error) {
block, err := client.Block(&height)
blockResults, err := client.BlockResults(&height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "Block not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "Block not found", Data: err.Error()}
}

txs := make([]BlockTransactionResponse, len(block.Block.Data.Txs))
Expand Down Expand Up @@ -96,12 +96,12 @@ func Block(height int64) (*BlockResponse, error) {

tmValidators, err := client.Validators(&height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "Validators for block not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "Validators for block not found", Data: err.Error()}
}

commit, err := client.Commit(&height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "Commit for block not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "Commit for block not found", Data: err.Error()}
}

validators := make([]BlockValidatorResponse, len(commit.Commit.Precommits))
Expand Down
4 changes: 2 additions & 2 deletions api/candidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"github.com/MinterTeam/minter-go-node/core/state"
"github.com/MinterTeam/minter-go-node/core/types"
"github.com/pkg/errors"
"github.com/MinterTeam/minter-go-node/rpc/lib/types"
"math/big"
)

Expand Down Expand Up @@ -59,7 +59,7 @@ func Candidate(pubkey []byte, height int) (*CandidateResponse, error) {

candidate := cState.GetStateCandidate(pubkey)
if candidate == nil {
return nil, errors.New("Candidate not found")
return nil, rpctypes.RPCError{Code: 404, Message: "Candidate not found"}
}

response := makeResponseCandidate(*candidate, true)
Expand Down
4 changes: 2 additions & 2 deletions api/coin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"github.com/MinterTeam/minter-go-node/core/types"
"github.com/pkg/errors"
"github.com/MinterTeam/minter-go-node/rpc/lib/types"
"math/big"
)

Expand All @@ -22,7 +22,7 @@ func CoinInfo(coinSymbol string, height int) (*CoinInfoResponse, error) {

coin := cState.GetStateCoin(types.StrToCoinSymbol(coinSymbol))
if coin == nil {
return nil, errors.New("Coin not found")
return nil, rpctypes.RPCError{Code: 404, Message: "Coin not found"}
}

coinData := coin.Data()
Expand Down
2 changes: 1 addition & 1 deletion api/maxgas.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
func MaxGas(height int) (*uint64, error) {
cState, err := GetStateForHeight(height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "State at given height not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "State at given height not found", Data: err.Error()}
}

maxGas := cState.GetCurrentMaxGas()
Expand Down
7 changes: 7 additions & 0 deletions api/min_gas_price.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package api

import "math/big"

func MinGasPrice() (*big.Int, error) {
return blockchain.MinGasPrice(), nil
}
15 changes: 14 additions & 1 deletion api/send_transaction.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
package api

import (
"github.com/MinterTeam/minter-go-node/rpc/lib/types"
"github.com/tendermint/tendermint/rpc/core/types"
)

func SendTransaction(tx []byte) (*core_types.ResultBroadcastTx, error) {
return client.BroadcastTxSync(tx)
result, err := client.BroadcastTxSync(tx)
if err != nil {
return nil, err
}

if result.Code != 0 {
return nil, rpctypes.TxError{
Code: result.Code,
Log: result.Log,
}
}

return result, nil
}
2 changes: 2 additions & 0 deletions api/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func encodeTxData(decodedTx *transaction.Transaction) ([]byte, error) {
return cdc.MarshalJSON(decodedTx.GetDecodedData().(*transaction.CreateMultisigData))
case transaction.TypeMultisend:
return cdc.MarshalJSON(decodedTx.GetDecodedData().(*transaction.MultisendData))
case transaction.TypeEditCandidate:
return cdc.MarshalJSON(decodedTx.GetDecodedData().(*transaction.EditCandidateData))
}

return nil, errors.New("unknown tx type")
Expand Down
19 changes: 1 addition & 18 deletions cmd/minter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ func main() {
os.Exit(1)
}

if *utils.ResetPrivateValidator {
resetFilePV(config.GetConfig().PrivValidatorFile())
os.Exit(0)
}

app := minter.NewMinterBlockchain()
node := startTendermintNode(app)

Expand Down Expand Up @@ -68,7 +63,7 @@ func startTendermintNode(app *minter.Blockchain) *tmNode.Node {

node, err := tmNode.NewNode(
cfg,
privval.LoadOrGenFilePV(cfg.PrivValidatorFile()),
privval.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()),
nodeKey,
proxy.NewLocalClientCreator(app),
genesis.GetTestnetGenesis,
Expand All @@ -91,15 +86,3 @@ func startTendermintNode(app *minter.Blockchain) *tmNode.Node {

return node
}

func resetFilePV(privValFile string) {
if _, err := os.Stat(privValFile); err == nil {
pv := privval.LoadFilePV(privValFile)
pv.Reset()
log.Error("Reset private validator file to genesis state", "file", privValFile)
} else {
pv := privval.GenFilePV(privValFile)
pv.Save()
log.Error("Generated private validator file", "file", privValFile)
}
}
3 changes: 1 addition & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
)

var (
MinterHome = flag.String("home", "", "Path to minter data directory")
ResetPrivateValidator = flag.Bool("reset-private-validator", false, "")
MinterHome = flag.String("home", "", "Path to minter data directory")
)

func init() {
Expand Down
Loading

0 comments on commit 1f21eb6

Please sign in to comment.