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

Improve the cli state call command #6226

Merged
merged 2 commits into from
May 31, 2021
Merged

Conversation

wadealexc
Copy link
Contributor

./lotus state call is currently unusable for most actor methods, as parameter parsing does not support many types.

This PR changes the call command to accept parameters as base64 or hex strings, as these formats are used extensively in other CLI commands.

Additionally, call has been changed to support multiple formats for message return:

  • decoded (default): Returns JSON based on the return type of the method called
  • raw: Returns the raw []byte found in the receipt
  • hex: Converts the returned data to hex
  • base64 Converts the returned data to base64

Here's an example:

alex-pc$ lotus state call --from f0127573 f0127595 23 RACipzE=
Call receipt:
Exit code: 0
Gas Used: 0
Return:
{}
alex-pc$ lotus state call f04 9
Call receipt:
Exit code: 0
Gas Used: 0
Return:
{
  "RawBytePower": "5903779890947162112",
  "QualityAdjPower": "5905615863821533184",
  "PledgeCollateral": "71023842284078169744154578",
  "QualityAdjPowerSmoothed": {
    "PositionEstimate": "2009447455836142781845833807839954701917245286790497884694",
    "VelocityEstimate": "5306208777810336014187026111611315363244696189173411"
  }
}

@wadealexc wadealexc changed the title [WIP] Improve the cli state call command Improve the cli state call command May 10, 2021
@jennijuju jennijuju added the P2 P2: Should be resolved label May 24, 2021
@jennijuju jennijuju added this to the v1.11.x milestone May 24, 2021
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

This is much better, thanks!

Alex Wade and others added 2 commits May 31, 2021 21:08
@magik6k magik6k force-pushed the feat/cli-state-call-improvements branch from 76acbe8 to d9aa1fa Compare May 31, 2021 19:13
@magik6k magik6k enabled auto-merge May 31, 2021 19:15
@magik6k magik6k disabled auto-merge May 31, 2021 19:22
@magik6k magik6k merged commit 9fd3c8c into master May 31, 2021
@magik6k magik6k deleted the feat/cli-state-call-improvements branch May 31, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 P2: Should be resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants