Skip to content

Commit

Permalink
Merge pull request #1799 from vegaprotocol/release/v0.20.0
Browse files Browse the repository at this point in the history
Release v0.20.0
  • Loading branch information
ashleyvega authored Jun 15, 2020
2 parents cc332c2 + 6fd7785 commit 077cc41
Show file tree
Hide file tree
Showing 156 changed files with 6,757 additions and 4,715 deletions.
12 changes: 12 additions & 0 deletions .drone-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,18 @@ steps:
depends_on:
- build-multiarch

- name: changelog_slack
image: docker.pkg.github.com/vegaprotocol/devops-infra/cipipeline:1.11.13
environment:
SLACK_HOOK_URL:
from_secret: SLACK_HOOK_URL
commands:
- /usr/local/bin/changelog-slack.sh "$$DRONE_TAG" "$$SLACK_HOOK_URL"
when:
event: tag
depends_on:
- publish_artefacts

volumes:
- name: dockersock
host:
Expand Down
6 changes: 5 additions & 1 deletion .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
# where filename is relative to this configuration file
api
barnabee
base64
blockchain
datetime
Ed25519
Enums
enum
enums
github
GitLab
Golang
Expand All @@ -27,6 +30,7 @@ syslog
tamlyn10
Tendermint
testnet
tradable
traderbot
unexported
vega
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## 0.20.0

*2020-06-15*

This release contains a lot of fixes to APIs, and a minor new addition to the statistics endpoint. Potentially breaking changes are now labelled with 💥. If you have implemented a client that fetches candles, places orders or amends orders, please check below.

### Features
- [#1730](https://github.com/vegaprotocol/vega/pull/1730) `ChainID` added to statistics endpoint
- 💥 [#1734](https://github.com/vegaprotocol/vega/pull/1734) Start adding `TraceID` to core events

### Improvements
- 💥 [#1721](https://github.com/vegaprotocol/vega/pull/1721) Improve API responses for `GetProposalById`
- 💥 [#1724](https://github.com/vegaprotocol/vega/pull/1724) New Order: Type no longer defaults to LIMIT orders
- 💥 [#1728](https://github.com/vegaprotocol/vega/pull/1728) `PrepareAmend` no longer accepts expiry time
- 💥 [#1760](https://github.com/vegaprotocol/vega/pull/1760) Add proto enum zero value "unspecified" to Side
- 💥 [#1764](https://github.com/vegaprotocol/vega/pull/1764) Candles: Interval no longer defaults to 1 minute
- 💥 [#1773](https://github.com/vegaprotocol/vega/pull/1773) Add proto enum zero value "unspecified" to `Order.Status`
- 💥 [#1776](https://github.com/vegaprotocol/vega/pull/1776) Add prefixes to enums, add proto zero value "unspecified" to `Trade.Type`
- 💥 [#1781](https://github.com/vegaprotocol/vega/pull/1781) Add prefix and UNSPECIFIED to `ChainStatus`, `AccountType`, `TransferType`
- [#1714](https://github.com/vegaprotocol/vega/pull/1714) Extend governance error handling
- [#1726](https://github.com/vegaprotocol/vega/pull/1726) Mark Price was not always correctly updated on a partial fill
- [#1734](https://github.com/vegaprotocol/vega/pull/1734) Feature/1577 hash context propagation
- [#1741](https://github.com/vegaprotocol/vega/pull/1741) Fix incorrect timestamps for proposals retrieved by GraphQL
- [#1743](https://github.com/vegaprotocol/vega/pull/1743) Orders amended to be GTT now return GTT in the response
- [#1745](https://github.com/vegaprotocol/vega/pull/1745) Votes blob is now base64 encoded
- [#1747](https://github.com/vegaprotocol/vega/pull/1747) Markets created from proposals now have the same ID as the proposal that created them
- [#1750](https://github.com/vegaprotocol/vega/pull/1750) Added datetime to governance votes
- [#1751](https://github.com/vegaprotocol/vega/pull/1751) Fix a bug in governance vote counting
- [#1752](https://github.com/vegaprotocol/vega/pull/1752) Fix incorrect validation on new orders
- [#1757](https://github.com/vegaprotocol/vega/pull/1757) Fix incorrect party ID validation on new orders
- [#1758](https://github.com/vegaprotocol/vega/pull/1758) Fix issue where markets created via governance were not tradable
- [#1763](https://github.com/vegaprotocol/vega/pull/1763) Expiration settlement date for market changed to 30/10/2020-22:59:59
- [#1777](https://github.com/vegaprotocol/vega/pull/1777) Create `README.md`
- [#1764](https://github.com/vegaprotocol/vega/pull/1764) Add proto enum zero value "unspecified" to Interval
- [#1767](https://github.com/vegaprotocol/vega/pull/1767) Feature/1692 order event
- [#1787](https://github.com/vegaprotocol/vega/pull/1787) Feature/1697 account event
- [#1788](https://github.com/vegaprotocol/vega/pull/1788) Check for unspecified Vote value
- [#1794](https://github.com/vegaprotocol/vega/pull/1794) Feature/1696 party event

## 0.19.0

*2020-05-26*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vega

Version 0.19.0.
Version 0.20.0.

A decentralised trading platform that allows pseudo-anonymous trading of derivatives on a blockchain.

Expand Down
6 changes: 3 additions & 3 deletions accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *Svc) Withdraw(ctx context.Context, w *types.Withdraw) (bool, error) {
}

func (s *Svc) GetPartyAccounts(partyID, marketID, asset string, ty types.AccountType) ([]*types.Account, error) {
if ty == types.AccountType_GENERAL {
if ty == types.AccountType_ACCOUNT_TYPE_GENERAL {
// General accounts for party are not specific to one market, therefore marketID should not be set
marketID = ""
}
Expand All @@ -84,7 +84,7 @@ func (s *Svc) GetPartyAccounts(partyID, marketID, asset string, ty types.Account
// There is a ticket to improve and clean this up in the collateral-engine:
// https://github.com/vegaprotocol/vega/issues/416
for _, acc := range accounts {
if acc.GetType() == types.AccountType_GENERAL {
if acc.GetType() == types.AccountType_ACCOUNT_TYPE_GENERAL {
if acc.GetMarketID() == "!" {
acc.MarketID = ""
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func (s *Svc) ObserveAccounts(ctx context.Context, retries int, marketID string,
if (len(marketID) <= 0 || marketID == acc.MarketID) &&
(len(partyID) <= 0 || partyID == acc.Owner) &&
(len(asset) <= 0 || asset == acc.Asset) &&
(ty == types.AccountType_ALL || ty == acc.Type) {
(ty == types.AccountType_ACCOUNT_TYPE_UNSPECIFIED || ty == acc.Type) {
filtered = append(filtered, acc)
}
}
Expand Down
30 changes: 15 additions & 15 deletions accounts/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
// the tests with too many arguments when getting account return values
var (
allTypes = []types.AccountType{
types.AccountType_MARGIN,
types.AccountType_GENERAL,
types.AccountType_ACCOUNT_TYPE_MARGIN,
types.AccountType_ACCOUNT_TYPE_GENERAL,

types.AccountType_INSURANCE,
types.AccountType_SETTLEMENT,
types.AccountType_ACCOUNT_TYPE_INSURANCE,
types.AccountType_ACCOUNT_TYPE_SETTLEMENT,
}

traderTypes = allTypes[:2]
Expand Down Expand Up @@ -50,13 +50,13 @@ func testGetTraderAccountsSuccess(t *testing.T) {

all := append(firstMarket, secondMarket...)

svc.storage.EXPECT().GetPartyAccounts(owner, "", "", types.AccountType_ALL).Times(1).Return(all, nil)
accs, err := svc.GetPartyAccounts(owner, "", "", types.AccountType_ALL)
svc.storage.EXPECT().GetPartyAccounts(owner, "", "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED).Times(1).Return(all, nil)
accs, err := svc.GetPartyAccounts(owner, "", "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)
assert.NoError(t, err)
assert.Equal(t, all, accs)
// now see if we get the expected accounts (only BTC accounts) if we get trader balance for a market
svc.storage.EXPECT().GetPartyAccounts(owner, market1, "", types.AccountType_ALL).Times(1).Return(firstMarket[:2], nil)
accs, err = svc.GetPartyAccounts(owner, market1, "", types.AccountType_ALL)
svc.storage.EXPECT().GetPartyAccounts(owner, market1, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED).Times(1).Return(firstMarket[:2], nil)
accs, err = svc.GetPartyAccounts(owner, market1, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)
assert.NoError(t, err)
assert.Equal(t, len(firstMarket), len(accs))
for i := range accs {
Expand All @@ -70,23 +70,23 @@ func testGetTraderAccountsErr(t *testing.T) {
svc := getTestService(t)
defer svc.ctrl.Finish()
owner := "test"
svc.storage.EXPECT().GetPartyAccounts(owner, "", "", types.AccountType_ALL).Times(1).Return(nil, storage.ErrOwnerNotFound)
accs, err := svc.GetPartyAccounts(owner, "", "", types.AccountType_ALL)
svc.storage.EXPECT().GetPartyAccounts(owner, "", "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED).Times(1).Return(nil, storage.ErrOwnerNotFound)
accs, err := svc.GetPartyAccounts(owner, "", "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)
assert.Error(t, err)
assert.Nil(t, accs)
assert.Equal(t, storage.ErrOwnerNotFound, err)

// accounts not set up, so we can test the errors for trader market balance here, too
market := "BTC/DEC19"
svc.storage.EXPECT().GetPartyAccounts(owner, market, "", types.AccountType_ALL).Times(1).Return(nil, storage.ErrOwnerNotFound)
accs, err = svc.GetPartyAccounts(owner, market, "", types.AccountType_ALL)
svc.storage.EXPECT().GetPartyAccounts(owner, market, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED).Times(1).Return(nil, storage.ErrOwnerNotFound)
accs, err = svc.GetPartyAccounts(owner, market, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)
assert.Nil(t, accs)
assert.Error(t, err)

// check we're returning the correct error
assert.Equal(t, storage.ErrOwnerNotFound, err)
svc.storage.EXPECT().GetPartyAccounts(owner, market, "", types.AccountType_ALL).Times(1).Return(nil, storage.ErrMarketNotFound)
accs, err = svc.GetPartyAccounts(owner, market, "", types.AccountType_ALL)
svc.storage.EXPECT().GetPartyAccounts(owner, market, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED).Times(1).Return(nil, storage.ErrMarketNotFound)
accs, err = svc.GetPartyAccounts(owner, market, "", types.AccountType_ACCOUNT_TYPE_UNSPECIFIED)
assert.Nil(t, accs)
assert.Equal(t, storage.ErrMarketNotFound, err)
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func getTestAccounts(owner, market string, accTypes ...types.AccountType) []*typ
Type: t,
}
// general accounts don't have a market ID
if t == types.AccountType_GENERAL {
if t == types.AccountType_ACCOUNT_TYPE_GENERAL {
acc.MarketID = ""
}
ret = append(ret, acc)
Expand Down
5 changes: 5 additions & 0 deletions api/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ var (
ErrBlockchainBacklogLength = errors.New("failed to get backlog length from blockchain")
ErrBlockchainNetworkInfo = errors.New("failed to get network info from blockchain")
ErrBlockchainGenesisTime = errors.New("failed to get genesis time from blockchain")
ErrBlockchainChainID = errors.New("failed to get chain ID from blockchain")
// Governance...
// ErrPrepareProposal is returned when preparation of a governance proposal fails for some reason.
ErrPrepareProposal = errors.New("failed to prepare a proposal")
ErrPrepareVote = errors.New("failed to prepare vote")
// ErrMissingProposalID returned if proposal with this id is missing
ErrMissingProposalID = errors.New("missing proposal id")
// ErrMissingProposalReference returned if proposal with this reference is not found
ErrMissingProposalReference = errors.New("failed to find proposal with the reference")
)

// errorMap contains a mapping between errors and Vega numeric error codes.
Expand Down
15 changes: 15 additions & 0 deletions api/mocks/blockchain_client_mock.go

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

5 changes: 3 additions & 2 deletions api/mocks/governance_data_service_mock.go

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

27 changes: 18 additions & 9 deletions api/trading.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,20 @@ func (s *tradingService) PrepareProposal(
) (*protoapi.PrepareProposalResponse, error) {
startTime := time.Now()
defer metrics.APIRequestAndTimeGRPC("PrepareProposal", startTime)
proposal, err := s.governanceService.PrepareProposal(ctx,
req.PartyID, req.Reference, req.Proposal)

if err := req.Validate(); err != nil {
return nil, apiError(codes.InvalidArgument, ErrMalformedRequest, err)
}
proposal, err := s.governanceService.PrepareProposal(ctx, req.PartyID, req.Reference, req.Proposal)
if err != nil {
return nil, apiError(codes.Internal, ErrMalformedRequest)
return nil, apiError(codes.Internal, ErrPrepareProposal, err)
}
raw, err := proto.Marshal(proposal) // marshal whole proposal
if err != nil {
return nil, apiError(codes.Internal, ErrPrepareProposal)
return nil, apiError(codes.Internal, ErrPrepareProposal, err)
}
if raw, err = txEncode(raw, blockchain.ProposeCommand); err != nil {
return nil, apiError(codes.Internal, ErrPrepareProposal)
return nil, apiError(codes.Internal, ErrPrepareProposal, err)
}
return &protoapi.PrepareProposalResponse{
Blob: raw,
Expand All @@ -197,19 +200,25 @@ func (s *tradingService) PrepareProposal(
func (s *tradingService) PrepareVote(ctx context.Context, req *protoapi.PrepareVoteRequest) (*protoapi.PrepareVoteResponse, error) {
startTime := time.Now()
defer metrics.APIRequestAndTimeGRPC("PrepareVote", startTime)

if err := req.Validate(); err != nil {
return nil, apiError(codes.Internal, ErrMalformedRequest)
return nil, apiError(codes.InvalidArgument, ErrMalformedRequest, err)
}

if req.Vote.Value == types.Vote_VALUE_UNSPECIFIED {
return nil, apiError(codes.InvalidArgument, ErrMalformedRequest)
}

vote, err := s.governanceService.PrepareVote(req.Vote)
if err != nil {
return nil, apiError(codes.Internal, ErrMalformedRequest)
return nil, apiError(codes.Internal, ErrPrepareVote, err)
}
raw, err := proto.Marshal(vote)
if err != nil {
return nil, apiError(codes.Internal, ErrPrepareVote)
return nil, apiError(codes.Internal, ErrPrepareVote, err)
}
if raw, err = txEncode(raw, blockchain.VoteCommand); err != nil {
return nil, apiError(codes.Internal, ErrPrepareVote)
return nil, apiError(codes.Internal, ErrPrepareVote, err)
}
return &protoapi.PrepareVoteResponse{
Blob: raw,
Expand Down
Loading

0 comments on commit 077cc41

Please sign in to comment.