effectai / effect-network

Smart contracts and documentation for Effect Network
MIT License
46 stars 9 forks source link

Bug: out of bounds error with reservation for `task_idx` #119

Open djmbritt opened 1 year ago

djmbritt commented 1 year ago

So, I've created a campaign with a batch of 4 tasks.

r = campaign.create_batch(
e,
0, # campaign id = 0
[
{ 'image': 'https://ipfs.effect.ai/ipfs/QmVuSBpoSEUdHmB2owcbAQnModzfcbEme6w6nCkJDDJcy4'},
{ 'image': 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Attentive_%2815531899006%29.jpg/1920px-Attentive_%2815531899006%29.jpg' },
{ 'image': 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Comparison_carbon_dioxide_water_phase_diagrams.svg/1024px-Comparison_carbon_dioxide_water_phase_diagrams.svg.png' },
{ 'image': 'https://upload.wikimedia.org/wikipedia/commons/5/54/Borphase.jpg' }
],
'300.0904 EFX', # reward, thus => tasks * reps * 24.4242 EFX = reward
2, # reps
)

But as I go through it, at the end, I still get a reservation with a task_idx === 4

{
"id": 4,
"task_idx": 4,
"account_id": 3,
"batch_id": 0,
"reserved_on": "2023-10-11T12:37:05",
"campaign_id": 0
}

So, I think it gets incremented by 1 too many at the end.

jeisses commented 1 year ago

I've attempted to fix this here: https://github.com/effectai/effect-network/commit/f7c28c77480bd8d37f856ea1455d0985485e26e7

It has been deployed to jungle4. Could you check if it is resolved now?