Skip to content

safeCopyInputs #269

@zsystm

Description

@zsystm

We should apply the following to every places where are using method.Inputs.Copy(&input, args) to avoid panic during parsing precompile's inputs.

// safeCopyInputs is a helper function to safely copy inputs from the method to the args.
// It recovers from any panic that might occur during the copy operation and returns an error instead.
func safeCopyInputs(method *abi.Method, args []interface{}, pageRequest *PageRequest) (err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic during method.Inputs.Copy: %v", r)
}
}()
err = method.Inputs.Copy(pageRequest, args)
return
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions