New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autobase

Package Overview
Dependencies
Maintainers
3
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autobase - npm Package Compare versions

Comparing version 6.0.0-rc8 to 6.0.0-rc9

31

lib/consensus.js

@@ -5,2 +5,6 @@ const BufferMap = require('tiny-buffer-map')

const UNSEEN = 0
const NEWER = 1
const ACKED = 2
// Consensus machine for Autobase. Sort DAG nodes using

@@ -220,3 +224,3 @@ // vector clocks to determine a globally consistent view

confirms (indexer, target, acks, length) {
if (!length || this.removed.get(indexer.core.key) >= length) return false
if (!length || this.removed.get(indexer.core.key) >= length) return UNSEEN
// def feels like there is a smarter way of doing this part

@@ -227,6 +231,7 @@ // ie we just wanna find a node from the indexer that is strictly newer than target

let jump = true
let newer = true
for (let i = length - 1; i >= 0; i--) {
const head = indexer.get(i)
if (head === null) return false
if (head === null) return UNSEEN

@@ -241,4 +246,4 @@ let seen = 0

if (seen < this.majority) {
return false
if (!newer && seen < this.majority) {
break
}

@@ -269,9 +274,12 @@

newer = false
continue
} else if (seen < this.majority) {
return NEWER
}
return true
return ACKED
}
return false
return UNSEEN
}

@@ -284,2 +292,3 @@

if (acks.length < this.majority) return false
let allNewer = true

@@ -291,3 +300,5 @@ for (const indexer of this.indexers) {

if (this.confirms(indexer, target, acks, length)) {
const result = this.confirms(indexer, target, acks, length)
if (result === ACKED) {
confs.add(indexer)

@@ -298,2 +309,4 @@ if (confs.size >= this.majority) {

}
if (result === UNSEEN) allNewer = false
}

@@ -303,3 +316,3 @@

return false
return allNewer
}

@@ -418,3 +431,3 @@

if (acks.length >= this.majority) {
return !this.confirms(writer, target, acks, writer.length)
return this.confirms(writer, target, acks, writer.length) === UNSEEN
}

@@ -421,0 +434,0 @@

@@ -245,4 +245,2 @@ const c = require('compact-encoding')

const Trace = c.array(c.uint)
const OplogMessage = {

@@ -266,3 +264,2 @@ preencode (state, m) {

Node.preencode(state, m.node)
Trace.preencode(state, m.trace)
},

@@ -286,3 +283,2 @@ encode (state, m) {

Node.encode(state, m.node)
Trace.encode(state, m.trace)
},

@@ -300,4 +296,3 @@ decode (state) {

checkpoint: m.checkpoint,
node: m.node,
trace: []
node: m.node
}

@@ -316,3 +311,2 @@ }

const node = Node.decode(state)
const trace = Trace.decode(state)

@@ -324,4 +318,3 @@ return {

checkpoint,
node,
trace
node
}

@@ -328,0 +321,0 @@ }

{
"name": "autobase",
"version": "6.0.0-rc8",
"version": "6.0.0-rc9",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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