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.744 to 2.5.745

2

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

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

@@ -23,12 +23,14 @@ const Mutation = require('../../../mutation');

function processBlockStatements(blockStatements) {
for (let i = 0; i < blockStatements.length - 1; i++) {
const statement = blockStatements[i];
const nextStatement = blockStatements[i + 1];
if (!statement || !nextStatement) {
console.log("Skipping mutation: Not enough statements to mutate.");
continue;
const stateChanges = [];
const nonStateChanges = [];
// Separate state changes and non-state changes
blockStatements.forEach(statement => {
if (!statement) {
console.log("Skipping mutation: statement is null or undefined.");
return;
}
// Check if the statement is a state change (e.g., assignment or update)
// Check if the statement is a state change
const isStateChange = statement.type === "ExpressionStatement" && (

@@ -39,20 +41,25 @@ statement.expression.type === "AssignmentExpression" ||

// 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);
if (isStateChange) {
stateChanges.push(statement);
} else {
nonStateChanges.push(statement);
}
});
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]);
// If there are state changes, move them to the end of the block
if (stateChanges.length > 0) {
const startLine = blockStatements[0].loc.start.line;
const endLine = blockStatements[blockStatements.length - 1].loc.end.line;
const original = source.slice(blockStatements[0].range[0], blockStatements[blockStatements.length - 1].range[1]);
const swapped = source.slice(nextStatement.range[0], nextStatement.range[1]) + "\n" +
source.slice(statement.range[0], statement.range[1]);
// Combine non-state changes followed by state changes
const combinedStatements = [...nonStateChanges, ...stateChanges];
const replacement = combinedStatements.map(statement =>
source.slice(statement.range[0], statement.range[1])
).join("\n");
const replacement = source.substring(0, statement.range[0]) + swapped + source.substring(nextStatement.range[1]);
const fullReplacement = source.substring(0, blockStatements[0].range[0]) +
replacement + source.substring(blockStatements[blockStatements.length - 1].range[1]);
mutations.push(new Mutation(file, statement.range[0], nextStatement.range[1], startLine, endLine, original, replacement, this.ID));
}
mutations.push(new Mutation(file, blockStatements[0].range[0], blockStatements[blockStatements.length - 1].range[1], startLine, endLine, original, fullReplacement, this.ID));
}

@@ -59,0 +66,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