-
Notifications
You must be signed in to change notification settings - Fork 46
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
Frrist/parse vm message codec #1150
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frrist
force-pushed
the
frrist/parse-vm-message-codec
branch
2 times, most recently
from
March 2, 2023 03:17
58258ec
to
ecff81c
Compare
- use lotus deps from filecoin-project/lotus#10372
frrist
force-pushed
the
frrist/parse-vm-message-codec
branch
from
March 2, 2023 03:39
ecff81c
to
f2645a7
Compare
frrist
commented
Mar 2, 2023
Comment on lines
+38
to
+81
func ParseVmMessageParams(params []byte, paramsCodec uint64, method abi.MethodNum, actCode cid.Cid) (string, string, error) { | ||
m, found := ActorRegistry.Methods[actCode][method] | ||
if !found { | ||
// if the method wasn't found it is likely the case the method was one of: | ||
// https://github.com/filecoin-project/builtin-actors/blob/f5311fe735df4d9baf5f82d4b3db10f3c51688c4/actors/docs/README.md?plain=1#L31 | ||
// so we just marshal the raw value to json and bail with a warning | ||
paramj, err := json.Marshal(params) | ||
if err != nil { | ||
return "", "", err | ||
} | ||
err = fmt.Errorf("unknown method %d with codec %d for actorCode %s name %s", method, paramsCodec, actCode, builtin.ActorNameByCode(actCode)) | ||
log.Warnw("parsing vm message params", "error", err) | ||
return string(paramj), builtin.ActorNameByCode(actCode), nil | ||
} | ||
// If the codec is 0, the parameters/return value are "empty". | ||
// If the codec is 0x55, it's bytes. | ||
if paramsCodec == 0 || paramsCodec == 0x55 { | ||
return string(params), m.Name, nil | ||
} | ||
return ParseParams(params, method, actCode) | ||
} | ||
|
||
func ParseVmMessageReturn(ret []byte, retCodec uint64, method abi.MethodNum, actCode cid.Cid) (string, string, error) { | ||
m, found := ActorRegistry.Methods[actCode][method] | ||
if !found { | ||
// if the method wasn't found it is likely the case the method was one of: | ||
// https://github.com/filecoin-project/builtin-actors/blob/f5311fe735df4d9baf5f82d4b3db10f3c51688c4/actors/docs/README.md?plain=1#L31 | ||
// so we just marshal the raw value to json and bail with a warning | ||
retJ, err := json.Marshal(ret) | ||
if err != nil { | ||
return "", "", err | ||
} | ||
err = fmt.Errorf("unknown method %d with codec %d for actorCode %s name %s", method, retCodec, actCode, builtin.ActorNameByCode(actCode)) | ||
log.Warnw("parsing vm message return", "error", err) | ||
return string(retJ), builtin.ActorNameByCode(actCode), nil | ||
} | ||
// If the codec is 0, the parameters/return value are "empty". | ||
// If the codec is 0x55, it's bytes. | ||
if retCodec == 0 || retCodec == 0x55 { | ||
return string(ret), m.Name, nil | ||
} | ||
return ParseReturn(ret, method, actCode) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Special handling for vm message params and returns please review this section, other changes are mechanical
kasteph
approved these changes
Mar 2, 2023
birdychang
approved these changes
Mar 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
Terryhung
pushed a commit
that referenced
this pull request
Mar 3, 2023
birdychang
pushed a commit
that referenced
this pull request
Mar 8, 2023
* deps: update to lotus 1.20.0-rc2 * chore: update actor gen - clean up types, remove lily actors types, replace with go-state-types * Frrist/receipt events schema (#1132) * feat: implement actor event task and schema - track the value of EventRoots contained in message receipts. * feat: implement message param schema and task - create a table that records raw message parameters * feat: track raw receipt return value * fix schema index's after rebase on master * fix: use builtin lotus method to get events - it handles the case of legacy events * fixup! Frrist/receipt events schema (#1132) * deps: replace deprecated blocks package - use github.com/ipfs/go-libipfs/blocks instead * deps: update to v1.20.0 release * feat: track verifreg actor claim HAMT changes (#1141) * feat: track verified registry actor claim HAMT changes - addresses request made here: https://github.com/protocol/pldw/issues/177#issuecomment-1372920524 * fix: correctly diff new actor version (#1145) * fix: correctly diff new actor version - closes #1144 * chore: remove unused metrics * metric: track GettActorStateChanges duration * feat: update lotus deps to support vm para/ret marshal (#1150) - use lotus deps from filecoin-project/lotus#10372 * fix: resolve the duplication issue of db migration version --------- Co-authored-by: Terry <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.