Skip to content

Fix Smart Contract Logic, Enforce Stage Validation, and Refactor Backend to MVC #86

@navin-oss

Description

@navin-oss

Bug Description

🐛 Critical Smart Contract & Backend Refactor Required

📌 Problem Description

The current CropChain implementation contains multiple structural and logical issues across both the smart contract and backend layers:

  • Smart contract contains syntax inconsistencies and incorrect parameter handling
  • Inconsistent event emissions
  • Weak stage transition validation
  • Missing strict role-based authorization enforcement
  • Backend architecture not fully aligned with MVC best practices
  • Inconsistent validation and error response formatting
  • Limited automated test coverage
  • Potential stage-skipping vulnerabilities in supply chain flow

These issues reduce reliability and make future blockchain integration and persistent storage harder to maintain.


🎯 Objectives

  • Fix smart contract logic flaws and syntax errors
  • Strengthen supply chain stage validation
  • Enforce strict role-based authorization
  • Refactor backend into a clean MVC architecture
  • Standardize API response handling
  • Add comprehensive automated tests (contract + backend)

🏷 Difficulty Level

Medium → Hard
This task requires:

  • Deep understanding of Solidity and smart contract architecture
  • Backend restructuring using MVC principles
  • Secure role-based authorization implementation
  • Careful stage progression validation logic
  • Cross-layer integration between contract and backend
  • Writing and maintaining comprehensive automated tests
    The refactor impacts multiple layers of the system, making it more complex than a typical bug fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions