FuelError: Invalid u16, too many bytes

delved deeper into what might be causing the error, and I think I’ve got it. In the encode method, some value is being encoded. Turns out, one of the values being encoded is the size of the compiled bytecode. When this bytecode size exceeds 65535 (max value of u16), the byte length size of the value is 3 and the invariant fails.

Now somewhere when encoding this value, the baseType has been set to u16, so the max size of a contract (at least according to the encoder) is max(u16). Is this a bug, or expected?

@anderson @david

this is the error line. A fix for this error is by changing the u16 to u32 to allow for encoding of contracts (and consequently, bytecode sizes). Submitted a PR here – please have a look at lmk what you think