Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serum-vial

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serum-vial - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

48

dist/data_mapper.js

@@ -109,3 +109,3 @@ "use strict";

if (this._initialized) {
const diffIsValid = this._validateL3DiffCorrectness(l3Diff);
const diffIsValid = this._validateL3DiffCorrectness(l3Diff, slot);
if (diffIsValid === false) {

@@ -252,3 +252,3 @@ logger_1.logger.log('warn', 'PartitionDetected: invalid l3diff', {

if (l3Diff.length === 0) {
logger_1.logger.log('warn', 'L2 diff without corresponding L3 diff', {
logger_1.logger.log('warn', 'PartitionDetected: L2 diff without corresponding L3 diff', {
market: this._options.symbol,

@@ -262,2 +262,4 @@ asksAccountExists: accountsData.asks !== undefined,

});
this._options.onPartitionDetected();
return;
}

@@ -356,3 +358,3 @@ // since we have a diff it means snapshot has changed

}
_validateL3DiffCorrectness(l3Diff) {
_validateL3DiffCorrectness(l3Diff, slot) {
// first make sure we have initial snapshots to apply diffs to

@@ -388,3 +390,3 @@ if (this._localAsksOrdersMap === undefined && this._localBidsOrdersMap === undefined) {

fill: item,
slot: item.slot
slot
});

@@ -399,16 +401,2 @@ return false;

if (item.type === 'done') {
if (item.reason === 'canceled') {
const matchingOrder = ordersMap.get(item.orderId);
if (matchingOrder !== undefined) {
if (matchingOrder.size !== item.sizeRemaining) {
logger_1.logger.log('warn', 'Done(cancel) message with incorrect sizeRemaining', {
market: this._options.symbol,
doneMessage: item,
matchingOrder,
slot: item.slot,
l3Diff
});
}
}
}
ordersMap.delete(item.orderId);

@@ -418,2 +406,8 @@ }

if (this._bidsAccountOrders.length !== this._localBidsOrdersMap.size) {
logger_1.logger.log('warn', 'Bids orders count do not match', {
market: this._options.symbol,
currentBidsCount: this._bidsAccountOrders.length,
localBidsCount: this._localBidsOrdersMap.size,
slot
});
return false;

@@ -426,2 +420,8 @@ }

matchingLocalBid.size !== bid.size) {
logger_1.logger.log('warn', 'Bid order do not match', {
market: this._options.symbol,
localBid: matchingLocalBid,
currentBid: bid,
slot
});
return false;

@@ -431,2 +431,8 @@ }

if (this._asksAccountOrders.length !== this._localAsksOrdersMap.size) {
logger_1.logger.log('warn', 'Asks orders count do not match', {
market: this._options.symbol,
currentAsksCount: this._asksAccountOrders.length,
localAsksCount: this._localAsksOrdersMap.size,
slot
});
return false;

@@ -439,2 +445,8 @@ }

matchingLocalAsk.size !== ask.size) {
logger_1.logger.log('warn', 'Bid order do not match', {
market: this._options.symbol,
localAsk: matchingLocalAsk,
currentAsk: ask,
slot
});
return false;

@@ -441,0 +453,0 @@ }

{
"name": "serum-vial",
"version": "1.3.3",
"version": "1.3.4",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=15"

@@ -177,3 +177,3 @@ import { EVENT_QUEUE_LAYOUT, Market, Orderbook, getLayoutVersion } from '@project-serum/serum'

if (this._initialized) {
const diffIsValid = this._validateL3DiffCorrectness(l3Diff)
const diffIsValid = this._validateL3DiffCorrectness(l3Diff, slot)

@@ -365,3 +365,3 @@ if (diffIsValid === false) {

if (l3Diff.length === 0) {
logger.log('warn', 'L2 diff without corresponding L3 diff', {
logger.log('warn', 'PartitionDetected: L2 diff without corresponding L3 diff', {
market: this._options.symbol,

@@ -375,2 +375,6 @@ asksAccountExists: accountsData.asks !== undefined,

})
this._options.onPartitionDetected()
return
}

@@ -492,3 +496,3 @@

private _validateL3DiffCorrectness(l3Diff: (Open | Fill | Done | Change)[]) {
private _validateL3DiffCorrectness(l3Diff: (Open | Fill | Done | Change)[], slot: number) {
// first make sure we have initial snapshots to apply diffs to

@@ -502,3 +506,2 @@

}
for (const item of l3Diff) {

@@ -530,3 +533,3 @@ const ordersMap = (item.side === 'buy' ? this._localBidsOrdersMap : this._localAsksOrdersMap)!

fill: item,
slot: item.slot
slot
})

@@ -544,17 +547,2 @@

if (item.type === 'done') {
if (item.reason === 'canceled') {
const matchingOrder = ordersMap.get(item.orderId)
if (matchingOrder !== undefined) {
if (matchingOrder.size !== item.sizeRemaining) {
logger.log('warn', 'Done(cancel) message with incorrect sizeRemaining', {
market: this._options.symbol,
doneMessage: item,
matchingOrder,
slot: item.slot,
l3Diff
})
}
}
}
ordersMap.delete(item.orderId)

@@ -565,2 +553,9 @@ }

if (this._bidsAccountOrders!.length !== this._localBidsOrdersMap!.size) {
logger.log('warn', 'Bids orders count do not match', {
market: this._options.symbol,
currentBidsCount: this._bidsAccountOrders!.length,
localBidsCount: this._localBidsOrdersMap!.size,
slot
})
return false

@@ -576,2 +571,9 @@ }

) {
logger.log('warn', 'Bid order do not match', {
market: this._options.symbol,
localBid: matchingLocalBid,
currentBid: bid,
slot
})
return false

@@ -582,2 +584,9 @@ }

if (this._asksAccountOrders!.length !== this._localAsksOrdersMap!.size) {
logger.log('warn', 'Asks orders count do not match', {
market: this._options.symbol,
currentAsksCount: this._asksAccountOrders!.length,
localAsksCount: this._localAsksOrdersMap!.size,
slot
})
return false

@@ -593,2 +602,9 @@ }

) {
logger.log('warn', 'Bid order do not match', {
market: this._options.symbol,
localAsk: matchingLocalAsk,
currentAsk: ask,
slot
})
return false

@@ -595,0 +611,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc