Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report in defective-component-counter smart contract #278

Open
academic-starter opened this issue Feb 22, 2024 · 0 comments
Open

Bug report in defective-component-counter smart contract #278

academic-starter opened this issue Feb 22, 2024 · 0 comments

Comments

@academic-starter
Copy link

As documented by its following specification, computeTotal funtion can only be called once. However, in the contract implementation, there is no such restriction.

"States": [{
"Name": "Create",
"DisplayName": "Create",
"Description": "...",
"PercentComplete": 50,
"Value": 0,
"Style": "Success",
"Transitions": [{
"AllowedRoles": [],
"AllowedInstanceRoles": ["Manufacturer"],
"Description": "...",
"Function": "ComputeTotal",
"NextStates": ["ComputeTotal"],
"DisplayName": "Compute Total"
}]
},
{
"Name": "ComputeTotal",
"DisplayName": "Compute Total",
"Description": "...",
"PercentComplete": 100,
"Value": 1,
"Style": "Success",
"Transitions": []
}
]
}]

  • Bug repair
    We can fix such bug using the following statement.
   // call this function to send a request
    function ComputeTotal() public
    {
        // Fix
        if (State != StateType.Create)
        {
            revert();
        }
       ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant