Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orderwatch,core,blockwatch: Improve Order Event subscription stability #566

Merged
merged 65 commits into from Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
68a8de2
Update Gopkg.lock
fabioberger Nov 29, 2019
aaac163
Move encoding into a separate package
fabioberger Nov 29, 2019
7111983
Clarify the ordering of the headers returned from FindAllMiniHeadersS…
fabioberger Nov 29, 2019
9553176
Set all salts to current timestamp in nanoseconds in scenarios to gua…
fabioberger Nov 29, 2019
87ff0e3
Refactor scenarios so that CreateSignedTestOrderWithExpirationTime re…
fabioberger Nov 29, 2019
f03df52
Make order re-validations async, occur at specific block numbers, fix…
fabioberger Nov 29, 2019
0bdc973
Handle returned errors
fabioberger Nov 29, 2019
9323648
Remove unnecessary methods and rename others for clarity
fabioberger Nov 30, 2019
9f41578
Rename method for clarity
fabioberger Nov 30, 2019
61b10d9
Improve comment
fabioberger Nov 30, 2019
b65ded1
Add comment for clarity
fabioberger Nov 30, 2019
0fb20b2
Ensure that we only catch up on order events for newly added order up…
fabioberger Nov 30, 2019
330934c
Add CHANGELOG entries
fabioberger Nov 30, 2019
2a438d4
Don't stop blockWatcher in orderWatcher tests so that we fine-grained…
fabioberger Dec 1, 2019
8823e9d
Add test ensuring that ADDED order events are batch emitted when batc…
fabioberger Dec 1, 2019
4823833
Fix comments
fabioberger Dec 1, 2019
bd1d1ff
Fix error string so that hash values are hex encoded and readable
fabioberger Dec 1, 2019
f7b352d
Add tests for whitelist functionality on handleBlockEvents method for…
fabioberger Dec 1, 2019
e9f7b63
Add test for backfilling order events for blocks processed while vali…
fabioberger Dec 2, 2019
0d043b3
relax the delta allowed to reduce ci failures
fabioberger Dec 2, 2019
ebf7452
Increase max expected delay to match min expected delay
fabioberger Dec 2, 2019
25925eb
Use Ganache-cli image with keepAliveTimeout extended to 40sec
fabioberger Dec 2, 2019
86b7ff5
Set ganache-cli docker image to latest release
fabioberger Dec 2, 2019
83980ed
signal that AtLeastOneBlockProcessed in SyncToLatestBlock before emit…
fabioberger Dec 2, 2019
2e5e5a6
Increase block polling interval in integration tests so that at least…
fabioberger Dec 2, 2019
43d7448
Add sleep after creating order to allow time for Mesh to sync to the …
fabioberger Dec 2, 2019
32e5e71
Fix docs to align with new order events subscription behavior
fabioberger Dec 2, 2019
f53bc66
Improve comments about each OrderEventEndState
fabioberger Dec 2, 2019
c181bdd
Rename ErrMaxSize to ErrMaxMessageSize for clarity
fabioberger Dec 3, 2019
422edfd
Rename methods Encode and Decode for clarity
fabioberger Dec 3, 2019
12222c1
Store lastRevalidatedBlockNumber in DB as int64 since a 64 bit intege…
fabioberger Dec 4, 2019
c320379
Add comment explicitly stating that if order not found in DB, we proc…
fabioberger Dec 4, 2019
85387dd
Fix rebase conflicts
fabioberger Dec 4, 2019
56b577a
Pass context into ValidateAndStoreValidOrders so that it's RPC reques…
fabioberger Dec 4, 2019
6f1abac
Simplify comments
fabioberger Dec 4, 2019
6d3ff05
Add comment explaining why we move valid orders to rejected results
fabioberger Dec 4, 2019
c1c61fe
Improve comment for clarity
fabioberger Dec 4, 2019
27a1c4a
Make mutex private
fabioberger Dec 4, 2019
fd13db6
Implement method that waits until first block processed by BlockWatch…
fabioberger Dec 4, 2019
ce3f6cb
Break up ValidateAndStoreValidOrders into multiple smaller methods th…
fabioberger Dec 4, 2019
41ec802
Refactor FindLatestMiniHeader and FindMiniHeaderByBlockNumber to retu…
fabioberger Dec 4, 2019
6d2266f
Add test covering edge-case where block at which order validation hap…
fabioberger Dec 4, 2019
555e4cb
Revert breaking out of logic into separate function
fabioberger Dec 5, 2019
56878ce
Ensure metadata entry exists since this test updates it
fabioberger Dec 12, 2019
001c4f3
Revert refactors to OrderWatcher attempting to allow certain events t…
fabioberger Dec 12, 2019
6bd54c0
Revert to using latest tag
fabioberger Dec 12, 2019
7f6f583
Fix import
fabioberger Dec 12, 2019
8bb22c1
Rename function
fabioberger Dec 12, 2019
4f9b440
Insert blocks into DB only _once_ processed by OrderWatcher so that w…
fabioberger Dec 13, 2019
5c2276f
Revert doc changes
fabioberger Dec 13, 2019
3b2867e
Add comment and remove print
fabioberger Dec 13, 2019
ae8de2f
Now that we block the block event processing, we don't need to check …
fabioberger Dec 13, 2019
0530258
Add bug fixes to CHANGELOG
fabioberger Dec 13, 2019
507e532
Fix linter
fabioberger Dec 13, 2019
a14f268
Re-add newline
fabioberger Dec 13, 2019
41f0227
Fix comments
fabioberger Dec 13, 2019
d3acb32
Fix PR link
fabioberger Dec 13, 2019
b2c93f4
Stick to Golang conventions with comment naming
fabioberger Dec 13, 2019
a9b4f97
Remove unused array
fabioberger Dec 13, 2019
09296f6
Handle the third case where a new latest block has the same timestamp…
fabioberger Dec 14, 2019
87b2179
Aggregate STOPPED_WATCHING events
fabioberger Dec 14, 2019
e3bc772
Handle case where no previousLatestBlock exists
fabioberger Dec 14, 2019
5d3fbc8
Add simple test of Cleanup() method
fabioberger Dec 16, 2019
26cfc2f
Simplify lastUpdated computation
fabioberger Dec 17, 2019
391dd91
Add sleeps to rpc integration tests
fabioberger Dec 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,12 @@ This changelog is a work in progress and may contain notes for versions which ha
- Instead of progressing Mesh forward by a single block on every invocation of the `BLOCK_POLLING_INTERVAL`, we now attempt to sync as many blocks as necessary to reach the latest block available. This will reduce the chances of Mesh becoming out-of-sync with it's backing Ethereum node ([#564](https://github.com/0xProject/0x-mesh/pull/564))
- Added a new environment variable `ENABLE_ETHEREUM_RPC_RATE_LIMITING` and config option `enableEthereumRPCRateLimiting` which can be used to completely disable Mesh's internal Ethereum RPC rate limiting features. By default it is enabled, and disabling can have some consequences depending on your RPC provider. ([#584](https://github.com/0xProject/0x-mesh/pull/584))
- Added a `SnapshotTimestamp` field to `GetOrdersResponse`, the return type of the `mesh_getOrders` RPC method. This way, the caller can know at what point in time the snapshot had been created. ([#591](https://github.com/0xProject/0x-mesh/pull/591))
- Improved batching of events emitted from order events subscriptions ([#566](https://github.com/0xProject/0x-mesh/pull/566))

### Bug fixes 🐞

- Fixed an issue where order updates could have been missed if Mesh discovered blocks but didn't have time to process them before getting shut down. Now, blocks are only persisted to the DB once any order updates resulting from it have been processed. ([#566](https://github.com/0xProject/0x-mesh/pull/566)).
- Fixed a race-condition when adding new orders to Mesh which could result in order-relevant events being missed if they occured very soon after the order was submitted and the order validation RPC call took a long time ([#566](https://github.com/0xProject/0x-mesh/pull/566)).


## v6.1.2-beta
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -56,7 +56,7 @@ test-go-parallel:

.PHONY: test-go-serial
test-go-serial:
go test ./zeroex/ordervalidator ./zeroex/orderwatch ./core -race -timeout 30s -p=1 --serial
go test ./zeroex/ordervalidator ./zeroex/orderwatch ./core -race -timeout 60s -p=1 --serial


.PHONY: test-browser-integration
Expand Down
2 changes: 1 addition & 1 deletion browser/go/main.go
Expand Up @@ -216,7 +216,7 @@ func (cw *MeshWrapper) AddOrders(rawOrders js.Value, pinned bool) (js.Value, err
if err := json.Unmarshal([]byte(encodedOrders), &rawMessages); err != nil {
return js.Undefined(), err
}
results, err := cw.app.AddOrders(rawMessages, pinned)
results, err := cw.app.AddOrders(cw.ctx, rawMessages, pinned)
if err != nil {
return js.Undefined(), err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mesh/main.go
Expand Up @@ -62,7 +62,7 @@ func main() {
go func() {
defer wg.Done()
log.WithField("rpc_addr", config.RPCAddr).Info("starting RPC server")
if err := listenRPC(app, config, ctx); err != nil {
if err := listenRPC(ctx, app, config); err != nil {
rpcErrChan <- err
}
}()
Expand Down
6 changes: 4 additions & 2 deletions cmd/mesh/rpc_handler.go
Expand Up @@ -28,15 +28,17 @@ const orderEventsBufferSize = 8000

type rpcHandler struct {
app *core.App
ctx context.Context
}

// listenRPC starts the RPC server and listens on config.RPCAddr. It blocks
// until there is an error or the RPC server is closed.
func listenRPC(app *core.App, config standaloneConfig, ctx context.Context) error {
func listenRPC(ctx context.Context, app *core.App, config standaloneConfig) error {
// Initialize the JSON RPC WebSocket server (but don't start it yet).
rpcAddr := fmt.Sprintf("%s", config.RPCAddr)
rpcHandler := &rpcHandler{
app: app,
ctx: ctx,
}
rpcServer, err := rpc.NewServer(rpcAddr, rpcHandler)
if err != nil {
Expand Down Expand Up @@ -117,7 +119,7 @@ func (handler *rpcHandler) AddOrders(signedOrdersRaw []*json.RawMessage, opts rp
err = errors.New("method handler crashed in AddOrders RPC call (check logs for stack trace)")
}
}()
validationResults, err := handler.app.AddOrders(signedOrdersRaw, opts.Pinned)
validationResults, err := handler.app.AddOrders(handler.ctx, signedOrdersRaw, opts.Pinned)
if err != nil {
// We don't want to leak internal error details to the RPC client.
log.WithField("error", err.Error()).Error("internal error in AddOrders RPC call")
Expand Down
12 changes: 8 additions & 4 deletions constants/constants.go
Expand Up @@ -2,6 +2,7 @@ package constants

import (
"errors"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -27,16 +28,16 @@ var (
// GanacheAccount0 is the first account exposed on the Ganache test Ethereum node
GanacheAccount0 = common.HexToAddress("0x5409ed021d9299bf6814279a6a1411a7e866a631")
ganacheAccount0PrivateKey = common.Hex2Bytes("f2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d")
// GanacheAccount1 is the first account exposed on the Ganache test Ethereum node
// GanacheAccount1 is the second account exposed on the Ganache test Ethereum node
GanacheAccount1 = common.HexToAddress("0x6ecbe1db9ef729cbe972c83fb886247691fb6beb")
ganacheAccount1PrivateKey = common.Hex2Bytes("5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72")
// GanacheAccount2 is the first account exposed on the Ganache test Ethereum node
// GanacheAccount2 is the third account exposed on the Ganache test Ethereum node
GanacheAccount2 = common.HexToAddress("0xe36ea790bc9d7ab70c55260c66d52b1eca985f84")
ganacheAccount2PrivateKey = common.Hex2Bytes("df02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1")
// GanacheAccount3 is the first account exposed on the Ganache test Ethereum node
// GanacheAccount3 is the fourth account exposed on the Ganache test Ethereum node
GanacheAccount3 = common.HexToAddress("0xe834ec434daba538cd1b9fe1582052b880bd7e63")
ganacheAccount3PrivateKey = common.Hex2Bytes("ff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0")
// GanacheAccount4 is the first account exposed on the Ganache test Ethereum node
// GanacheAccount4 is the fifth account exposed on the Ganache test Ethereum node
GanacheAccount4 = common.HexToAddress("0x78dc5d2d739606d31509c31d654056a45185ecb6")
ganacheAccount4PrivateKey = common.Hex2Bytes("752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249")
)
Expand Down Expand Up @@ -79,3 +80,6 @@ const MaxOrderSizeInBytes = 8192
// node stores archive-level state. One cannot make `eth_call` requests specifying blocks earlier than
// 128 blocks ago on non-archive nodes.
const MaxBlocksStoredInNonArchiveNode = 128

// ErrMaxMessageSize is the error emitted when a message exceeds it's max size
var ErrMaxMessageSize = fmt.Errorf("message exceeds maximum size of %d bytes", MaxOrderSizeInBytes)
53 changes: 23 additions & 30 deletions core/core.go
Expand Up @@ -14,11 +14,12 @@ import (

"github.com/0xProject/0x-mesh/constants"
"github.com/0xProject/0x-mesh/db"
"github.com/0xProject/0x-mesh/encoding"
"github.com/0xProject/0x-mesh/ethereum"
"github.com/0xProject/0x-mesh/ethereum/blockwatch"
"github.com/0xProject/0x-mesh/ethereum/dbstack"
"github.com/0xProject/0x-mesh/ethereum/ethrpcclient"
"github.com/0xProject/0x-mesh/ethereum/ratelimit"
"github.com/0xProject/0x-mesh/ethereum/simplestack"
"github.com/0xProject/0x-mesh/expirationwatch"
"github.com/0xProject/0x-mesh/keys"
"github.com/0xProject/0x-mesh/loghooks"
Expand Down Expand Up @@ -250,10 +251,11 @@ func New(config Config) (*App, error) {
return nil, err
}
topics := orderwatch.GetRelevantTopics()
stack, err := dbstack.New(meshDB, blockWatcherRetentionLimit)
miniHeaders, err := meshDB.FindAllMiniHeadersSortedByNumber()
if err != nil {
return nil, err
}
stack := simplestack.New(blockWatcherRetentionLimit, miniHeaders)
blockWatcherConfig := blockwatch.Config{
Stack: stack,
PollingInterval: config.BlockPollingInterval,
Expand Down Expand Up @@ -444,7 +446,7 @@ func (app *App) Start(ctx context.Context) error {
}()

// Note: this is a blocking call so we won't continue set up until its finished.
blocksElapsed, err := app.blockWatcher.SyncToLatestBlock(innerCtx)
blocksElapsed, err := app.blockWatcher.FastSyncToLatestBlock(innerCtx)
if err != nil {
return err
}
Expand All @@ -458,6 +460,13 @@ func (app *App) Start(ctx context.Context) error {
blockWatcherErrChan <- app.blockWatcher.Watch(innerCtx)
}()

// Ensure orderWatcher has processed at least one recent block before
// starting the P2P node and completing app start, so that Mesh does
// not validate any orders at outdated block heights
if err := app.orderWatcher.WaitForAtLeastOneBlockToBeProcessed(ctx); err != nil {
return err
}

if blocksElapsed >= constants.MaxBlocksStoredInNonArchiveNode {
log.WithField("blocksElapsed", blocksElapsed).Info("More than 128 blocks have elapsed since last boot. Re-validating all orders stored (this can take a while)...")
// Re-validate all orders since too many blocks have elapsed to fast-sync events
Expand Down Expand Up @@ -687,7 +696,7 @@ func (app *App) GetOrders(page, perPage int, snapshotID string) (*rpc.GetOrdersR
// peers. If pinned is true, the orders will be marked as pinned, which means
// they will only be removed if they become unfillable and will not be removed
// due to having a high expiration time or any incentive mechanisms.
func (app *App) AddOrders(signedOrdersRaw []*json.RawMessage, pinned bool) (*ordervalidator.ValidationResults, error) {
func (app *App) AddOrders(ctx context.Context, signedOrdersRaw []*json.RawMessage, pinned bool) (*ordervalidator.ValidationResults, error) {
<-app.started

allValidationResults := &ordervalidator.ValidationResults{
Expand Down Expand Up @@ -752,39 +761,25 @@ func (app *App) AddOrders(signedOrdersRaw []*json.RawMessage, pinned bool) (*ord
orderHashesSeen[orderHash] = struct{}{}
}

validationResults, err := app.validateOrders(schemaValidOrders)
validationResults, err := app.orderWatcher.ValidateAndStoreValidOrders(ctx, schemaValidOrders, pinned, app.chainID)
if err != nil {
return nil, err
}

for _, orderInfo := range validationResults.Accepted {
allValidationResults.Accepted = append(allValidationResults.Accepted, orderInfo)
}
for _, orderInfo := range validationResults.Rejected {
allValidationResults.Rejected = append(allValidationResults.Rejected, orderInfo)
}

for i, acceptedOrderInfo := range allValidationResults.Accepted {
for _, acceptedOrderInfo := range allValidationResults.Accepted {
// If the order isn't new, we don't add to OrderWatcher, log it's receipt
// or share the order with peers.
if !acceptedOrderInfo.IsNew {
continue
}
// Add the order to the OrderWatcher. This also saves the order in the
// database.
err = app.orderWatcher.Add(acceptedOrderInfo, pinned)
if err != nil {
if err == meshdb.ErrDBFilledWithPinnedOrders {
allValidationResults.Accepted = append(allValidationResults.Accepted[:i], allValidationResults.Accepted[i+1:]...)
allValidationResults.Rejected = append(allValidationResults.Rejected, &ordervalidator.RejectedOrderInfo{
OrderHash: acceptedOrderInfo.OrderHash,
SignedOrder: acceptedOrderInfo.SignedOrder,
Kind: ordervalidator.MeshError,
Status: ordervalidator.RODatabaseFullOfOrders,
})
} else {
return nil, err
}
}

log.WithFields(log.Fields{
"orderHash": acceptedOrderInfo.OrderHash.String(),
}).Debug("added new valid order via RPC or browser callback")
Expand All @@ -794,14 +789,15 @@ func (app *App) AddOrders(signedOrdersRaw []*json.RawMessage, pinned bool) (*ord
return nil, err
}
}

return allValidationResults, nil
}

// shareOrder immediately shares the given order on the GossipSub network.
func (app *App) shareOrder(order *zeroex.SignedOrder) error {
<-app.started

encoded, err := encodeOrder(order)
encoded, err := encoding.OrderToRawMessage(order)
if err != nil {
return err
}
Expand All @@ -819,16 +815,13 @@ func (app *App) AddPeer(peerInfo peerstore.PeerInfo) error {
func (app *App) GetStats() (*rpc.GetStatsResponse, error) {
<-app.started

latestBlockHeader, err := app.blockWatcher.GetLatestBlockProcessed()
latestBlockHeader, err := app.db.FindLatestMiniHeader()
if err != nil {
return nil, err
}
var latestBlock rpc.LatestBlock
if latestBlockHeader != nil {
latestBlock = rpc.LatestBlock{
Number: int(latestBlockHeader.Number.Int64()),
Hash: latestBlockHeader.Hash,
}
latestBlock := rpc.LatestBlock{
Number: int(latestBlockHeader.Number.Int64()),
Hash: latestBlockHeader.Hash,
}
notRemovedFilter := app.db.Orders.IsRemovedIndex.ValueFilter([]byte{0})
numOrders, err := app.db.Orders.NewQuery(notRemovedFilter).Count()
Expand Down
34 changes: 12 additions & 22 deletions core/message_handler.go
@@ -1,7 +1,10 @@
package core

import (
"context"

"github.com/0xProject/0x-mesh/constants"
"github.com/0xProject/0x-mesh/encoding"
"github.com/0xProject/0x-mesh/meshdb"
"github.com/0xProject/0x-mesh/p2p"
"github.com/0xProject/0x-mesh/zeroex"
Expand Down Expand Up @@ -92,7 +95,7 @@ func (orderSelector *orderSelector) GetMessagesToShare(max int) ([][]byte, error
log.WithFields(map[string]interface{}{
"order": order,
}).Trace("selected order to share")
encoded, err := encodeOrder(order.SignedOrder)
encoded, err := encoding.OrderToRawMessage(order.SignedOrder)
if err != nil {
return nil, err
}
Expand All @@ -101,7 +104,7 @@ func (orderSelector *orderSelector) GetMessagesToShare(max int) ([][]byte, error
return messageData, nil
}

func (app *App) HandleMessages(messages []*p2p.Message) error {
func (app *App) HandleMessages(ctx context.Context, messages []*p2p.Message) error {
// First we validate the messages and decode them into orders.
orders := []*zeroex.SignedOrder{}
orderHashToMessage := map[common.Hash]*p2p.Message{}
Expand Down Expand Up @@ -140,7 +143,7 @@ func (app *App) HandleMessages(messages []*p2p.Message) error {
continue
}

order, err := decodeOrder(msg.Data)
order, err := encoding.RawMessageToOrder(msg.Data)
if err != nil {
log.WithFields(map[string]interface{}{
"error": err,
Expand All @@ -164,20 +167,21 @@ func (app *App) HandleMessages(messages []*p2p.Message) error {
}

// Next, we validate the orders.
validationResults, err := app.validateOrders(orders)
validationResults, err := app.orderWatcher.ValidateAndStoreValidOrders(ctx, orders, false, app.chainID)
if err != nil {
return err
}

// Store any valid orders and update the peer scores.
for _, acceptedOrderInfo := range validationResults.Accepted {
// If the order isn't new, we don't log it's receipt or adjust peer scores
if !acceptedOrderInfo.IsNew {
continue
}
msg := orderHashToMessage[acceptedOrderInfo.OrderHash]
// If we've reached this point, the message is valid and we were able to
// decode it into an order. Append it to the list of orders to validate and
// update peer scores accordingly.
// If we've reached this point, the message is valid, we were able to
// decode it into an order and check that this order is valid. Update
// peer scores accordingly.
log.WithFields(map[string]interface{}{
"orderHash": acceptedOrderInfo.OrderHash.Hex(),
"from": msg.From.String(),
Expand All @@ -187,20 +191,6 @@ func (app *App) HandleMessages(messages []*p2p.Message) error {
"orderHash": acceptedOrderInfo.OrderHash.Hex(),
"from": msg.From.String(),
}).Trace("all fields for new valid order received from peer")
// Add stores the message in the database.
if err := app.orderWatcher.Add(acceptedOrderInfo, false); err != nil {
if err == meshdb.ErrDBFilledWithPinnedOrders {
// If the database is full of pinned orders, log and then continue.
log.WithFields(map[string]interface{}{
"error": err.Error(),
"orderHash": acceptedOrderInfo.OrderHash.Hex(),
"from": msg.From.String(),
}).Error("could not store valid order because database is full")
continue
}
// For any other type of error, return it.
return err
}
app.handlePeerScoreEvent(msg.From, psOrderStored)
}

Expand All @@ -213,7 +203,7 @@ func (app *App) HandleMessages(messages []*p2p.Message) error {
"from": msg.From.String(),
}).Trace("not storing rejected order received from peer")
switch rejectedOrderInfo.Status {
case ordervalidator.ROInternalError, ordervalidator.ROEthRPCRequestFailed, ordervalidator.ROCoordinatorRequestFailed:
case ordervalidator.ROInternalError, ordervalidator.ROEthRPCRequestFailed, ordervalidator.ROCoordinatorRequestFailed, ordervalidator.RODatabaseFullOfOrders:
fabioberger marked this conversation as resolved.
Show resolved Hide resolved
// Don't incur a negative score for these status types (it might not be
// their fault).
default:
Expand Down
3 changes: 2 additions & 1 deletion core/message_handler_test.go
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/0xProject/0x-mesh/constants"
"github.com/0xProject/0x-mesh/encoding"
"github.com/0xProject/0x-mesh/ethereum"
"github.com/0xProject/0x-mesh/meshdb"
"github.com/0xProject/0x-mesh/scenario"
Expand Down Expand Up @@ -191,7 +192,7 @@ func verifyRoundRobinSharing(t *testing.T, selector *orderSelector, nextOffset i

// Calculate the orders that we expect to be shared
for i := 0; i < expectedOrdersLength; i++ {
encodedOrder, err := encodeOrder(orderList[(nextOffset+i)%count].SignedOrder)
encodedOrder, err := encoding.OrderToRawMessage(orderList[(nextOffset+i)%count].SignedOrder)
require.NoError(t, err)

expectedOrders[i] = encodedOrder
Expand Down