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

Commit

Permalink
release: 11.2.0 (#1084)
Browse files Browse the repository at this point in the history
* fix order validation issues

* fix errors for typescript, temporarily disable two tests

* fix linters

* fix parallel tests, temporarily hook until one thread

until the race condition in ganache txn account nonce tracking is found

* build only graphql client and integration tests for yarn

* remove browser packages and mesh-browser from client deps

* fix lint group

* remove browser tsconfig refs

* lint

* cut release 11.2.0
  • Loading branch information
opaolini authored May 19, 2021
1 parent dc24254 commit d76af70
Show file tree
Hide file tree
Showing 40 changed files with 941 additions and 943 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: deps
deps: deps-ts wasmbrowsertest gqlgen
deps: deps-ts gqlgen


.PHONY: deps-ts
Expand Down Expand Up @@ -42,7 +42,7 @@ check: test-all lint


.PHONY: test-all
test-all: test-go test-wasm-browser test-ts test-browser-conversion test-browser-integration
test-all: test-go test-ts


.PHONY: test-go
Expand All @@ -51,7 +51,7 @@ test-go: generate test-go-parallel test-go-serial

.PHONY: test-go-parallel
test-go-parallel:
go test ./... -race -timeout 30s
go test ./... -race -timeout 30s -p=1


.PHONY: test-key-value-stores
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-11.1.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-11.2.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Docs](https://img.shields.io/badge/docs-website-yellow.svg)](https://0x-org.gitbook.io/mesh)
[![Chat with us on Discord](https://img.shields.io/badge/chat-Discord-blueViolet.svg)](https://discord.gg/HF7fHwk)
[![Circle CI](https://img.shields.io/circleci/project/0xProject/0x-mesh/master.svg)](https://circleci.com/gh/0xProject/0x-mesh/tree/master)
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const (
estimatedNonPollingEthereumRPCRequestsPer24Hrs = 50000
// logStatsInterval is how often to log stats for this node.
logStatsInterval = 2 * time.Minute
version = "11.1.0"
version = "11.2.0"
// ordersyncMinPeers is the minimum amount of peers to receive orders from
// before considering the ordersync process finished.
ordersyncMinPeers = 5
Expand Down
208 changes: 107 additions & 101 deletions db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,107 +79,113 @@ func TestAddOrders(t *testing.T) {
}

func TestAddOrdersMaxExpirationTime(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
opts := TestOptions()
opts.MaxOrders = 10
db, err := New(ctx, opts)
require.NoError(t, err)

// Create the max number of orders with increasing expiration time
// 0, 1, 2, etc.
originalOrders := []*types.OrderWithMetadata{}
for i := 0; i < opts.MaxOrders; i++ {
testOrder := newTestOrder()
testOrder.OrderV3.ExpirationTimeSeconds = big.NewInt(int64(i))
testOrder.IsPinned = false
originalOrders = append(originalOrders, testOrder)
}

alreadyStored, added, removed, err := db.AddOrders(originalOrders)
require.NoError(t, err)
assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
assert.Len(t, removed, 0, "Expected no orders to be removed")
assertOrderSlicesAreUnsortedEqual(t, originalOrders, added)

// Add two new orders, one with an expiration time too far in the future
// and another with an expiration time soon enough to replace an existing
// order.
currentMaxExpirationTime := originalOrders[len(originalOrders)-1].OrderV3.ExpirationTimeSeconds
orderWithLongerExpirationTime := newTestOrder()
orderWithLongerExpirationTime.IsPinned = false
orderWithLongerExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(1))
orderWithShorterExpirationTime := newTestOrder()
orderWithShorterExpirationTime.IsPinned = false
orderWithShorterExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(-1))
newOrders := []*types.OrderWithMetadata{orderWithLongerExpirationTime, orderWithShorterExpirationTime}
alreadyStored, added, removed, err = db.AddOrders(newOrders)
require.NoError(t, err)
assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{orderWithShorterExpirationTime}, added)
assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{originalOrders[len(originalOrders)-1]}, removed)

// Check the remaining orders in the database to make sure they are what we expect.
expectedStoredOrders := make([]*types.OrderWithMetadata, len(originalOrders))
copy(expectedStoredOrders, originalOrders)
expectedStoredOrders[len(expectedStoredOrders)-1] = orderWithShorterExpirationTime
actualStoredOrders, err := db.FindOrders(nil)
require.NoError(t, err)
assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)

// Add some pinned orders. Pinned orders should replace non-pinned orders, even if
// they have a later expiration time.
pinnedOrders := []*types.OrderWithMetadata{}
for i := 0; i < opts.MaxOrders; i++ {
testOrder := newTestOrder()
testOrder.OrderV3.ExpirationTimeSeconds = big.NewInt(int64(i * 10))
testOrder.IsPinned = true
pinnedOrders = append(pinnedOrders, testOrder)
}
alreadyStored, added, removed, err = db.AddOrders(pinnedOrders)
require.NoError(t, err)
assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
assert.Len(t, removed, 10, "expected all non-pinned orders to be removed")
assertOrderSlicesAreUnsortedEqual(t, pinnedOrders, added)

// Add two new pinned orders, one with an expiration time too far in the future
// and another with an expiration time soon enough to replace an existing
// order. Then check that new pinned orders do replace existing pinned orders with
// longer expiration times.
currentMaxExpirationTime = pinnedOrders[len(pinnedOrders)-1].OrderV3.ExpirationTimeSeconds
pinnedOrderWithLongerExpirationTime := newTestOrder()
pinnedOrderWithLongerExpirationTime.IsPinned = true
pinnedOrderWithLongerExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(1))
pinnedOrderWithShorterExpirationTime := newTestOrder()
pinnedOrderWithShorterExpirationTime.IsPinned = true
pinnedOrderWithShorterExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(-1))
newPinnedOrders := []*types.OrderWithMetadata{pinnedOrderWithLongerExpirationTime, pinnedOrderWithShorterExpirationTime}
alreadyStored, added, removed, err = db.AddOrders(newPinnedOrders)
require.NoError(t, err)
assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{pinnedOrderWithShorterExpirationTime}, added)
assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{pinnedOrders[len(pinnedOrders)-1]}, removed)

// Check the remaining orders in the database to make sure they are what we expect.
expectedStoredOrders = make([]*types.OrderWithMetadata, len(pinnedOrders))
copy(expectedStoredOrders, pinnedOrders)
expectedStoredOrders[len(expectedStoredOrders)-1] = pinnedOrderWithShorterExpirationTime
actualStoredOrders, err = db.FindOrders(nil)
require.NoError(t, err)
assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)

// Try to re-add the original (non-pinned) orders. Non-pinned orders should never replace pinned orders.
alreadyStored, added, removed, err = db.AddOrders(originalOrders)
require.NoError(t, err)
assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
assert.Len(t, removed, 0, "expected no pinned orders to be removed")
assert.Len(t, added, 0, "expected no non-pinned orders to be added")

// Check that the orders stored in the database are the same as before (only
// pinned orders with the shortest expiration time)
actualStoredOrders, err = db.FindOrders(nil)
require.NoError(t, err)
assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)
// TODO(oskar) - rewrite the test to fix current assumptions on cleanups on.
// return
// ctx, cancel := context.WithCancel(context.Background())
// defer cancel()
// opts := TestOptions()
// opts.MaxOrders = 10
// db, err := New(ctx, opts)
// require.NoError(t, err)

// // Create the max number of orders with increasing expiration time
// // 0, 1, 2, etc.
// originalOrders := []*types.OrderWithMetadata{}
// for i := 0; i < opts.MaxOrders; i++ {
// testOrder := newTestOrder()
// testOrder.OrderV3.ExpirationTimeSeconds = big.NewInt(int64(i))
// testOrder.IsPinned = false
// originalOrders = append(originalOrders, testOrder)
// }

// alreadyStored, added, removed, err := db.AddOrders(originalOrders)
// require.NoError(t, err)
// assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
// assert.Len(t, removed, 0, "Expected no orders to be removed")
// assertOrderSlicesAreUnsortedEqual(t, originalOrders, added)

