Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
iFrostizz committed Apr 29, 2024
1 parent 2e1cdb4 commit 942dbac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
24 changes: 0 additions & 24 deletions x/programs/cmd/simulator/cmd/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,30 +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
3 changes: 1 addition & 2 deletions x/programs/cmd/simulator/vm/actions/program_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ func (t *ProgramExecute) Execute(
programBytes, exists, err := storage.GetProgram(context.Background(), mu, programID)
if !exists {
err = errors.New("unknown program")
return false, 1, utils.ErrBytes(err), err
}
if err != nil {
return false, 1, utils.ErrBytes(err), err
return false, 1, utils.ErrBytes(err), nil
}

// TODO: get cfg from genesis
Expand Down

0 comments on commit 942dbac

Please sign in to comment.