Skip to content

Commit 45e1abe

Browse files
committed
Implement Soroban Upgrade and Upgrade Readiness Scanner
1 parent c517919 commit 45e1abe

7 files changed

Lines changed: 2089 additions & 47 deletions

File tree

libs/engine/analyzers/solidity-analyzer.ts

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -600,53 +600,53 @@ export class SolidityAnalyzer extends BaseAnalyzer implements Analyzer {
600600
);
601601
}
602602

603-
// Rule: sol-016 - Storage Slot Collision
604-
if (this.isRuleEnabled("sol-016", config)) {
605-
const collisions = detectStorageSlotCollisions(code);
606-
if (collisions.detected) {
607-
findings.push(
608-
...collisions.collisions.map((collision) => ({
609-
ruleId: "sol-016",
610-
message: collision.reason,
611-
severity: this.getRuleSeverity("sol-016", config),
612-
location: {
613-
file: filePath,
614-
startLine: collision.line1,
615-
endLine: collision.line2,
616-
},
617-
suggestedFix: {
618-
description: collisions.suggestion,
619-
documentationUrl: "https://docs.gasguard.dev/rules/sol-016",
620-
},
621-
})),
622-
);
623-
}
624-
}
625-
626-
// Rule: sol-017 - Missing Immutable Variables
627-
if (this.isRuleEnabled("sol-017", config)) {
628-
const missingImmutable = detectMissingImmutable(code);
629-
if (missingImmutable.detected) {
630-
findings.push(
631-
...missingImmutable.variables.map((variable) => ({
632-
ruleId: "sol-017",
633-
message: variable.reason,
634-
severity: this.getRuleSeverity("sol-017", config),
635-
location: {
636-
file: filePath,
637-
startLine: variable.line,
638-
endLine: variable.line,
639-
},
640-
estimatedGasSavings: 500,
641-
suggestedFix: {
642-
description: `Add 'immutable' keyword to variable '${variable.name}'`,
643-
codeSnippet: `${variable.type} immutable ${variable.name} = <constructor_value>;`,
644-
documentationUrl: "https://docs.gasguard.dev/rules/sol-017",
645-
},
646-
})),
647-
);
648-
}
649-
}
603+
// Rule: sol-016 - Storage Slot Collision
604+
if (this.isRuleEnabled("sol-016", config)) {
605+
const collisions = detectStorageSlotCollisions(code);
606+
if (collisions.detected) {
607+
findings.push(
608+
...collisions.collisions.map((collision) => ({
609+
ruleId: "sol-016",
610+
message: collision.reason,
611+
severity: this.getRuleSeverity("sol-016", config),
612+
location: {
613+
file: filePath,
614+
startLine: collision.line1,
615+
endLine: collision.line2,
616+
},
617+
suggestedFix: {
618+
description: collisions.suggestion,
619+
documentationUrl: "https://docs.gasguard.dev/rules/sol-016",
620+
},
621+
})),
622+
);
623+
}
624+
}
625+
626+
// Rule: sol-017 - Missing Immutable Variables
627+
if (this.isRuleEnabled("sol-017", config)) {
628+
const missingImmutable = detectMissingImmutable(code);
629+
if (missingImmutable.detected) {
630+
findings.push(
631+
...missingImmutable.variables.map((variable) => ({
632+
ruleId: "sol-017",
633+
message: variable.reason,
634+
severity: this.getRuleSeverity("sol-017", config),
635+
location: {
636+
file: filePath,
637+
startLine: variable.line,
638+
endLine: variable.line,
639+
},
640+
estimatedGasSavings: 500,
641+
suggestedFix: {
642+
description: `Add 'immutable' keyword to variable '${variable.name}'`,
643+
codeSnippet: `${variable.type} immutable ${variable.name} = <constructor_value>;`,
644+
documentationUrl: "https://docs.gasguard.dev/rules/sol-017",
645+
},
646+
})),
647+
);
648+
}
649+
}
650650
} catch (error) {
651651
errors.push({
652652
file: filePath,

0 commit comments

Comments
 (0)