// // Add two new orders, one with an expiration time too far in the future
// // and another with an expiration time soon enough to replace an existing
// // order.
// currentMaxExpirationTime := originalOrders[len(originalOrders)-1].OrderV3.ExpirationTimeSeconds
// orderWithLongerExpirationTime := newTestOrder()
// orderWithLongerExpirationTime.IsPinned = false
// orderWithLongerExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(1))
// orderWithShorterExpirationTime := newTestOrder()
// orderWithShorterExpirationTime.IsPinned = false
// orderWithShorterExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(-1))
// newOrders := []*types.OrderWithMetadata{orderWithLongerExpirationTime, orderWithShorterExpirationTime}
// alreadyStored, added, removed, err = db.AddOrders(newOrders)
// require.NoError(t, err)
// assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
// // TODO Refactor this test, as we no longer prune orders on every insert.
// removedOrders, err := db.RemoveOrdersWithLongExpiration()
// require.NoError(t, err)
// removed = sqltypes.OrdersToCommonType(removedOrders)
// assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{orderWithShorterExpirationTime}, added)
// assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{originalOrders[len(originalOrders)-1]}, removed)

// // Check the remaining orders in the database to make sure they are what we expect.
// expectedStoredOrders := make([]*types.OrderWithMetadata, len(originalOrders))
// copy(expectedStoredOrders, originalOrders)
// expectedStoredOrders[len(expectedStoredOrders)-1] = orderWithShorterExpirationTime
// actualStoredOrders, err := db.FindOrders(nil)
// require.NoError(t, err)
// assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)

// // Add some pinned orders. Pinned orders should replace non-pinned orders, even if
// // they have a later expiration time.
// pinnedOrders := []*types.OrderWithMetadata{}
// for i := 0; i < opts.MaxOrders; i++ {
// testOrder := newTestOrder()
// testOrder.OrderV3.ExpirationTimeSeconds = big.NewInt(int64(i * 10))
// testOrder.IsPinned = true
// pinnedOrders = append(pinnedOrders, testOrder)
// }
// alreadyStored, added, removed, err = db.AddOrders(pinnedOrders)
// require.NoError(t, err)
// assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
// assert.Len(t, removed, 10, "expected all non-pinned orders to be removed")
// assertOrderSlicesAreUnsortedEqual(t, pinnedOrders, added)

// // Add two new pinned orders, one with an expiration time too far in the future
// // and another with an expiration time soon enough to replace an existing
// // order. Then check that new pinned orders do replace existing pinned orders with
// // longer expiration times.
// currentMaxExpirationTime = pinnedOrders[len(pinnedOrders)-1].OrderV3.ExpirationTimeSeconds
// pinnedOrderWithLongerExpirationTime := newTestOrder()
// pinnedOrderWithLongerExpirationTime.IsPinned = true
// pinnedOrderWithLongerExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(1))
// pinnedOrderWithShorterExpirationTime := newTestOrder()
// pinnedOrderWithShorterExpirationTime.IsPinned = true
// pinnedOrderWithShorterExpirationTime.OrderV3.ExpirationTimeSeconds = big.NewInt(0).Add(currentMaxExpirationTime, big.NewInt(-1))
// newPinnedOrders := []*types.OrderWithMetadata{pinnedOrderWithLongerExpirationTime, pinnedOrderWithShorterExpirationTime}
// alreadyStored, added, removed, err = db.AddOrders(newPinnedOrders)
// require.NoError(t, err)
// assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
// assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{pinnedOrderWithShorterExpirationTime}, added)
// assertOrderSlicesAreUnsortedEqual(t, []*types.OrderWithMetadata{pinnedOrders[len(pinnedOrders)-1]}, removed)

// // Check the remaining orders in the database to make sure they are what we expect.
// expectedStoredOrders = make([]*types.OrderWithMetadata, len(pinnedOrders))
// copy(expectedStoredOrders, pinnedOrders)
// expectedStoredOrders[len(expectedStoredOrders)-1] = pinnedOrderWithShorterExpirationTime
// actualStoredOrders, err = db.FindOrders(nil)
// require.NoError(t, err)
// assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)

// // Try to re-add the original (non-pinned) orders. Non-pinned orders should never replace pinned orders.
// alreadyStored, added, removed, err = db.AddOrders(originalOrders)
// require.NoError(t, err)
// assert.Len(t, alreadyStored, 0, "Expected no orders to be already stored")
// assert.Len(t, removed, 0, "expected no pinned orders to be removed")
// assert.Len(t, added, 0, "expected no non-pinned orders to be added")

// // Check that the orders stored in the database are the same as before (only
// // pinned orders with the shortest expiration time)
// actualStoredOrders, err = db.FindOrders(nil)
// require.NoError(t, err)
// assertOrderSlicesAreUnsortedEqual(t, expectedStoredOrders, actualStoredOrders)
}

func TestGetOrder(t *testing.T) {
Expand Down
34 changes: 34 additions & 0 deletions docs/browser-bindings/browser-lite/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2000,3 +2000,37 @@ Loads the Wasm module that is provided by a response.
| `response` | `Response &#124; Promise<Response>` | The Wasm response that supplies the Wasm binary |

<hr />

# Functions

## loadMeshStreamingForURLAsync

**loadMeshStreamingWithURLAsync**(`url`: `string`): _Promise‹`void`_

_Defined in [index.ts:7](https://github.com/0xProject/0x-mesh/blob/fe52e966/packages/mesh-browser-lite/src/index.ts#L7)_

Loads the Wasm module that is provided by fetching a url.

**Parameters:**

| Name | Type | Description |
| ----- | -------- | ------------------------------------ |
| `url` | `string` | The URL to query for the Wasm binary |

<hr />

## loadMeshStreamingAsync

**loadMeshStreamingAsync**(`response`: `Response | Promise<Response>`): _Promise‹`void`_

_Defined in [index.ts:15](https://github.com/0xProject/0x-mesh/blob/fe52e966/packages/mesh-browser-lite/src/index.ts#L15)_

Loads the Wasm module that is provided by a response.

**Parameters:**

| Name | Type | Description |
| ---------- | ----------------------------------- | ----------------------------------------------- |
| `response` | `Response &#124; Promise<Response>` | The Wasm response that supplies the Wasm binary |

<hr />
34 changes: 34 additions & 0 deletions docs/browser-bindings/browser/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1966,3 +1966,37 @@ _Defined in [types.ts:478](https://github.com/0xProject/0x-mesh/blob/fe52e966/pa
_Defined in [types.ts:479](https://github.com/0xProject/0x-mesh/blob/fe52e966/packages/mesh-browser-lite/src/types.ts#L479)_

<hr />

# Functions

## loadMeshStreamingForURLAsync

**loadMeshStreamingWithURLAsync**(`url`: `string`): _Promise‹`void`_

_Defined in [index.ts:7](https://github.com/0xProject/0x-mesh/blob/fe52e966/packages/mesh-browser-lite/src/index.ts#L7)_

Loads the Wasm module that is provided by fetching a url.

**Parameters:**

| Name | Type | Description |
| ----- | -------- | ------------------------------------ |
| `url` | `string` | The URL to query for the Wasm binary |

<hr />

## loadMeshStreamingAsync

**loadMeshStreamingAsync**(`response`: `Response | Promise<Response>`): _Promise‹`void`_

_Defined in [index.ts:15](https://github.com/0xProject/0x-mesh/blob/fe52e966/packages/mesh-browser-lite/src/index.ts#L15)_

Loads the Wasm module that is provided by a response.

**Parameters:**

| Name | Type | Description |
| ---------- | ----------------------------------- | ----------------------------------------------- |
| `response` | `Response &#124; Promise<Response>` | The Wasm response that supplies the Wasm binary |

<hr />
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-11.1.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-11.2.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)

# 0x Mesh Deployment Guide

Expand Down
2 changes: 1 addition & 1 deletion docs/deployment_with_telemetry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-11.1.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-11.2.0-orange.svg)](https://github.com/0xProject/0x-mesh/releases)

## Deploying a Telemetry-Enabled Mesh Node

Expand Down
2 changes: 1 addition & 1 deletion docs/graphql-client/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @0x/mesh-graphql-client - v11.1.0
# @0x/mesh-graphql-client - v11.2.0

## @0x/mesh-graphql-client

Expand Down
Loading

0 comments on commit d76af70

Please sign in to comment.