Skip to content

Commit

Permalink
Release 10.0.0 (#929)
Browse files Browse the repository at this point in the history
* Addressed minor comments from the last release PR (#817)

* Upgrade Mesh to Go 1.14 (#815)

* Made changes necessary for native binaries to build

* Document go-ethereum dependecy

* Got go tests to pass

* Updated geth fork to get some wasm tests to pass

* Fixed some build errors and tests

* Documented the `goleveldb` dependency

* Updated goleveldb and go-ws-transport

* All WebAssembly tests are now passing -- with the wrong `wasm_exec.ts`

* Update CI and dockerfiles

* Fix go linting errors

* Fix linting in CI

* Remove vendor step in CI to try to fix linting issues

* Documented the change in vendoring in CI

* Updated goleveldb dep after switching to `IsUndefined` and `IsNull`

* Updated go-ws-transport after switching to `IsUndefined`

* Switched to `IsUndefined` and `IsNull`

* Updated changelog

* Reverted some unnecessary changes

* Moved `allowJs` into `@0x/mesh-browser-lite`'s `tsconfig.json`

* Update to typescript `3.9.3`

* Update geth dependency

* Update `parseTopics` to use the new version from geth

* Addressed review feedback from @albrow

* Updated geth again

* Updated geth another time

* Fixed `wasm_exec.js` after rebase

* Changes to deps after rebuilding

* Updated the contributing guide

* Updated webpack-example dependendencies

* Fixed small inconsistency in contributing guide

* Improves the DevEx of working on Typescript (#818)

* Adjust the way that local dependencies are linked

* Improved `yarn clean`

* Added `prettier` to Mesh

* Updated cut-release script

* Build dependencies automatically when building a single package

* Make browser integration tests more effecient

* Update CONTRIBUTING.md

* Add some files to .prettierignore

* Change tsconfig for two examples to output to lib

* Add note to CONTRIBUTING.md about TSLint configuration

* Remove  from package.json

* Fixed nits

* Remove `$PKG`

* Fix tsc -b at the root of the project

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* Big database upgrade (#793)

* Strip out all existing database code

* rename meshdb package to db

* Implement first db tests for adding/finding orders

* Add basic support for Orders and MiniHeaders

* Implement and test UpdateOrder

* Implement sorting orders

* Imlpement and test limit and offset

* Implement and test filters for finding orders

* Add fields for parsed MakerAssetData and MakerFeeAssetData

* Add test cases for filtering based on parsed maker asset data

* Implement and test helper methods for filtering based on parsed asset data

* Rename some FilterOpts fields

* Remove unneeded quotes

* Add OF prefix to OrderField constants

* Implement and test MiniHeaders query options

* Implement and test deleting orders with a filter

* Implement and test DeleteOrder

* Refactor db package to use common/types

* Implement and test deleting miniHeaders. Adjust implementation of DeleteOrders

* Update all types. Fix build

* Automatically remove miniHeaders above retention limit

* Add new options for database to configure max mini headers

* Get all blockwatch tests passing 😄

* Add new db options

* Implement and test CountOrders

* Begin fixing some bugs in order watcher tests

* Uncomment all remaining orderwatcher tests (except max expiration)

* Implement and test metadata methods

* Fix bug in sqltypes.BigInt. Get ratelimit tests passing

* Fix some additional tests and unimplemented methods in core

* Implement core.GetStats. Move data dir for most integration tests to /tmp

* Implement new getOrders RPC endpoint

* Re-enable ordersync tests

* Remove expirationwatch package

* Return db.ErrNotFound where appropriate. Remove old TODOs

* Set up basic skeleton for Dexie.js implementation

* Implement most order methods in Dexie.js

Not implemented:

- Query filters
- Multiple sort parameters

* Fix bugs and add support for order queries with one filter

* Add support for multiple filters

* Use checkOrderQuery function for both Dexie and SQL

* Fix bug in SQL implementation involving big numbers

* Add support for multiple sort values in Dexie

* Implement AddMiniHeaders in Dexie

* Implement remaining MiniHeaders methods in Dexie

* Implement Metadata methods in Dexie

* Fix failing TypeScript and Wasm tests

* Fix some build issues

* Fix bug in OrderWatcher

* Fix failing conversion tests

* Fix any remaining failing tests

* Fix linter errors

* Fix build errors

* Update yarn.lock

* Add backwards compatibility layer for FilteredPaginationSubprotocol

* Re-use existing asset data decoder from orderwatcher

* Remove remaining uses of goleveldb

* Improve handling of db closed error

* Rename some identifiers

* Address some low hanging TODOs

* De-dupe and refactor DB test cases

* Change how context is passed in to core.App

* Add missing exit 0 to some clean commands

* Address remaining TODOs in sql_implementation

* Address remaining TODOs in database.ts

* Address remaining TODOs in order_watcher.go

* Minor changes and cleanup

* Fix yarn.lock

* Respond to PR feedback

* Fix bug in database.ts

* Address remaining PR feedback

* Address third round PR feedback

* Address review feedback part 4

* Fix linter

* Add benchmark for ValidateOrder (#819)

* Optimize InefficientlyConvertToJS (#820)

* Optmimize jsutil.InefficientlyConvertToJS

* Add missing build tag

* Update go.mod and go.sum

* Updated `prettier` to include all markdown files (#830)

* Updated `prettier` to ignore all markdown files

* Start running `prettier` on markdown

* Removed `RELEASE_CHANGELOG.md` generation

* Updated logrus dependency (#834)

* Add workaround for Dexie transaction-related errors (#835)

* Increased the `ratelimiter` tolerance (#836)

* Re-implement dynamic max expiration time (#832)

* Implement removing orders with longest expiration time in SQL

* Implement removing orders with longest expiration time in Dexie

* Implement first pass of setting max expiration time in orderwatcher

* Consider pinned orders correctly regarding max expiration time

* Tweak max expiration time behavior

* Add test for GetCurrentMaxExpirationTime

* Simplify implementation by removing slowCounter and calculating max exp time as needed

* Add clarifying comment

* Account for pinned orders in meshSpecificOrderValidation

* Slightly simplify orderwatch.Watcher.add based on PR feedback

* Include pinned order in TestOrderWatcherDecreaseExpirationTime

* Optimize FindMiniHeaders by using gob encoding for event logs (#840)

* Optimize FindMiniHeaders by using gob encoding for event logs

* Add test for MiniHeaderToCommonType and MiniHeaderFromCommonType

* Rename a variable

* Update mesh.ts (#842)

Fix issue where initial query for orderInfos can come back empty.

* Add prettier step to `make cut-release` (#845)

* Fixed small bug in the ws rpc client (#847)

* Directly compute packed length of RPC call (#846)

* Add computeOptimalChunkSizes benchmark

* computeABIEncodedSignedOrderByteLength without ABI encoding

* Move unused code to tests

* fmt

* Requested changes

* More requested changes

Co-authored-by: Mason Liang <mason@0x.org>

* Update TypeScript compiler target to es2016 (#850)

* Cleanup TypeScript packages (#851)

* Rename all packages/ directories to match package name

* Audit all dependencies vs. devDependencies

* Fix doc generation for browser and browser-lite

* Update removedChecker to use countInterval (#839)

* Update removedChecker to use countInterval

* gofmt

* Requested changes

* Revert using errgroup

Co-authored-by: Mason Liang <mason@0x.org>

* Parallelize requesting from peers in `ordersync` (#848)

* Parallelized part of `GetOrders`

* Added an inner context to cut `getOrdersFromPeer` short

* Refactored ordersync to request from a new peer as soon as possible

* Improved ordersync `GetOrders` slightly

* Adjusted `maxPeersInParallel`

* Addressed review feedback from @albrow

* Switched to `sync.RWMutex`

* Addressed lingering review feedback from @albrow

* Store order validation block (#853)

* Add support for storing block metadata for orders in db package

* Set block metadata for orders in order_watcher

* Improve tests for setting last validated block

* Add new fields to Order in database.ts

* Use errgroup (#852)

* Use errgroup

* Fixed data race

* SyncToLatestBlock to prevent race at cleanup

* Re-add logging for errors

* gofmt

* Remove now unneeded SyncToLatestBlock

* Add loop name to logging output

* Use correct names

* Add pointer to golang faq

Co-authored-by: Mason Liang <mason@0x.org>
Co-authored-by: Alex Towle <jalextowle@gmail.com>

* Simplify unexpiration logic in convertValidationResultsIntoOrderEvents (#856)

* Name and use isOrderUnexpired

* Use newFillableAmount

* Replace nil with newFillableAmount

* Consolidate checks for rewatchOrder

* Remove checks that are always true

* Move database updates into unexpiration check

* Rename to timeStampIsValid and remove unneeded check

* typos

* time stamp -> timestamp and correct comment

* Clarify comment

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* fix typo

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* Remove unused private function

* Remove nil check for non-nil argument

* Rename function

* Re-add comments

* Rename to expirationTimeIsValid

* Expand comment

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

Co-authored-by: Mason Liang <mason@0x.org>
Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* In-Memory Blockwatcher Syncing (#857)

* Added simplestack back to Mesh

* Use an in-memory stack for blockwatcher syncing

* Addressed review feedback from @albrow

* Simplified `getSubBlockRanges` in `ethereum/blockwatcher`

* Light refactors of the blockwatcher

* Addressed review feedback from @z2trillion

* Addressed review feedback from @albrow

* Revert "Light refactors of the blockwatcher"

This reverts commit 63caae9.

* Addressed lingering review feedback from @albrow

* Fix database is locked error (#873)

* Fix database is locked error

* Fix typo

* fix: Wait for high quality peers to fully respond during ordersync (#874)

* Added logs to ordersync

* Added more debugging logic

* Implemented fix to ordersync

* Removed logs and clarified some logic

* Addressed offline review feedback from @albrow

* Addressed review feedback from @z2trillion and @albrow

* fix: Mark an ordersync that yields zero orders unsuccessful (#875)

* Fixed an issue with `getOrdersFromPeer`

* Addressed review feedback from @albrow

* Address the missing order events edge case (#863)

* Added test for missing order events edge case

* Refactored `handleBlockEvents` in anticipation of the fix

* Attempted to fix the missing order events bug

* Minor refactors

* Got the test to pass

* Added another test for the missing block events fix

* Cleaned up the orderwatcher tests

* Added checks for missing events on startup

* Placate the linter

* Addressed review feedback from @albrow and @z2trillion

* Remove unnecessary `RLock` in `ValidateAndStoreValidOrders`

* Fixed a bug with order unexpiry

* Added the ability to track the progress of ordersyncing with peers (#877)

* Added the ability to track the progress of ordersyncing with peers

* Addressed review feedback from @albrow

* Check for already stored orders in a single batch (#878)

* Check for already stored orders in a single batch

* Use new method in orderwatcher

* Change return value for GetOrderStatuses to include fillable amount

* Implement GetOrderStatuses in SQL; Update log levels

* Made `MaxBytesPerSecond` configurable for standalone nodes (#879)

* Made `MaxBytesPerSecond` configurable for standalone nodes

* Made `MaxBytesPerSecond` configurable for browser nodes

* Fixed browser conversion tests for config with `MaxBytesPerSecond`

* Bump default of `MAX_BYTES_PER_SECOND` to 5MiB throughout the codebase

* Fix outdated comments

* Don't log about missing events if 0 blocks have elapsed (#880)

* Don't emit STOPPED_WATCHING events for orders that were already stored (#881)

* update drone configuration (#876)

* Optimize GetOrderStatuses by using getBulk (#883)

* Fixed bug in ordersync that caused nodes to use the wrong orderfilter (#882)

* Fixed bug in ordersync that caused nodes to use the wrong orderfilter

* Added changelog entry

* Addressed review feedback from @albrow

* Refactored first request generation in ordersync

* Fixed backwards compatability issue

* Addressed lingering review feedback from @albrow

* update deployment with telemetry doc with log opts (#887)

Co-authored-by: Oskar Paolini <oskar@paolini.pl>

* Fixed issue that crashed Mesh node (#888)

* Fixed issue that crashed Mesh node

* Addressed review feedback from @albrow

* Fixed a regression in `FilteredPaginationSubprotocolV0`

* Fixed bug that caused ordersync subprotocols to be selected at random

* Remove debugging logic

* Addressed review feedback from @albrow

* Fix bug when saving ordersync progress (#889)

* test: Added more tests for ordersync (#890)

* Added a test for orderfilter json encoding

* Added ordersync test for nodes with different filters

* Added ordersync test for receiving first request from old peer

* Fixed ordersync tests with distinct orderfilters

* Added another test case

* Cleaned up in anticipation of review

* Refactored orderfilter tests

* Addressed some review feedback from @albrow

* Apply suggestions from @albrow

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* Fixed issues caused by suggestions

* Fixed naming

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* Removed coordinator support (#895)

* Removed coordinator support

* Prettified the db syncing docs

* Unexported `batchOnchainValidation`

* fix: Prevent blockwatcher from missing contract events on startup (#894)

* Add existing miniheaders to simplestack during initialization

* Added a regression test for `blockwatch.New`

* Improved regression test

* Update ethereum/blockwatch/block_watcher_test.go

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>

* feature: Reject taker addresses that are nonzero and not on the whitelist (#896)

* Reject taker addresses that are nonzero and not on the whitelist

* Addressed review feedback

* Implement GraphQL API (#858)

* Create basic GraphQL server; implement stats query

* Implement order query

* Implement orders query

* Remove JSON-RPC API

* Fix CI

* Change types for some stats fields

* Remove references to JSON-RPC API from cut-release script

* Add GraphQL configuration options

* Update version of GraphiQL

* Use server.Shutdown for GraphQL server

* Use go-bindata to embed schema from text file

* Add graphql config file

* Install go-bindata in deps-no-lockfile

* Stub out remaining types and resolvers

* Switch to using gqlgen

* Set up new gqlgen server

* Re-implement resolvers

* Implement AddOrders

* Implement OrderEvents

* Implement AddOrders in client

* Implement and test Go client GetOrders without options

* Add test for more complicated GetOrders call

* Remove WIP TypeScript client code

* Implement and test Go client GetOrder

* Implement and test Go client GetStats

* Clean up GraphQL integration tests

* Implement basic working client with graphql-codegen

* Switch to using apollo client

* WIP subscriptions support

* Implement and test TypeScript client addOrdersAsync

* Implement and test TypeScript client getOrderAsync

* Implement and test TypeScript client onOrderEvents

* Remove ad hoc subscription test code

* Fix linter errors

* Implement and test TypeScript client getOrdersAsync

* Fix build error

* Remove old code related to typescript tests

* Implement and test TypeScript client rawQueryAsync

* Change env vars used for GraphQL integration tests

* Basic cleanup; remove old code and deps

* Cleanup types and file structure for TypeScript client

* Re-enable browser integration tests

* Add missing TSDoc comments

* Tweak environment variables.

* Remove old Go examples

* Add comment about mesh-bridge

* Update Dockerfiles

* Update documentation and comments

* Remove lingering references to coordinator error codes

* Improve error handling for TypeScript client subscriptions

* Address review feedback

* Fix failing TypeScript GraphQL client tests

* Update links in db_syncing.md

* Address PR feedback

* Throw all GraphQL errors in TypeScript client

* Use strings instead of custom scalars in GraphQL schema when possible (#906)

* Use strings instead of custom scalars in GraphQL schema when possible

* Add additional documentation to GraphQL schema

* Fix TypeScript GraphQL client

* Upgrade to go 1.15 (#911)

* Persistent DHT and Peerstore (#907)

* Implemented persistent datastore for peer and dht information in golang

* Implemented persistent key value store for the browser environment

* Finished the persistent storage solution

* Fixed all outstanding discrepancies between the dexie ds implementation and the tests

* Finalized new key store implementation

* Addressed issues uncovered during a personal review

* Addressed review feedback from @recmo

* Changed comment to prompt `ci/circleci:build`

* Added context as a parameter in `ethereum/blockwatch.Client` (#862)

* Added context to `ethereum/blockwatch.Client`

* Started changing approach

* Enable more linters (#861)

* Enable all default linters and fixed all errors

* Enable two more linters

* Added linter for `gofmt`

* Enables the `unparam` linter

* Added `make check`

* Fixed `deadcode` errors after rebase

* Fixed `misspell` errors after rebase

* Fixed `ineffassign` errors after rebase

* Fixed `unparam` errors after rebase

* Fixed `gosimple` errors after rebase

* Fixed `staticcheck` errors after rebase

* Addressed review feedback from @recmo

* Bump acorn from 6.3.0 to 6.4.1 in /packages/webpack-example-lite (#769)

Bumps [acorn](https://github.com/acornjs/acorn) from 6.3.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@6.3.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Updated some out of date references to Go 1.14 (#912)

* Bump jquery from 3.4.1 to 3.5.0 in /packages/browser-lite (#915)

Bumps [jquery](https://github.com/jquery/jquery) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/jquery/jquery/releases)
- [Commits](jquery/jquery@3.4.1...3.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Added missing entries to the changelog (#922)

* Updates yarn.lock files and adds dependabot configuration (#925)

* Remove unused yarn.lock files

* Added dependabot config that targets the development branch

* Converted dependabot configuration to v2 config

* Remove dependabot v1 config

* Re-generated yarn.lock file (#926)

* Upgraded Dockerfiles to go 1.15.2 (#927)

* Update `libp2p` dependencies (#921)

* Updated deps

* Got standalone nodes to be somewhat functional again

* Fixed "TestPeerDiscovery" for standalone nodes

* Fixed lingering networking issues

* Addressed linter errors

* Updated "go-libp2p" to fix the filters option

* Improved consistency of external APIs (#918)

* 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

* Updated an integration test to be version agnostic (#928)

* Updated an integration test to be version agnostic

* Made the Typescript integration tests version agnostic

* Cut release v10.0.0

Co-authored-by: Alex Browne <stephenalexbrowne@gmail.com>
Co-authored-by: Paul Gebheim <pgebheim@users.noreply.github.com>
Co-authored-by: z2trillion <z2trillion@users.noreply.github.com>
Co-authored-by: Mason Liang <mason@0x.org>
Co-authored-by: Oskar Paolini <oskar@paolini.pl>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
7 people committed Sep 23, 2020
1 parent 8123878 commit 0c1c0f3
Show file tree
Hide file tree
Showing 267 changed files with 34,857 additions and 54,570 deletions.
12 changes: 7 additions & 5 deletions .circleci/config.yml
Expand Up @@ -4,7 +4,7 @@ jobs:
environment:
BASH_ENV: ~/.nvm/nvm.sh
docker:
- image: circleci/golang:1.13.4-browsers
- image: circleci/golang:1.15-browsers
- image: 0xorg/ganache-cli:istanbul
environment:
VERSION: 6.2.4
Expand All @@ -28,13 +28,15 @@ jobs:
- run:
name: Install dependencies
command: make deps-no-lockfile
- run:
name: Vendor Go dependencies as a workaround for https://github.com/golangci/golangci-lint/issues/865
command: go mod vendor
- run:
name: Install Go linter
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2
command: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0
- run:
# NOTE(jalextowle): We previously vendored our dependencies to avoid
# this issue: https://github.com/golangci/golangci-lint/issues/825.
# Vendoring caused an issue where the output on CI was not the same as
# that locally, so it has been removed. This should be reevaluated if
# the issue reappears.
name: Run linters
command: make lint
- run:
Expand Down
10 changes: 5 additions & 5 deletions .drone.yml
@@ -1,5 +1,5 @@
kind: pipeline
type: docker
type: kubernetes
name: mesh

steps:
Expand All @@ -17,7 +17,7 @@ node_selector:
drone-builds: true
---
kind: pipeline
type: docker
type: kubernetes
name: mesh-bootstrap-autotag

steps:
Expand All @@ -35,7 +35,7 @@ node_selector:
drone-builds: true
---
kind: pipeline
type: docker
type: kubernetes
name: mesh-development

steps:
Expand All @@ -60,7 +60,7 @@ node_selector:
drone-builds: true
---
kind: pipeline
type: docker
type: kubernetes
name: mesh-bootstrap-development

steps:
Expand All @@ -85,7 +85,7 @@ node_selector:
drone-builds: true
---
kind: pipeline
type: docker
type: kubernetes
name: mesh-publish-release-notes

steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1,4 +1,4 @@
# Automatically collapse generated files in GitHub.
ethereum/wrappers/*.go linguist-generated=true
docs/json-rpc-clients/typescript/*.md linguist-generated=true
docs/graphql-clients/typescript/*.md linguist-generated=true

7 changes: 7 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
target-branch: "development"
6 changes: 3 additions & 3 deletions .gitignore
Expand Up @@ -12,9 +12,9 @@ yarn-error.log
*/**/yarn-error.log*
ganache.log
*/**/ganache.log*
packages/browser/src/generated
*/**/dist/**/*
!*/**/dist/index.html
packages/**/generated/**
*/**/*dist/**/*
!*/**/*dist/index.html
!integration-tests/data/standalone-0/keys/privKey
integration-tests/data/standalone-*/
integration-tests/data/bootstrap-0/p2p/
12 changes: 9 additions & 3 deletions .golangci.yml
@@ -1,5 +1,11 @@
linters:
disable-all: true
disable-all: false
enable:
- errcheck
- govet
# Finds repeated strings that could be made constants
- goconst
# Ensures that the code was formatted with `gofmt -s`
- gofmt
# Identifies commonly misspelled words
- misspell
# Identifies unused function parameters
- unparam
3 changes: 3 additions & 0 deletions .graphqlconfig
@@ -0,0 +1,3 @@
{
"schemaPath": "graphql/schema.graphql"
}
4 changes: 4 additions & 0 deletions .prettierignore
@@ -0,0 +1,4 @@
lib
ethereum/blockwatch/testdata
packages/**/generated/**
*.d.ts
323 changes: 168 additions & 155 deletions CHANGELOG.md

Large diffs are not rendered by default.

45 changes: 42 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -10,7 +10,7 @@ _outside_ of your `GOPATH`.
0x Mesh uses two main branches:

1. The `development` branch contains the latest (possibly unreleased) changes
and is not guaranteed to be stable.
and is not guaranteed to be stable.
2. The `master` branch contains the latest stable release.

If you intend to fork 0x Mesh and open a PR, you should work off of the
Expand All @@ -30,10 +30,10 @@ the dropdown menu in the GitHub UI to select `development`.
## Prerequisites

- [GNU Make](https://www.gnu.org/software/make/) If you are using a Unix-like OS, you probably already have this.
- [Go version 1.13.x](https://golang.org/dl/) (or use [the version manager called "g"](https://github.com/stefanmaric/g)).
- [Go version 1.15.x](https://golang.org/dl/) (or use [the version manager called "g"](https://github.com/stefanmaric/g)).
- [Node.js version >=11](https://nodejs.org/en/download/) (or use the [nvm version manager](https://github.com/creationix/nvm)).
- [Yarn package manager](https://yarnpkg.com/en/).
- [golangci-lint version 1.22.2](https://github.com/golangci/golangci-lint#install).
- [golangci-lint version 1.27.0](https://github.com/golangci/golangci-lint#install-golangci-lint).
- [Python](https://www.python.org/downloads/). (Many OSes already have this).
- [Google Chrome](https://www.google.com/chrome/). If you already have Google Chrome you typically don't need to do anything. On Ubuntu you can run `wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install`.
- A C compiler such as [GCC](https://gcc.gnu.org/) or [Clang](https://clang.llvm.org/). Some OSes will already have this. On Ubuntu you can run `sudo apt-get install build-essential`.
Expand All @@ -44,6 +44,20 @@ the dropdown menu in the GitHub UI to select `development`.
make deps
```

## Building TypeScript packages

Mesh contains some TypeScript packages, all of which are contained in a small monorepo in the **packages/** directory. Some
packages are published, and some are only used internally for development and testing.

To build all the TypeScript packages:

```
yarn build
```

You can also run `yarn build` inside of individual packages in order to just build that package and its dependencies. However,
changing any Go code will require running `yarn build` at the root of the project again.

## Running Tests

Some of the tests depend on having a test Ethereum node running. Before running
Expand Down Expand Up @@ -77,6 +91,7 @@ make test-all
```

### Potential Issues

The default maximum number of open files is too low in some operating systems
for the tests to be run successfully. If an error that reads like "Too many open files,"
it may be necessary to increase this limit. On Unix-like operating systems, the `ulimit`
Expand All @@ -99,6 +114,20 @@ available linters, run:
make lint
```

## Running prettier

0x Mesh uses a tool called [prettier](https://prettier.io/), which is a tool that
enforces a consistent style across the Typescript codebase. The continuous integration
pipeline will fail if Typescript code is not "prettified," so `prettier` must be run
to ensure that the code is properly formatted.

The prettier tool can be run using the following command from the top-level of the
0x-Mesh repository (outside of a directory inside **packages/**):

```bash
yarn prettier
```

## Managing Dependencies

Mesh uses [Go Modules](https://github.com/golang/go/wiki/Modules) for managing
Expand Down Expand Up @@ -144,3 +173,13 @@ following to your editor config:
// ...
}
```

### Prettier

Prettier configurations for most popular text editors can be found
[here](https://prettier.io/docs/en/editors.html).

### TSLint

TSLint configurations for most popular text editors can be found
[here](https://palantir.github.io/tslint/usage/third-party-tools/).
74 changes: 59 additions & 15 deletions Makefile
@@ -1,5 +1,5 @@
.PHONY: deps
deps: deps-ts wasmbrowsertest
deps: deps-ts wasmbrowsertest gqlgen


.PHONY: deps-ts
Expand All @@ -13,6 +13,13 @@ gobin:
GO111MODULE=off go get -u github.com/myitcv/gobin


# gqlgen is a tool for embedding files so that they are included in binaries.
# This installs the CLI for go-bindata.
.PHONY: gqlgen
gqlgen: gobin
gobin github.com/99designs/gqlgen@v0.11.3


# wasmbrowsertest is required for running WebAssembly tests in the browser.
.PHONY: wasmbrowsertest
wasmbrowsertest: gobin
Expand All @@ -21,45 +28,72 @@ wasmbrowsertest: gobin

# Installs dependencies without updating Gopkg.lock or yarn.lock
.PHONY: deps-no-lockfile
deps-no-lockfile: deps-ts-no-lockfile wasmbrowsertest
deps-no-lockfile: deps-ts-no-lockfile wasmbrowsertest gqlgen


.PHONY: deps-ts-no-lockfile
deps-ts-no-lockfile:
yarn install --frozen-lockfile


# Provides a pre-commit convenience command that runs all of the tests and the linters
.PHONY: check
check: test-all lint


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


.PHONY: test-go
test-go: test-go-parallel test-go-serial
test-go: generate test-go-parallel test-go-serial


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


.PHONY: test-key-value-stores
test-key-value-stores: test-key-value-stores-go test-key-value-stores-wasm


.PHONY: test-key-value-stores-go
test-key-value-stores-go:
ENABLE_KEY_VALUE_TESTS=true go test ./db


.PHONY: test-key-value-stores-wasm
test-key-value-stores-wasm:
WASM_INIT_FILE="$$(pwd)/packages/mesh-browser-shim/dist/browser_shim.js" GOOS=js GOARCH=wasm ENABLE_KEY_VALUE_TESTS=true go test ./db -timeout 30m -tags=browser -exec="$$GOPATH/bin/wasmbrowsertest"


.PHONY: test-go-serial
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
test-browser-conversion:
go test ./packages/browser/go/conversion-test -timeout 185s --enable-browser-conversion-tests -run BrowserConversions
go test ./packages/mesh-browser/go/conversion-test -timeout 185s --enable-browser-conversion-tests -run BrowserConversions


.PHONY: test-wasm-browser
test-wasm-browser:
WASM_INIT_FILE="$$(pwd)/packages/test-wasm/dist/browser_shim.js" GOOS=js GOARCH=wasm go test -tags=browser -exec="$$GOPATH/bin/wasmbrowsertest" ./...
WASM_INIT_FILE="$$(pwd)/packages/mesh-browser-shim/dist/browser_shim.js" GOOS=js GOARCH=wasm go test -tags=browser -exec="$$GOPATH/bin/wasmbrowsertest" ./...


.PHONY: test-ts
Expand All @@ -68,21 +102,30 @@ test-ts:


.PHONY: lint
lint: lint-go lint-ts
lint: lint-go lint-ts lint-prettier


.PHONY: lint-go
lint-go:
golangci-lint run
golangci-lint run --timeout 2m


.PHONY: lint-ts
lint-ts:
yarn lint

.PHONY: lint-prettier
lint-prettier:
yarn prettier:ci


.PHONY: generate
generate:
go generate ./...


.PHONY: mesh
mesh:
mesh: generate
go install ./cmd/mesh


Expand All @@ -102,7 +145,7 @@ db-integrity-check:


.PHONY: cut-release
cut-release:
cut-release: generate
go run ./cmd/cut-release/main.go


Expand All @@ -114,7 +157,7 @@ all: mesh mesh-keygen mesh-bootstrap db-integrity-check


.PHONY: docker-mesh
docker-mesh:
docker-mesh: generate
docker build . -t 0xorg/mesh -f ./dockerfiles/mesh/Dockerfile


Expand All @@ -129,5 +172,6 @@ docker-mesh-fluent-bit:


.PHONY: docker-mesh-bridge
docker-mesh-bridge:
docker build . -t 0xorg/mesh-bridge -f ./dockerfiles/mesh-bridge/Dockerfile
docker-mesh-bridge: generate
@echo 'WARN: mesh-bridge is currently disabled since it has not been updated to use the new GraphQL API'
# docker build . -t 0xorg/mesh-bridge -f ./dockerfiles/mesh-bridge/Dockerfile

0 comments on commit 0c1c0f3

Please sign in to comment.