Skip to content

Commit

Permalink
Merge pull request #2198 from vegaprotocol/release/v0.24.0
Browse files Browse the repository at this point in the history
Release v0.24.0
  • Loading branch information
ashleyvega committed Sep 8, 2020
2 parents e3a261a + 50f62d0 commit 4d4cb8b
Show file tree
Hide file tree
Showing 100 changed files with 8,424 additions and 4,410 deletions.
49 changes: 2 additions & 47 deletions .drone-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ steps:
- unset GITHUB_DEPLOY_SSH_PRIVATE_KEY
# Build normal executable
- ./script/build.sh -a build -t linux/amd64
# Build executable for sytstem-tests, with custom Governance parameters. 8760h is 24*365 hours.
- env
VEGA_GOVERNANCE_MIN_CLOSE=5s
VEGA_GOVERNANCE_MAX_CLOSE=8760h
VEGA_GOVERNANCE_MIN_ENACT=5s
VEGA_GOVERNANCE_MAX_ENACT=8760h
VEGA_GOVERNANCE_MIN_PARTICIPATION_STAKE=1
./script/build.sh -a build -t linux/amd64 -s "-systemtests"
depends_on:
- fetch
when:
Expand Down Expand Up @@ -111,45 +103,8 @@ steps:
SLACK_HOOK_URL:
from_secret: SLACK_HOOK_URL
commands:
# https://github.com/vegaprotocol/system-tests/blob/master/systemtests.sh
- codefile="$$(mktemp)" ; logfile="$$(mktemp)"
# Run system-tests, using previously built executable with custom Governance parameters.
- (
/usr/local/bin/systemtests.sh -x "$$PWD/cmd/vega/vega-linux-amd64-systemtests" -v all ;
echo "$$?" >"$$codefile"
) 2>&1 | tee "$$logfile"
- test "$$(cat "$$codefile")" = 0 && exit 0
# system-tests failed
- msgprefix="system-tests failed for PR#$$DRONE_PULL_REQUEST (\`$$DRONE_SOURCE_BRANCH\` -> \`$$DRONE_TARGET_BRANCH\`)"
# Failure is fatal only while attempting to merge to master.
- if test "$$DRONE_TARGET_BRANCH" = master ; then
exitcode=1 ;
msg="$$msgprefix *pipeline failed* :cry:" ;
else
exitcode=0 ;
msg="$$msgprefix (pipeline continues)" ;
fi
# Notify Slack
- msg="$$(python3 -c "import json,sys;print(json.dumps(sys.argv[1]))" "$$msg")"
- 'curl -s -XPOST
-d "{\"channel\": \"#tradingcore-notify\", \"icon_emoji\": \":robot:\", \"text\": $$msg, \"username\": \"nagbot\" }"
"$$SLACK_HOOK_URL"'
# Make Github PR comment
- commentfile="$$(mktemp)"
- (
echo "system-tests failed." ;
echo ;
echo "\`\`\`" ;
grep --text -A1000 "=== Test summary ===" "$$logfile" || echo "No test summary found" ;
echo "\`\`\`"
) >"$$commentfile"
- body="$$(python3 -c "import json,sys;print(json.dumps(sys.argv[1]))" "$$(cat "$$commentfile")")"
- 'curl -s -XPOST
-H "Accept: application/vnd.github.v3+json"
-H "Authorization: token $$GITHUB_API_TOKEN"
-d "{\"body\": $$body}"
"https://api.github.com/repos/vegaprotocol/vega/issues/$$DRONE_PULL_REQUEST/comments"'
- exit "$$exitcode"
# https://github.com/vegaprotocol/system-tests/blob/master/ci.sh
- /usr/local/bin/ci.sh
depends_on:
- test-PR
when:
Expand Down
30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
# Changelog

## 0.24.0

*2020-09-04*

One new API endpoint allows cancelling multiple orders simultaneously, either all orders by market, a single order in a specific market, or just all open orders.

Other than that it's mainly bugfixes, many of which fix subtly incorrect API output.

### New

