Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

local show array variable error. #291

Closed
btc2nxt opened this issue Apr 7, 2016 · 6 comments
Closed

local show array variable error. #291

btc2nxt opened this issue Apr 7, 2016 · 6 comments

Comments

@btc2nxt
Copy link

btc2nxt commented Apr 7, 2016

image

get b from array bugets, but show wrong information.
now budgets only has got one item, and the final result is Ok.

@chriseth
Copy link
Contributor

Would it be possible to reproduce this error with a simpler code example?
Which part of the information is wrong, i.e. what do you expect and what did actually happen?

@btc2nxt
Copy link
Author

btc2nxt commented Apr 20, 2016

Mix 1.0.1
solidity 0.3.3
QT 5.4.1
Ubuntu 14.04(edit in windows b.state= -3950493856964)

mix files are below
https://github.com/btc2nxt/Uther-project/tree/master/contracts/test-foundation

debug in block 23, when run to function passBudget( b.state = State.Passed;)

local variables are
b=budget[0]
{
b: {
creationDate: '7',
data:
'0x0000000000000000000000000000000000000000000000000000000000000007',
description: '',
recipient: '0x88fadf4a6a35c61c3f88194ec5ae162c89440707',
state: '0',
votes: [ ]
},
i: '32',
proDelegatorNum: '5',
state: '0'
}
b.state should be '3', actually budget[0].state =3(right)
looks like all b's contents are wrong.

there are 7 items in budgets
{
budgets: [{
amount: '700000000000000000000',
createdBy: '0',
creationDate: '1461133242',
description: '0,700',
executeDays: '604800',
recipient: '0x122d0ebbd19694df9f75b9fe67f85c35f6e052a6',
state: '3',
votes:
'0x0202020202010000000000000000000000000000000000000000000000000000'
}, {
amount: '600000000000000000000',
createdBy: '0',
creationDate: '1461133244',
description: '1',
executeDays: '51840000',
recipient: '0x1566680d8b3ad1f71b1b9d1514db53c599c94688',
state: '1',
votes:
'0x0200000000000000000000000000000000000000000000000000000000000000'
}, {
amount: '500000000000000000000',
createdBy: '0',
creationDate: '1461133245',
description: '0',
executeDays: '43200000',
recipient: '0xf025d81196b72fba60a1d4dddad12eeb8360d828',
state: '1',
votes:
'0x0002010000000000000000000000000000000000000000000000000000000000'
}, {
amount: '500000000000000000000',
createdBy: '0',
creationDate: '1461133246',
description: '0',
executeDays: '43200000',
recipient: '0xf025d81196b72fba60a1d4dddad12eeb8360d828',
state: '1',
votes:
'0x0000010000000200000000000000000000000000000000000000000000000000'
}, {
amount: '500000000000000000000',
createdBy: '0',
creationDate: '1461133247',
description: '0',
executeDays: '172800',
recipient: '0xf025d81196b72fba60a1d4dddad12eeb8360d828',
state: '1',
votes:
'0x0000000000010000000000000000000000000000000000000000000000000000'
}, {
amount: '500000000000000000000',
creationDate: '1461133249',
description: '0',
executeDays: '172800',
recipient: '0xf025d81196b72fba60a1d4dddad12eeb8360d828',
state: '0',
votes: [ ]
}, {
amount: '500000000000000000000',
creationDate: '1461133250',
description: '0',
executeDays: '172800',
recipient: '0xf025d81196b72fba60a1d4dddad12eeb8360d828',
state: '0',
votes: [ ]
} ],
debatingDays: undefined,
],
founder: '0x38f388fadf4a6a35c61c3f88194ec5ae162c8944',
maxDelegators: '7',
numBudgets: '7',
totalDelegators: '7'
}

2016-04-12 17:00 GMT+08:00 chriseth notifications@github.com:

Would it be possible to reproduce this error with a simpler code example?
Which part of the information is wrong, i.e. what do you expect and what
did actually happen?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#291 (comment)

@yann300
Copy link
Contributor

yann300 commented Jun 7, 2016

@btc2nxt could you repost the contract source code with all transactions that are executed?
thanks!

@yann300
Copy link
Contributor

yann300 commented Jun 7, 2016

@yann300
Copy link
Contributor

yann300 commented Jun 7, 2016

@btc2nxt
hm we still need to add warning when variables are not compliant with best practices. sorry for that.
line 161 in passBudget, just declare b as in memory:
Budget memory b = budgets[_budgetID];

@yann300
Copy link
Contributor

yann300 commented Jun 7, 2016

Here is the story for that:
#108
I close, please reopen if you still have the issue.

@yann300 yann300 closed this as completed Jun 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants