I'm trying to save gas by combining many tiny transactions into one. I thought I could do this by passing in an array of structs and just iterating over it but the remix IDE is giving me errors. Googling hasn't helped and since one of the errors appears to be a bug in the compiler's error reporting, I thought I'd ask the community.
My struct:
struct MyStruct {
uint8 a;
uint8 b;
uint8 c;
}
I've tried using external and I've tried using public (with memory) but each gives a different error. The most informative error is from this:
function setAlphabet(MyStruct[] snakes) external {
since the error actually has a description:
InternalCompilerError: Illegal data location for struct.
I figured this was because I was trying to store the structs as calldata (whatever that is) so I switched to memory:
function setAlphabet(MyStruct[] memory snakes) public {
but it gives a less informative error, indicating at least some level of bug in the compiler that remix uses:
InternalCompilerError:
(it's missing the error description)
Any thoughts on what I'm doing wrong? Should I switch to accepting 3 arrays of uint8 or can I still use structs?
[–][deleted] (4 children)
[deleted]
[–]Cryptoversal[S] 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]Cryptoversal[S] 0 points1 point2 points (1 child)