Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/abi/abi_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface Segment {
right: number;
}

const staticArrayRegexp = /^([a-z\d[\](),]+)\[([1-9][\d]*)]$/;
const staticArrayRegexp = /^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/;
const ufixedRegexp = /^ufixed([1-9][\d]*)x([1-9][\d]*)$/;

export type ABIValue =
Expand Down Expand Up @@ -414,9 +414,9 @@ export class ABIArrayStaticType extends ABIType {

constructor(argType: ABIType, arrayLength: number) {
super();
if (arrayLength < 1) {
if (arrayLength < 0) {
throw new Error(
`static array must have a length greater than 0: ${arrayLength}`
`static array must have a non negative length: ${arrayLength}`
);
}
this.childType = argType;
Expand Down
2 changes: 1 addition & 1 deletion tests/10.ABI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('ABI type checking', () => {
'[][][]',
'stuff[]',
// static array
'ufixed32x10[0]',
Comment thread
ahangsu marked this conversation as resolved.
'bool[01]',
'byte[10 ]',
'uint64[0x21]',
// tuple
Expand Down