- [#2107](https://github.com/vegaprotocol/vega/pull/2107) Support for cancelling multiple orders at once
- [#2186](https://github.com/vegaprotocol/vega/pull/2186) Add per-party rate-limit of 50 requests over 3 blocks

### Improvements

- [#2177](https://github.com/vegaprotocol/vega/pull/2177) GraphQL: Add Governance proposal metadata
- [#2098](https://github.com/vegaprotocol/vega/pull/2098) Fix crashed in event bus
- [#2041](https://github.com/vegaprotocol/vega/pull/2041) Fix a rounding error in the output of Positions API
- [#1934](https://github.com/vegaprotocol/vega/pull/1934) Improve API documentation
- [#2110](https://github.com/vegaprotocol/vega/pull/2110) Send Infrastructure fees to the correct account
- [#2117](https://github.com/vegaprotocol/vega/pull/2117) Prevent creation of withdrawal requests for more than the available balance
- [#2136](https://github.com/vegaprotocol/vega/pull/2136) gRPC: Fetch all accounts for a market did not return all accounts
- [#2151](https://github.com/vegaprotocol/vega/pull/2151) Prevent wasteful event bus subscriptions
- [#2167](https://github.com/vegaprotocol/vega/pull/2167) Ensure events in the event bus maintain their order
- [#2178](https://github.com/vegaprotocol/vega/pull/2178) Fix API returning incorrectly formatted orders when a party has no collateral

## 0.23.1

*2020-08-27*

This release backports a fix from the forthcoming 0.24.0 release that fixes a GraphQL issue with the new `Asset` type. When fetching the Assets from the top level, all the details came through. When fetching them as a nested property, only the ID was filled in. This is now fixed.

## Improvements
### Improvements

- [#2140](https://github.com/vegaprotocol/vega/pull/2140) GraphQL fix for fetching assets as nested properties

Expand All @@ -28,7 +54,7 @@ This release contains a lot of groundwork for Fees and Auction mode.

### New

- [#2092](https://github.com/vegaprotocol/vega/issues/2092) 💥 Disable order amends
- 💥 [#2092](https://github.com/vegaprotocol/vega/pull/2092) Disable order amends
- [#2027](https://github.com/vegaprotocol/vega/pull/2027) Add built in asset faucet endpoint
- [#2075](https://github.com/vegaprotocol/vega/pull/2075), [#2086](https://github.com/vegaprotocol/vega/pull/2086), [#2083](https://github.com/vegaprotocol/vega/pull/2083), [#2078](https://github.com/vegaprotocol/vega/pull/2078) Add time & size limits to faucet requests
- [#2068](https://github.com/vegaprotocol/vega/pull/2068) Add REST endpoint to fetch governance proposals by Party
Expand Down
22 changes: 11 additions & 11 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,27 @@ The following OS packages are required:

## Installing Golang

**Required version: 1.11.13**
**Required version: 1.14.4**

Get Golang via OS package manager, or directly from from https://golang.org/dl/.
See also the [Golang installation guide](https://golang.org/doc/install).
Install it somewhere, then point "`$GOROOT`" at that location:

```bash
# Add to $HOME/.bashrc:
export GOROOT="/path/to/your/go1.11.13"
export GOROOT="/path/to/your/go1.14.4"
export PATH="$PATH:$GOROOT/bin"
```

Ensure you have `go`, `godoc` and `gofmt`:
Ensure you have `go` and `gofmt`:

```bash
$ which go godoc gofmt
/path/to/your/go1.11.13/bin/go
/path/to/your/go1.11.13/bin/godoc
/path/to/your/go1.11.13/bin/gofmt
$ which go gofmt
/path/to/your/go1.14.4/bin/go
/path/to/your/go1.14.4/bin/gofmt

$ go version
go version go1.11.13 linux/amd64
go version go1.14.4 linux/amd64
```

## Set up Go source path
Expand All @@ -61,17 +60,17 @@ For advanced Golang users who are happy to support the system themselves:
All Vega Golang repositories have been set up to use Go Modules (check for files
`go.mod` and `go.sum` in the top-level directory).

## GitLab Authentication
## GitHub Authentication

Either use your existing GitLab account, or create a Vega-specific one.
Either use your existing GitHub account, or create a Vega-specific one.

If not already present (in `$HOME/.ssh`), create an RSA keypair:

```bash
ssh-keygen -t rsa -b 4096
```

Add the public key (found in `$HOME/.ssh/id_rsa.pub`) to GitLab:
Add the public key (found in `$HOME/.ssh/id_rsa.pub`) to GitHub:
https://github.com/settings/keys

## Get vega
Expand Down Expand Up @@ -175,6 +174,7 @@ In order to develop trading core, more tools are needed. Install them with:

```bash
# get the dev tools
make gettools_develop
make gqlgen_check # warning: This may take a minute, with no output.
make proto_check
```
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.23.1.
Version 0.24.0.

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

Expand Down
2 changes: 1 addition & 1 deletion accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,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_ACCOUNT_TYPE_GENERAL {
if acc.GetType() == types.AccountType_ACCOUNT_TYPE_GENERAL || acc.GetType() == types.AccountType_ACCOUNT_TYPE_LOCK_WITHDRAW {
if acc.GetMarketID() == "!" {
acc.MarketID = ""
}
Expand Down
50 changes: 50 additions & 0 deletions api/mocks/fee_service_mock.go

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

5 changes: 5 additions & 0 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"code.vegaprotocol.io/vega/assets"
"code.vegaprotocol.io/vega/candles"
"code.vegaprotocol.io/vega/contextutil"
"code.vegaprotocol.io/vega/fee"
"code.vegaprotocol.io/vega/governance"
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/monitoring"
Expand Down Expand Up @@ -49,6 +50,7 @@ type GRPCServer struct {
notaryService *notary.Svc
evtfwd EvtForwarder
assetService *assets.Svc
feeService *fee.Svc

tradingService *tradingService
tradingDataService *tradingDataService
Expand Down Expand Up @@ -79,6 +81,7 @@ func NewGRPCServer(
notaryService *notary.Svc,
evtfwd EvtForwarder,
assetService *assets.Svc,
feeService *fee.Svc,
statusChecker *monitoring.Status,
) *GRPCServer {
// setup logger
Expand All @@ -104,6 +107,7 @@ func NewGRPCServer(
notaryService: notaryService,
evtfwd: evtfwd,
assetService: assetService,
feeService: feeService,
statusChecker: statusChecker,
ctx: ctx,
cfunc: cfunc,
Expand Down Expand Up @@ -219,6 +223,7 @@ func (g *GRPCServer) Start() {
NotaryService: g.notaryService,
governanceService: g.governanceService,
AssetService: g.assetService,
FeeService: g.feeService,
statusChecker: g.statusChecker,
ctx: g.ctx,
}
Expand Down
1 change: 1 addition & 0 deletions api/trading.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func (s *tradingService) PrepareProposal(
if err != nil {
return nil, apiError(codes.Internal, ErrPrepareProposal, err)
}

if raw, err = txEncode(raw, blockchain.ProposeCommand); err != nil {
return nil, apiError(codes.Internal, ErrPrepareProposal, err)
}
Expand Down
39 changes: 22 additions & 17 deletions api/trading_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ type AssetService interface {
GetAll() ([]types.Asset, error)
}

// FeeService Provides apis to estimate fees
//go:generate go run github.com/golang/mock/mockgen -destination mocks/fee_service_mock.go -package mocks code.vegaprotocol.io/vega/api FeeService
type FeeService interface {
EstimateFee(context.Context, *types.Order) (*types.Fee, error)
}

type tradingDataService struct {
log *logging.Logger
Config Config
Expand All @@ -176,10 +182,26 @@ type tradingDataService struct {
TransferResponseService TransferResponseService
governanceService GovernanceDataService
AssetService AssetService
FeeService FeeService
statusChecker *monitoring.Status
ctx context.Context
}

func (t *tradingDataService) EstimateFee(ctx context.Context, req *protoapi.EstimateFeeRequest) (*protoapi.EstimateFeeResponse, error) {
if req.Order == nil {
return nil, apiError(codes.InvalidArgument, errors.New("missing order"))
}

fee, err := t.FeeService.EstimateFee(ctx, req.Order)
if err != nil {
return nil, apiError(codes.Internal, err)
}

return &protoapi.EstimateFeeResponse{
Fee: fee,
}, nil
}

func (t *tradingDataService) AssetByID(ctx context.Context, req *protoapi.AssetByIDRequest) (*protoapi.AssetByIDResponse, error) {
if len(req.ID) <= 0 {
return nil, apiError(codes.InvalidArgument, errors.New("missing ID"))
Expand Down Expand Up @@ -1408,23 +1430,6 @@ func (t *tradingDataService) OrderByID(ctx context.Context, in *protoapi.OrderBy
return nil, ErrOrderNotFound
}

func (t *tradingDataService) OrderByReferenceID(ctx context.Context, in *protoapi.OrderByReferenceIDRequest) (*types.Order, error) {
startTime := vegatime.Now()
defer metrics.APIRequestAndTimeGRPC("OrderByReferenceID", startTime)
if len(in.ReferenceID) == 0 {
// Invalid parameter
return nil, ErrMissingReferenceIDParameter
}

order, err := t.OrderService.GetByReference(ctx, in.ReferenceID)
if err != nil {
return nil, err
}

// If we get here we have matched against referenceID and all is good
return order, nil
}

// OrderVersionsByID returns all versions of the order by its orderID
func (t *tradingDataService) OrderVersionsByID(
ctx context.Context,
Expand Down
3 changes: 3 additions & 0 deletions api/trading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"code.vegaprotocol.io/vega/broker"
"code.vegaprotocol.io/vega/candles"
"code.vegaprotocol.io/vega/config"
"code.vegaprotocol.io/vega/fee"
"code.vegaprotocol.io/vega/governance"
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/markets"
Expand Down Expand Up @@ -241,6 +242,7 @@ func getTestGRPCServer(

aplugin := plugins.NewAsset(context.Background())
assetService := assets.NewService(logger, conf.Assets, aplugin)
feeService := fee.NewService(logger, conf.Execution.Fee, marketStore)

evtfwd := mocks.NewMockEvtForwarder(mockCtrl)

Expand All @@ -262,6 +264,7 @@ func getTestGRPCServer(
notaryService,
evtfwd,
assetService,
feeService,
monitoring.New(logger, monitoring.NewDefaultConfig(), blockchainClient),
)
if g == nil {
Expand Down
Loading

0 comments on commit 4d4cb8b

Please sign in to comment.