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

Runtime: Add several new methods #1150

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Runtime: Add several new methods #1150

merged 3 commits into from
Feb 2, 2023

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Feb 2, 2023

Extracted from next.

This PR adds the following methods to the Runtime interface:

  • actor_balance
  • gas_available
  • tipset_timestamp
  • tipset_cid
  • hash
  • hash_64
  • recover_secp_public_key

Note: This isn't the most cohesive PR, sorry :')

/// The gas still available for computation
fn gas_available(&self) -> u64;

/// The current tipset's timestamp, as UNIX seconds
Copy link
Member

Choose a reason for hiding this comment

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

Could you clarify whether "current" is the tipset that includes the message, or the subsequent one when the message is executed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

fn tipset_timestamp(&self) -> u64;

/// The hash of on of the last 256 blocks
fn tipset_cid(&self, epoch: i64) -> Option<Cid>;
Copy link
Member

Choose a reason for hiding this comment

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

What happens if epoch is more than 256 ago? Just None? Kinda wierd we don't get error numbers here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree -- I think a Result would make more sense here. I've raised it here.

Also the comment on this is wrong (AFAIC tell) -- you can lookup Finality epochs. I'm going to update it.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, yes I would expect FINALITY too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants