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

[WIP]feat: vm result, error handling #718

Closed
wants to merge 4 commits into from

Conversation

ltzmaxwell
Copy link
Contributor

No description provided.

// in FunctionSignature{}.
// String representation of arg must be deterministic.
// NOTE: very important that there is no malleability.
func ConvertArgToGno(arg string, argT Type) (tv TypedValue) {
Copy link
Contributor

Choose a reason for hiding this comment

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

was this copied from anywhere?

expr := fmt.Sprintf(`pkg.%s(%s)`, fnc, argslist)
xn := gno.MustParseExpr(expr)
func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) sdk.Result {
w := NewWrapper(msg, vm.getGnoStore(ctx))
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a better name.
"Wrapper" is used for things like "CacheWrapper", which actually wraps a singular thing and keeps the method signature the same. In that sense this isn't a "wrapper".

if rt.Kind() == reflect.Struct { // struct kind
var result VMResult
vrf := reflect.ValueOf(&result).Elem()
gno.Gno2GoValue(rtvs[0].V.(gno.PointerValue).TV, vrf)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see why we would want to do this.

Gno2GoValue usage should be restricted, as native values have severe limitations; but here it looks like it is trying to be the default.

I believe we should at the most use a single method to stringify the result of a tx and include the result in the blockchain, but otherwise not depend on it for anything.

If we wanted to pass the result of one tx as args into another, we should be able to express it as two lines of code that get executed. We should not rely on stringification or reflection/native intermediaries to get that job done.

@ltzmaxwell
Copy link
Contributor Author

close for invalid assumption.

@ltzmaxwell ltzmaxwell closed this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants