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

@ggflutter/sumo

Package Overview
Dependencies
Maintainers
0
Versions
740
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ggflutter/sumo - npm Package Compare versions

Comparing version 2.5.739 to 2.5.740

2

package.json
{
"author": "Luigi Allocca",
"name": "@ggflutter/sumo",
"version": "2.5.739",
"version": "2.5.740",
"description": "A mutation testing tool for Ethereum smart contracts",

@@ -6,0 +6,0 @@ "repository": {

@@ -24,34 +24,33 @@ const Mutation = require('../../../mutation');

for (let i = 0; i < blockStatements.length - 1; i++) {
const currentStatement = blockStatements[i];
const nextStatement = blockStatements[i + 1];
const statement = body[i];
const nextStatement = body[i + 1];
// Skip if either statement is missing
if (!currentStatement || !nextStatement) {
console.log("Skipping mutation: Not enough statements to mutate.");
continue;
}
if (!statement || !nextStatement) {
console.log("Skipping mutation: Not enough statements to mutate.");
continue;
}
// Ensure the statements are of the right types
if (currentStatement.type === "ExpressionStatement" && nextStatement.type === "ExpressionStatement") {
const currentStatementRange = currentStatement.range;
const nextStatementRange = nextStatement.range;
// Check if the statement is a state change (e.g., assignment or update)
const isStateChange = statement.type === "ExpressionStatement" && (
statement.expression.type === "AssignmentExpression" ||
statement.expression.type === "UpdateExpression"
);
// Create the original and replacement code
const start = currentStatementRange[1] + 1; // Start right after the end of the current statement
const end = nextStatementRange[0]; // End right before the start of the next statement
const startLine = currentStatement.loc.end.line;
const endLine = nextStatement.loc.start.line;
// Check if the next statement is an external call
const isExternalCall = nextStatement.type === "ExpressionStatement" &&
nextStatement.expression.type === "CallExpression" &&
nextStatement.expression.callee.type === "MemberExpression" &&
["call", "delegatecall", "send"].includes(nextStatement.expression.callee.property.name);
// Extract original code segments
const original = source.slice(currentStatementRange[0], nextStatementRange[1]);
if (isStateChange && isExternalCall) {
const startLine = statement.loc.start.line;
const endLine = nextStatement.loc.end.line;
const original = source.slice(statement.range[0], nextStatement.range[1]);
// Create the replacement code by swapping the two statements
const replacement = source.slice(nextStatementRange[0], nextStatementRange[1]) + "\n" +
source.slice(currentStatementRange[0], currentStatementRange[1]);
const swapped = source.slice(nextStatement.range[0], nextStatement.range[1]) + "\n" +
source.slice(statement.range[0], statement.range[1]);
// Create the new source code with the mutation applied
const newSource = source.substring(0, currentStatementRange[0]) + replacement + source.substring(nextStatementRange[1]);
const replacement = source.substring(0, statement.range[0]) + swapped + source.substring(nextStatement.range[1]);
// Add the mutation
mutations.push(new Mutation(file, currentStatementRange[0], nextStatementRange[1], startLine, endLine, original, newSource, this.ID));
mutations.push(new Mutation(file, statement.range[0], nextStatement.range[1], startLine, endLine, original, replacement, this.ID));
}

@@ -58,0 +57,0 @@ }

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