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

@cryptoeconomicslab/ovm

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cryptoeconomicslab/ovm - npm Package Compare versions

Comparing version 0.0.36 to 0.0.37

12

lib/deciders/operators/AndDecider.js

@@ -16,2 +16,3 @@ "use strict";

outcome: false,
witnesses: [],
challenges: [],

@@ -24,3 +25,3 @@ traceInfo: Tracer_1.TraceInfoCreator.exception('And connective has an invalid child.')

if (decision.outcome) {
return null;
return decision;
}

@@ -33,2 +34,3 @@ const challenge = {

outcome: false,
witnesses: [],
challenges: [challenge].concat(decision.challenges),

@@ -40,8 +42,10 @@ traceInfo: decision.traceInfo

}));
const filteredDecisions = decisions.filter(r => !!r);
if (filteredDecisions[0]) {
return filteredDecisions[0];
const falseDecisions = decisions.filter(d => d.outcome === false);
if (falseDecisions[0]) {
return falseDecisions[0];
}
const witnesses = decisions.map(d => ovmContext.coder.encode(primitives_1.List.from(primitives_1.Bytes, d.witnesses || [])));
return {
outcome: true,
witnesses,
challenges: []

@@ -48,0 +52,0 @@ };

@@ -28,2 +28,3 @@ "use strict";

outcome: false,
witnesses: [],
challenges: [challenge].concat(decision.challenges),

@@ -38,2 +39,3 @@ traceInfo: decision.traceInfo

outcome: true,
witnesses: [],
challenges: []

@@ -40,0 +42,0 @@ });

@@ -11,2 +11,3 @@ "use strict";

outcome: !decision.outcome,
witnesses: [],
challenges: [

@@ -13,0 +14,0 @@ {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const primitives_1 = require("@cryptoeconomicslab/primitives");
const types_1 = require("../../types");

@@ -15,2 +16,3 @@ const helpers_1 = require("../../helpers");

outcome: false,
witnesses: [],
challenges: [],

@@ -23,5 +25,10 @@ traceInfo: Tracer_1.TraceInfoCreator.exception('Or connective has an invalid child.')

}));
if (decisions.some(d => d.outcome)) {
const index = decisions.findIndex(d => d.outcome);
if (index >= 0) {
const childWitnesses = decisions[index].witnesses || [];
return {
outcome: true,
witnesses: childWitnesses.concat([
ovmContext.coder.encode(primitives_1.Integer.from(index))
]),
challenges: []

@@ -40,2 +47,3 @@ };

outcome: false,
witnesses: [],
challenges: [challenge],

@@ -42,0 +50,0 @@ traceInfo: Tracer_1.TraceInfoCreator.createOr(decisions.map(d => d.traceInfo).filter(t => !!t))

import { Bytes } from '@cryptoeconomicslab/primitives';
import { Decider } from '../../interfaces/Decider';
import { DeciderManager } from '../../DeciderManager';
import { Property } from '../../types';
export declare class ThereExistsSuchThatDecider implements Decider {

@@ -9,5 +10,14 @@ decide(manager: DeciderManager, inputs: Bytes[], substitutions?: {

outcome: boolean;
witnesses: Bytes[];
challenges: never[];
traceInfo?: undefined;
} | {
outcome: boolean;
witnesses: never[];
challenges: {
challengeInput: null;
property: Property;
}[];
traceInfo: import("../../Tracer").ThereExistsSuchThatTraceInfo | undefined;
}>;
}

@@ -9,2 +9,3 @@ "use strict";

var _a;
const { coder } = ovmContext;
let witnesses;

@@ -17,15 +18,40 @@ if (db_1.isHint(inputs[0])) {

}
const innerProperty = types_1.Property.fromStruct(ovmContext.coder.decode(types_1.Property.getParamType(), inputs[2]));
const innerProperty = types_1.Property.fromStruct(coder.decode(types_1.Property.getParamType(), inputs[2]));
const variableName = inputs[1].intoString();
const decisions = await Promise.all(witnesses.map(async (witness) => {
return await manager.decide(innerProperty, Object.assign(Object.assign({}, substitutions), { [variableName]: witness }));
const decisions = await Promise.all(witnesses.map(async (variable) => {
return await manager.decide(innerProperty, Object.assign(Object.assign({}, substitutions), { [variableName]: variable }));
}));
const indexOfTrueDecision = decisions.findIndex(d => d.outcome);
const childTraceInfo = (_a = decisions.find(d => d.outcome === false)) === null || _a === void 0 ? void 0 : _a.traceInfo;
return {
outcome: decisions.some(d => d.outcome),
challenges: [],
traceInfo: childTraceInfo
? Tracer_1.TraceInfoCreator.createThere(childTraceInfo)
: undefined
const challenge = {
challengeInput: null,
property: new types_1.Property(manager.getDeciderAddress(types_1.LogicalConnective.ForAllSuchThat), [
inputs[0],
inputs[1],
coder.encode(new types_1.Property(manager.getDeciderAddress(types_1.LogicalConnective.Not), [
inputs[2]
]).toStruct())
])
};
if (indexOfTrueDecision >= 0) {
let nextWitnesses = undefined;
const witness = witnesses[indexOfTrueDecision];
const childWitnesses = decisions[indexOfTrueDecision].witnesses || [];
nextWitnesses = childWitnesses.concat([witness]);
return {
outcome: true,
witnesses: nextWitnesses,
challenges: []
};
}
else {
return {
outcome: false,
witnesses: [],
challenges: [challenge],
traceInfo: childTraceInfo
? Tracer_1.TraceInfoCreator.createThere(childTraceInfo)
: undefined
};
}
}

@@ -32,0 +58,0 @@ }

@@ -84,3 +84,10 @@ "use strict";

const property = coder_1.decodeStructable(types_1.Property, ovmContext.coder, context.compiledProperty.inputs[input.predicate.source.inputIndex]);
const extraInputBytes = input.inputs.map(i => context.compiledProperty.inputs[i.inputIndex]);
const extraInputBytes = input.inputs.map(i => {
if (i.type === 'NormalInput') {
return context.compiledProperty.inputs[i.inputIndex];
}
else {
throw new Error(`It doesn't support ${i.type} in InputPredicateCall`);
}
});
property.inputs = property.inputs.concat(extraInputBytes);

@@ -87,0 +94,0 @@ return ovmContext.coder.encode(property.toStruct());

@@ -9,2 +9,3 @@ import { Address, Bytes, Struct, BigNumber } from '@cryptoeconomicslab/primitives';

outcome: boolean;
witnesses?: Bytes[];
challenges: Challenge[];

@@ -47,4 +48,7 @@ traceInfo?: TraceInfo;

LessThan = "LessThan",
GreaterThan = "GreaterThan",
IsSameAmount = "IsSameAmount",
IsContained = "IsContained"
IsContained = "IsContained",
IsHashPreimage = "IsHashPreimage",
Foo = "Foo"
}

@@ -51,0 +55,0 @@ export declare type LogicalConnectiveStrings = keyof typeof LogicalConnective;

@@ -74,4 +74,7 @@ "use strict";

AtomicPredicate["LessThan"] = "LessThan";
AtomicPredicate["GreaterThan"] = "GreaterThan";
AtomicPredicate["IsSameAmount"] = "IsSameAmount";
AtomicPredicate["IsContained"] = "IsContained";
AtomicPredicate["IsHashPreimage"] = "IsHashPreimage";
AtomicPredicate["Foo"] = "Foo";
})(AtomicPredicate = exports.AtomicPredicate || (exports.AtomicPredicate = {}));

@@ -78,0 +81,0 @@ function convertStringToLogicalConnective(name) {

{
"name": "@cryptoeconomicslab/ovm",
"version": "0.0.36",
"version": "0.0.37",
"description": "ovm",

@@ -32,19 +32,19 @@ "author": {

"dependencies": {
"@cryptoeconomicslab/coder": "^0.0.36",
"@cryptoeconomicslab/db": "^0.0.36",
"@cryptoeconomicslab/hash": "^0.0.36",
"@cryptoeconomicslab/ovm-parser": "^0.2.5",
"@cryptoeconomicslab/ovm-transpiler": "^0.2.7",
"@cryptoeconomicslab/primitives": "^0.0.36",
"@cryptoeconomicslab/signature": "^0.0.36",
"@cryptoeconomicslab/utils": "^0.0.36",
"jsbi": "^3.1.1"
"@cryptoeconomicslab/coder": "^0.0.37",
"@cryptoeconomicslab/db": "^0.0.37",
"@cryptoeconomicslab/hash": "^0.0.37",
"@cryptoeconomicslab/ovm-parser": "^0.2.12",
"@cryptoeconomicslab/ovm-transpiler": "^0.2.13",
"@cryptoeconomicslab/primitives": "^0.0.37",
"@cryptoeconomicslab/signature": "^0.0.37",
"@cryptoeconomicslab/utils": "^0.0.37",
"jsbi": "^3.1.2"
},
"gitHead": "3cf96a9462b6ff0bdf64995dbbbbdee7a6a1f48d",
"gitHead": "2f22a593c9bb282ca068adecaeacb26b8f46caab",
"devDependencies": {
"@cryptoeconomicslab/coder": "^0.0.3",
"@cryptoeconomicslab/context": "^0.0.36",
"@cryptoeconomicslab/level-kvs": "0.0.3",
"ethers": "^4.0.43"
"@cryptoeconomicslab/context": "^0.0.37",
"@cryptoeconomicslab/level-kvs": "0.0.6",
"ethers": "^4.0.46"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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