Skip to content

Commit

Permalink
Merge branch 'main' into remove_pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
iFrostizz committed May 1, 2024
2 parents 2f0063d + 4ef8b2a commit aebc12a
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions x/programs/cmd/simulator/cmd/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (c *runCmd) createCallParams(ctx context.Context, db state.Immutable, param
cp := make([]actions.CallParam, 0, len(params))
for _, param := range params {
switch param.Type {
case "program", String, ID:
case String, ID:
stepIdStr, ok := param.Value.(string)
if !ok {
return nil, fmt.Errorf("%w: %s", ErrFailedParamTypeCast, param.Type)
Expand Down Expand Up @@ -348,31 +348,6 @@ func (c *runCmd) createCallParams(ctx context.Context, db state.Immutable, param
return cp, nil
}

// verifyProgramIDStr verifies a string is a valid ID and checks the programIDStrMap for
// the synthetic identifier `step_N` where N is the step the id was created from
// execution.
func (c *runCmd) verifyProgramIDStr(idStr string) (string, error) {
// if the id is valid
_, err := ids.FromString(idStr)
// myId, err := ids.FromString(idStr)
if err == nil {
return idStr, nil
// return myId, nil

}

// check if the id is a synthetic identifier
if strings.HasPrefix(idStr, "step_") {
stepID, ok := c.programIDStrMap[idStr]
if !ok {
return "", fmt.Errorf("failed to map to id: %s", idStr)
}
return stepID, nil
}

return idStr, nil
}

// generateRandomID creates a unique ID.
// Note: ids.GenerateID() is not used because the IDs are not unique and will
// collide.
Expand Down

0 comments on commit aebc12a

Please sign in to comment.