Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate arguments passed into cadence programs #724

Merged
merged 15 commits into from
Apr 8, 2021
Merged
6 changes: 5 additions & 1 deletion runtime/convertValues.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ func exportCompositeValue(v *interpreter.CompositeValue, inter *interpreter.Inte
fields[i] = exportValueWithInterpreter(fieldValue, inter, results)
}

// NOTE: when modifying the cases below,
// also update the error message below!

switch staticType.Kind {
case common.CompositeKindStructure:
return cadence.NewStruct(fields).WithType(t.(*cadence.StructType))
Expand All @@ -218,6 +221,7 @@ func exportCompositeValue(v *interpreter.CompositeValue, inter *interpreter.Inte
common.CompositeKindResource.Name(),
common.CompositeKindEvent.Name(),
common.CompositeKindContract.Name(),
common.CompositeKindEnum.Name(),
},
"or",
),
Expand Down Expand Up @@ -378,7 +382,7 @@ func importValue(value cadence.Value) interpreter.Value {
}
case cadence.Enum:
return importCompositeValue(
common.CompositeKindStructure,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

common.CompositeKindEnum,
v.EnumType.Location,
v.EnumType.QualifiedIdentifier,
v.EnumType.Fields,
Expand Down
Loading