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

Commit

Permalink
Merge pull request #522 from 0xProject/release/6.0.1-beta
Browse files Browse the repository at this point in the history
Release 6.0.1-beta
  • Loading branch information
albrow authored Nov 12, 2019
2 parents aac5bbe + f0ea864 commit 2512619
Show file tree
Hide file tree
Showing 36 changed files with 718 additions and 488 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
environment:
BASH_ENV: ~/.nvm/nvm.sh
docker:
- image: circleci/golang:1.12.9-browsers
- image: circleci/golang:1.12.13-browsers
- image: 0xorg/ganache-cli:latest
environment:
VERSION: 4.3.3
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This changelog is a work in progress and may contain notes for versions which have not actually been released. Check the [Releases](https://github.com/0xProject/0x-mesh/releases) page to see full release notes and more information about the latest released versions.

## v6.0.1-beta

### Bug fixes 🐞

- Fixed an oversight which granted immunity from bandwidth banning for any peer using a relayed connection ([#509](https://github.com/0xProject/0x-mesh/pull/509)).
- Fixed a typo in the `@0x/mesh-browser` package that resulted in some config options not being passed through correctly ([#502](https://github.com/0xProject/0x-mesh/pull/502)).
- Fixed a bug in ETH JSON-RPC rate limiter where not all dates were being properly converted to UTC, causing Mesh to malfunction if the local time was a day earlier or later than UTC. ([#505](https://github.com/0xProject/0x-mesh/pull/505))
- Fixed a bug in the TypeScript RPC client that prevented orders from being added ([#514](https://github.com/0xProject/0x-mesh/pull/514)).


## v6.0.0-beta

### Breaking changes 🛠
Expand Down Expand Up @@ -34,7 +44,7 @@ This changelog is a work in progress and may contain notes for versions which ha
- The `getStats` RPC endpoint now includes a new field which accounts for the number of orders that have been marked as "removed" but not yet permanently deleted ([#461](https://github.com/0xProject/0x-mesh/pull/461)).
- Improved historical order sharing using round-robin algorithm instead of random selection ([#454](https://github.com/0xProject/0x-mesh/pull/454)). This will reduce the warm-up time for receiving existing orders when first joining the network.
- Added ERC1155 assetData support ([#453](https://github.com/0xProject/0x-mesh/pull/453)). This includes order watching and order events for orders involving ERC1155 tokens.
- Added Ability to specify custom contract addresses via the `CUSTOM_ADDRESSES` environment variable or the `customAddresses` field in the TypeScript bindings ([#451](https://github.com/0xProject/0x-mesh/pull/451)).
- Added Ability to specify custom contract addresses via the `CUSTOM_ADDRESSES` environment variable or the `customAddresses` field in the TypeScript bindings ([#445](https://github.com/0xProject/0x-mesh/pull/445)).

### Bug fixes 🐞

Expand Down
42 changes: 24 additions & 18 deletions Gopkg.lock

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

17 changes: 11 additions & 6 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

[[constraint]]
name = "github.com/multiformats/go-multiaddr"
version = "0.0.4"
version = "0.1.2"

[[constraint]]
name = "github.com/libp2p/go-libp2p-pubsub"
Expand All @@ -87,7 +87,7 @@
[[override]]
name = "github.com/gballet/go-libpcsclite"
revision = "2fd9b619dd3c5d74acbd975f997a6441984d74a7"
[metadata]
[override.metadata]
note = "go-ethereum depends on this package and they made a breaking API change"

[[constraint]]
Expand All @@ -114,14 +114,13 @@
name = "github.com/libp2p/go-libp2p-discovery"
version = "0.1.0"

[[override]]
[[constraint]]
name = "github.com/libp2p/go-ws-transport"
source = "github.com/0xProject/go-ws-transport"
revision = "163cee1e07594cd148a9086cd3cce5f901e4dae9"
revision = "3098bba549e89efc42055199c2dca3d95ac70744"

[[constraint]]
name = "github.com/libp2p/go-libp2p-circuit"
version = "0.1.1"
version = "0.1.2"

[[constraint]]
name = "github.com/libp2p/go-libp2p-swarm"
Expand All @@ -142,3 +141,9 @@
[[constraint]]
branch = "master"
name = "github.com/benbjohnson/clock"

[[override]]
name = "github.com/libp2p/go-flow-metrics"
revision = "45424fab0a7cfaae9c5bdda0e590ee844c12b904"
[override.metadata]
note = "Fixes an issue with libp2p BandwidthCounter. See https://github.com/libp2p/go-libp2p-core/issues/65"
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-6.0.0--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-6.0.1--beta-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
9 changes: 6 additions & 3 deletions browser/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
go/
wasm/
scripts/
# Blacklist all files
.*
*
# Whitelist lib
!lib/**/*
# Package specific ignore
18 changes: 9 additions & 9 deletions browser/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ func convertConfig(jsConfig js.Value) (core.Config, error) {

// Default config options. Some might be overridden.
config := core.Config{
Verbosity: 2,
DataDir: "0x-mesh",
P2PTCPPort: 0,
P2PWebSocketsPort: 0,
UseBootstrapList: true,
BlockPollingInterval: 5 * time.Second,
EthereumRPCMaxContentLength: 524288,
Verbosity: 2,
DataDir: "0x-mesh",
P2PTCPPort: 0,
P2PWebSocketsPort: 0,
UseBootstrapList: true,
BlockPollingInterval: 5 * time.Second,
EthereumRPCMaxContentLength: 524288,
EthereumRPCMaxRequestsPer24HrUTC: 100000,
EthereumRPCMaxRequestsPerSecond: 30.0,
MaxOrdersInStorage: 100000,
EthereumRPCMaxRequestsPerSecond: 30,
MaxOrdersInStorage: 100000,
}

// Required config options
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/mesh-browser",
"version": "6.0.0-beta",
"version": "6.0.1-beta",
"description": "TypeScript and JavaScript bindings for running Mesh directly in the browser.",
"main": "./lib/index.js",
"license": "Apache-2.0",
Expand Down
26 changes: 14 additions & 12 deletions browser/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ export interface Config {
// Parity, feel free to double the default max in order to reduce the number
// of RPC calls made by Mesh. Defaults to 524288 bytes.
ethereumRPCMaxContentLength?: number;
// EthereumRPCMaxRequestsPer24HrUTC caps the number of Ethereum JSON-RPC requests a Mesh node will make
// per 24hr UTC time window (time window starts and ends at 12am UTC). It defaults to the 100k limit on
// Infura's free tier but can be increased well beyond this limit for those using alternative infra/plans.
EthereumRPCMaxRequestsPer24HrUTC?: number;
// EthereumRPCMaxRequestsPerSecond caps the number of Ethereum JSON-RPC requests a Mesh node will make per
// second. This limits the concurrency of these requests and prevents the Mesh node from getting rate-limited.
// It defaults to the recommended 30 rps for Infura's free tier, and can be increased to 100 rpc for pro users,
// and potentially higher on alternative infrastructure.
EthereumRPCMaxRequestsPerSecond?: number;
// A cap on the number of Ethereum JSON-RPC requests a Mesh node will make
// per 24hr UTC time window (time window starts and ends at 12am UTC). It
// defaults to the 100k limit on Infura's free tier but can be increased
// well beyond this limit for those using alternative infra/plans.
ethereumRPCMaxRequestsPer24HrUTC?: number;
// A cap on the number of Ethereum JSON-RPC requests a Mesh node will make
// per second. This limits the concurrency of these requests and prevents
// the Mesh node from getting rate-limited. It defaults to the recommended
// 30 rps for Infura's free tier, and can be increased to 100 rpc for pro
// users, and potentially higher on alternative infrastructure.
ethereumRPCMaxRequestsPerSecond?: number;
// A set of custom addresses to use for the configured network ID. The
// contract addresses for most common networks are already included by
// default, so this is typically only needed for testing on custom networks.
Expand All @@ -92,7 +94,7 @@ export interface Config {
// number of orders in storage grows, Mesh will begin enforcing a limit on
// maximum expiration time for incoming orders and remove any orders with an
// expiration time too far in the future. Defaults to 100,000.
maxOrdersInStorage ?: number;
maxOrdersInStorage?: number;
}

export interface ContractAddresses {
Expand Down Expand Up @@ -141,8 +143,8 @@ interface WrapperConfig {
bootstrapList?: string; // comma-separated string instead of an array of strings.
blockPollingIntervalSeconds?: number;
ethereumRPCMaxContentLength?: number;
EthereumRPCMaxRequestsPer24HrUTC?: number;
EthereumRPCMaxRequestsPerSecond?: number;
ethereumRPCMaxRequestsPer24HrUTC?: number;
ethereumRPCMaxRequestsPerSecond?: number;
customContractAddresses?: string; // json-encoded instead of Object.
maxOrdersInStorage?: number;
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cut-release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func updateHardCodedVersions(version string) {

// Update `docs/deployment_with_telemetry.md`
newVersionString = fmt.Sprintf(`image: 0xorg/mesh:%s`, version)
regex = `image: 0xorg/mesh:latest`
regex = `image: 0xorg/mesh:[0-9.]+.*`
updateFileWithRegex("docs/deployment_with_telemetry.md", regex, newVersionString)

// Update `CHANGELOG.md`
Expand Down
4 changes: 4 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ var UnlimitedExpirationTime *big.Int
func init() {
UnlimitedExpirationTime, _ = big.NewInt(0).SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10)
}

// MaxOrderSizeInBytes is the maximum number of bytes allowed for encoded orders. It
// is more than 10x the size of a typical ERC20 order to account for multiAsset orders.
const MaxOrderSizeInBytes = 8192
20 changes: 17 additions & 3 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ const (
checkNewAddrInterval = 20 * time.Second
expirationPollingInterval = 50 * time.Millisecond
rateLimiterCheckpointInterval = 1 * time.Minute
// Computed with default blockPollingInterval (5s), and EthereumRPCMaxRequestsPer24HrUTC (100k)
defaultNonPollingEthRPCRequestBuffer = 82720
// logStatsInterval is how often to log stats for this node.
logStatsInterval = 5 * time.Minute
version = "6.0.0-beta"
version = "6.0.1-beta"
)

// Note(albrow): The Config type is currently copied to browser/ts/index.ts. We
Expand Down Expand Up @@ -181,11 +183,23 @@ func New(config Config) (*App, error) {
}
log.AddHook(loghooks.NewPeerIDHook(peerID))

if config.EthereumRPCMaxContentLength < ordervalidator.MaxOrderSizeInBytes {
return nil, fmt.Errorf("Cannot set `EthereumRPCMaxContentLength` to be less then MaxOrderSizeInBytes: %d", ordervalidator.MaxOrderSizeInBytes)
if config.EthereumRPCMaxContentLength < constants.MaxOrderSizeInBytes {
return nil, fmt.Errorf("Cannot set `EthereumRPCMaxContentLength` to be less then MaxOrderSizeInBytes: %d", constants.MaxOrderSizeInBytes)
}
config = unquoteConfig(config)

// Ensure ETHEREUM_RPC_MAX_REQUESTS_PER_24_HR_UTC is reasonably set given BLOCK_POLLING_INTERVAL
per24HrPollingRequests := int((24 * time.Hour) / config.BlockPollingInterval)
minNumOfEthRPCRequestsIn24HrPeriod := per24HrPollingRequests + defaultNonPollingEthRPCRequestBuffer
if minNumOfEthRPCRequestsIn24HrPeriod > config.EthereumRPCMaxRequestsPer24HrUTC {
return nil, fmt.Errorf(
"Given BLOCK_POLLING_INTERVAL (%s), there are insufficient remaining ETH RPC requests in a 24hr period for Mesh to function properly. Increase ETHEREUM_RPC_MAX_REQUESTS_PER_24_HR_UTC to at least %d (currently configured to: %d)",
config.BlockPollingInterval,
minNumOfEthRPCRequestsIn24HrPeriod,
config.EthereumRPCMaxRequestsPer24HrUTC,
)
}

// Initialize db
databasePath := filepath.Join(config.DataDir, "db")
meshDB, err := meshdb.New(databasePath)
Expand Down
3 changes: 2 additions & 1 deletion core/message_handler.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package core

import (
"github.com/0xProject/0x-mesh/constants"
"github.com/0xProject/0x-mesh/meshdb"
"github.com/0xProject/0x-mesh/p2p"
"github.com/0xProject/0x-mesh/zeroex"
Expand Down Expand Up @@ -105,7 +106,7 @@ func (app *App) HandleMessages(messages []*p2p.Message) error {
log.WithFields(map[string]interface{}{
"error": err,
"from": msg.From,
"maxOrderSizeInBytes": ordervalidator.MaxOrderSizeInBytes,
"maxOrderSizeInBytes": constants.MaxOrderSizeInBytes,
"actualSizeInBytes": len(msg.Data),
}).Trace("received message that exceeds maximum size")
app.handlePeerScoreEvent(msg.From, psInvalidMessage)
Expand Down
6 changes: 3 additions & 3 deletions core/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/xeipuuv/gojsonschema"
)

var errMaxSize = fmt.Errorf("message exceeds maximum size of %d bytes", ordervalidator.MaxOrderSizeInBytes)
var errMaxSize = fmt.Errorf("message exceeds maximum size of %d bytes", constants.MaxOrderSizeInBytes)

// JSON-schema schemas
var (
Expand Down Expand Up @@ -214,7 +214,7 @@ func (app *App) validateOrders(orders []*zeroex.SignedOrder) (*ordervalidator.Va
}

func validateMessageSize(message *p2p.Message) error {
if len(message.Data) > ordervalidator.MaxOrderSizeInBytes {
if len(message.Data) > constants.MaxOrderSizeInBytes {
return errMaxSize
}
return nil
Expand All @@ -225,7 +225,7 @@ func validateOrderSize(order *zeroex.SignedOrder) error {
if err != nil {
return err
}
if len(encoded) > ordervalidator.MaxOrderSizeInBytes {
if len(encoded) > constants.MaxOrderSizeInBytes {
return errMaxSize
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/mesh-bootstrap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

# mesh-builder produces a statically linked binary
FROM golang:1.12.9-alpine3.9 as mesh-builder
FROM golang:1.12.13-alpine3.9 as mesh-builder


RUN apk update && apk add ca-certificates nodejs-current npm make git dep gcc build-base musl linux-headers
Expand Down
Loading

0 comments on commit 2512619

Please sign in to comment.