Skip to content

Concerns regarding the DeepFill method #4777

@Kouteki

Description

@Kouteki

Severity: Minor

Description

In mempackage_type:gnovm/pkg/gnolang/values_fill.go, the DeepFill method for various types is defined. Among these definitions, several are related to the types that are supposed to be used only for constant expressions, namely StringValue, BigintValue, and BigdecValue.

These types are not collected by the GC, as it can be observed in mempackage_type:gnovm/pkg/gnolang/garbage_collector.go:333-343. The reason for these types being protected from the GC is that they are only used for constant expressions. This is also confirmed by the docs for types BigintValue and BigdecValue.

In mempackage_type:gnovm/pkg/gnolang/values_fill.go:3-13, the DeepFill implementations for these types silently return the input value without any modification. While the constant semantics is not violated, calls to these methods can indicate incorrect handling of the constant expressions.

Furthermore, in mempackage_type:gnovm/pkg/gnolang/values_fill.go:63-69, for several other types, the DeepFill method is not implemented and explicitly panics when called.

Recommendation

We recommend handling constant expressions without the necessity to call the DeepFill function, as well as either removing the methods or implementing assertions in the debug builds that the method is not actually called for types StringValue, BigintValue and BigdecValue.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions