near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
107 stars 76 forks source link

"ExecutionError": "Smart contract panicked: panicked at 'attempt to subtract with overflow' #185

Open guiltyangel opened 2 years ago

guiltyangel commented 2 years ago

Hi, I need a technical support. The bond (1 NEAR/ proposal) should be returned after they did vote approve/ reject, however, I am having 02 Vote Approve but I just received the reward (0.5 NEAR/ proposal) and not received the BOND yet.

My 02 Proposal IDs are 5205 and 5238:

Hope to hear your feedback.

RasmusTheOnlyOne commented 2 years ago

Have you received the bond for the proposals that has been rejected/expired and finalized?

guiltyangel commented 2 years ago

Only 02 Proposal IDs 5205 and 5238 with Approve facing this issue. My another Proposal IDs had executed yesterday that work well, event Approve/ Rejected / Finalized.

AngelBlock commented 2 years ago

@ctindogaru any hints?

starpause commented 2 years ago

In https://t.me/astro_near Oleg Kalenik speculates: seems like the locked_amount is being calculated wrong

at the moment of this tx the locked amount was 99290000000000000000000. So trying to return bond 1000000000000000000000000 fails

It might’ve started happening after this fix - https://github.com/near-daos/sputnik-dao-contract/commit/2da4bc52aa3753bbd820903556d938bac357891b. However I’m not sure whether the value was correct before.

starpause commented 2 years ago

Via Constantin:

I've experienced this error in the past (where locked_amount was computed wrong).

If u upgrade a v2 to v3 dao, how locked amount is computed has changed between the versions, which causes the locked amount to no longer be accurate. That is what causes this error for a few proposals.

A PR was introduced to compute it right (more context/discussion): https://github.com/near-daos/sputnik-dao-contract/pull/68

If you create your dao from scratch with the v3 code it works fine. Once a DAO is on v3 it will also work fine for new proposals.