Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Improved consistency of external APIs (#918)
Browse files Browse the repository at this point in the history
* GetOrders => FindOrders

* Added graphql endpoints to MeshWrapper type in Typescript

* Expose dummy endpoints on the Go side of MeshWrapper

* Added testing for the browser GraphQL API

* Squashed some bugs throughout the plumbing pipeline

* DRYed a few things up

* Fixed the browser graphql integration test

* Cleaned up a bit

* Add missing "secondaryRendezvous" to GraphQL schema

* Addressed outstanding "FIXME" comments

* Altered the way that BrowserLink accesses the Mesh wrapper

* Updated "cut-release" make target

* Fixed compiler error after rebase

* Added changelog entry for GraphQL in the browser and fixed style of other v10 entries

* Addressed review feedback from @z2trillion
  • Loading branch information
jalextowle authored Sep 22, 2020
1 parent 2a49920 commit cf7e6fe
Show file tree
Hide file tree
Showing 31 changed files with 1,015 additions and 449 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ yarn-error.log
ganache.log
*/**/ganache.log*
packages/**/generated/**
*/**/dist/**/*
!*/**/dist/index.html
*/**/*dist/**/*
!*/**/*dist/index.html
!integration-tests/data/standalone-0/keys/privKey
integration-tests/data/standalone-*/
integration-tests/data/bootstrap-0/p2p/
23 changes: 12 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@ This changelog is a work in progress and may contain notes for versions which ha

### Breaking changes 🛠

- Reject orders that have taker addresses that are non-zero and are not whitelisted. [#896](https://github.com/0xProject/0x-mesh/pull/896).
- Removed support for Coordinator orders. [#895](https://github.com/0xProject/0x-mesh/pull/895).
- Reject orders that have taker addresses that are non-zero and are not whitelisted. [#896](https://github.com/0xProject/0x-mesh/pull/896)
- Removed support for Coordinator orders. [#895](https://github.com/0xProject/0x-mesh/pull/895)
- The JSON-RPC is no longer supported by Mesh nodes. Only a GraphQL API is supported. [#858](https://github.com/0xProject/0x-mesh/pull/858)

### Features ✅

- Upgraded to Go 1.15, which contains several WebAssembly performance improvements [#911](https://github.com/0xProject/0x-mesh/pull/911).
- Made MAX_BYTES_PER_SECOND configurable for non-bootstrap Mesh nodes. [#879](https://github.com/0xProject/0x-mesh/pull/879).
- Implemented GraphQL for Browser nodes. [#918](http://github.com/0xProject/0x-mesh/pull/918)
- Upgraded to Go 1.15, which contains several WebAssembly performance improvements [#911](https://github.com/0xProject/0x-mesh/pull/911)
- Made MAX_BYTES_PER_SECOND configurable for non-bootstrap Mesh nodes. [#879](https://github.com/0xProject/0x-mesh/pull/879)
- Added the ability for ordersync requestors to track the progress of individual ordersync connections in case connection is broken temporarily. [#877](https://github.com/0xProject/0x-mesh/pull/877)
- Implemented parallelization of ordersync requests. [#848](https://github.com/0xProject/0x-mesh/pull/848).
- Optimized the computation of optimal eth_call batch sizes for order validation. [#846](https://github.com/0xProject/0x-mesh/pull/846).
- Implemented more aggressive pruning for "removed" orders when database utilization is high [#839](https://github.com/0xProject/0x-mesh/pull/839).
- Optimizes conversions from Golang to Javascript. [#820](https://github.com/0xProject/0x-mesh/pull/820).
- Implemented new database solutions for both standalone and browser nodes. [#793](https://github.com/0xProject/0x-mesh/pull/793).
- Implemented parallelization of ordersync requests. [#848](https://github.com/0xProject/0x-mesh/pull/848)
- Optimized the computation of optimal eth_call batch sizes for order validation. [#846](https://github.com/0xProject/0x-mesh/pull/846)
- Implemented more aggressive pruning for "removed" orders when database utilization is high [#839](https://github.com/0xProject/0x-mesh/pull/839)
- Optimizes conversions from Golang to Javascript. [#820](https://github.com/0xProject/0x-mesh/pull/820)
- Implemented new database solutions for both standalone and browser nodes. [#793](https://github.com/0xProject/0x-mesh/pull/793)

### Bug fixes 🐞

- Implemented log rotation for telemetry deployments. This fixed an issue that would cause nodes with telemetry to crash after running out of disk space. [#887](https://github.com/0xProject/0x-mesh/pull/887).
- Implemented log rotation for telemetry deployments. This fixed an issue that would cause nodes with telemetry to crash after running out of disk space. [#887](https://github.com/0xProject/0x-mesh/pull/887)
- Stopped emitting STOPPED_WATCHING events for orders that were already stored. [#881](https://github.com/0xProject/0x-mesh/pull/881)
- Fixed an issue that caused ordersync responses of zero orders to be treated as unsuccessful. [#875](https://github.com/0xProject/0x-mesh/pull/875)
- Fixed a bug that would cause browser nodes to crash if "getOrdersAsync" was called before any orders were received. [#842](https://github.com/0xProject/0x-mesh/pull/842).
- Fixed a bug that would cause browser nodes to crash if "getOrdersAsync" was called before any orders were received. [#842](https://github.com/0xProject/0x-mesh/pull/842)

## v9.4.2

Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ test-key-value-stores-wasm:
test-go-serial:
go test ./zeroex/ordervalidator ./zeroex/orderwatch ./core -race -timeout 90s -p=1 --serial


.PHONY: test-browser-integration
test-browser-integration:
go test ./integration-tests -timeout 185s --enable-browser-integration-tests -run BrowserIntegration
test-browser-integration: test-browser-legacy-integration test-browser-graphql-integration


.PHONY: test-browser-legacy-integration
test-browser-legacy-integration:
go test ./integration-tests -timeout 60s --enable-browser-legacy-integration-tests -run BrowserLegacyIntegration


.PHONY: test-browser-graphql-integration
test-browser-graphql-integration:
go test ./integration-tests -timeout 60s --enable-browser-graphql-integration-tests -run BrowserGraphQLIntegration


.PHONY: test-browser-conversion
Expand Down
5 changes: 5 additions & 0 deletions cmd/cut-release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func updateHardCodedVersions(version string) {
// Update `packages/mesh-graphql-client/package.json`
tsClientPackageJSONPath := "packages/mesh-graphql-client/package.json"
updateFileWithRegex(tsClientPackageJSONPath, captureVersionString, newVersionString)
// NOTE(jalextowle): `@0x/mesh-browser` uses the local version of `@0x/mesh-browser-lite`
// on the `development` branch. Once the `@0x/mesh-browser-lite` package has been published,
// we need to update dependency in `@0x/mesh-browser` to published version.
updateFileWithRegex(tsClientPackageJSONPath, captureMeshBrowserLiteVersionString, newBrowserLiteDependencyString)

// Update `packages/mesh-browser-lite/package.json`
browserLitePackageJSONPath := "packages/mesh-browser-lite/package.json"
Expand All @@ -131,6 +135,7 @@ func updateHardCodedVersions(version string) {
// Update `packages/mesh-integration-tests/package.json`
integrationTestsPackageJSONPath := "packages/mesh-integration-tests/package.json"
updateFileWithRegex(integrationTestsPackageJSONPath, captureMeshBrowserVersionString, newBrowserDependencyString)
updateFileWithRegex(integrationTestsPackageJSONPath, `"@0x/mesh-graphql-client": "(.*)"`, fmt.Sprintf(`"@0x/mesh-graphql-client": "^%s"`, version))

// Update `packages/mesh-browser-shim/package.json`
testWasmPackageJSONPath := "packages/mesh-browser-shim/package.json"
Expand Down
6 changes: 3 additions & 3 deletions graphql/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ func (c *Client) GetOrder(ctx context.Context, hash common.Hash) (*OrderWithMeta
return orderWithMetadataFromGQLType(resp.Order), nil
}

// GetOrdersOpts is a set of options for the GetOrders method. They can
// FindOrdersOpts is a set of options for the FindOrders method. They can
// be omitted in order to use the defaults.
type GetOrdersOpts struct {
type FindOrdersOpts struct {
// TODO(albrow): Document fields.
Filters []OrderFilter
Sort []OrderSort
Limit int
}

func (c *Client) GetOrders(ctx context.Context, opts ...GetOrdersOpts) ([]*OrderWithMetadata, error) {
func (c *Client) FindOrders(ctx context.Context, opts ...FindOrdersOpts) ([]*OrderWithMetadata, error) {
req := graphql.NewRequest(ordersQuery)

if len(opts) > 0 {
Expand Down
77 changes: 77 additions & 0 deletions graphql/generated/generated.go

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

1 change: 1 addition & 0 deletions graphql/gqltypes/conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func StatsFromCommonType(stats *types.Stats) *Stats {
StartOfCurrentUTCDay: stats.StartOfCurrentUTCDay.Format(time.RFC3339),
EthRPCRequestsSentInCurrentUTCDay: stats.EthRPCRequestsSentInCurrentUTCDay,
EthRPCRateLimitExpiredRequests: int(stats.EthRPCRateLimitExpiredRequests),
SecondaryRendezvous: stats.SecondaryRendezvous,
MaxExpirationTime: stats.MaxExpirationTime.String(),
}
}
Expand Down
1 change: 1 addition & 0 deletions graphql/gqltypes/types_generated.go

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

1 change: 1 addition & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type Stats {
startOfCurrentUTCDay: String!
ethRPCRequestsSentInCurrentUTCDay: Int!
ethRPCRateLimitExpiredRequests: Int!
secondaryRendezvous: [String!]!
"""
The max expiration time expressed as seconds since the Unix Epoch and encoded as a numerical string.
Any order with an expiration time greater than this maximum will be rejected by Mesh.
Expand Down
Loading

0 comments on commit cf7e6fe

Please sign in to comment.