hats-finance / Most--Aleph-Zero-Bridge-0xab7c1d45ae21e7133574746b2985c58e0ae2e61d

Aleph Zero bridge to Ethereum
Apache License 2.0
0 stars 1 forks source link

`Migrations::setCompleted` Doesn't Increment `last_completed_migration` Correctly #14

Open hats-bug-reporter[bot] opened 4 months ago

hats-bug-reporter[bot] commented 4 months ago

Github username: @0xmahdirostami Twitter username: 0xmahdirostami Submission hash (on-chain): 0xdc5e623268598a3fb522fb35cea865c7d6a02b6a5e290ba94e9816ddec551676 Severity: low

Description: Description
The setCompleted function is responsible for updating the last_completed_migration variable, which keeps track of the last migration executed. However, it currently doesn't correctly increment last_completed_migration by 1 in each migration.

Impact
Incorrect value for last_completed_migration.

Revised Code File (Optional)

    function setCompleted(uint256 completed) public restricted {
-        last_completed_migration = completed;
+    last_completed_migration = completed + 1;
}
0xmahdirostami commented 4 months ago

it must be labelled as a minor.

krzysztofziobro commented 3 months ago

Number of the completed migration is passed as an argument, so I don't see why we should increase it additionally.