I understand, that as the list grows it is going to cost infinite gas. I'm making a temp array in memory of size of our dynamic array at present size and then returning that array. But does that make it impractical to give "getlist" function of something as Adhar card in india list? PS: The function works on remix for now, with limited entries but fails on truffle/when i try to call it from my app via js


Without seeing your code it is difficult to fully understand.

However from one side may be that you need some 'for' loops without a definite maximum (it dependes on the size of the array!) in order to iterate and this switch on the cited warning; on the other side take into account that in remix a simple string returned or, often, even passed as argument in function call, can switch on the warning for infinite gas, being the strings in Solidity treated as dynamic array, as you may know.

The correct procedure when those warning are switched on is to check twice your code for gas consumption; if you think that all is ok, simply ignore the warning, deploy your code and test it for gas consumption.

Very often you will not find any real problem there.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.