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

fix: Move pure methods out of External crate #3030

Merged
merged 8 commits into from
Jul 27, 2020

Conversation

evgenykuzyakov
Copy link
Collaborator

External crate should only contain methods that requires something external to complete. E.g. when interacting with the blockchain.
Pure functions such as sha256 and keccak hashes can go directly to vm-logic.
Bumping versions to 1.1.0
Fixes: #3019

Test plan:

  • CI

@gitpod-io
Copy link

gitpod-io bot commented Jul 23, 2020

Copy link
Contributor

@willemneal willemneal left a comment

Choose a reason for hiding this comment

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

Looks good but am confused with the spacing e.g.

        use sha2::Digest;

        let value_hash = sha2::Sha256::digest(&value);

        self.internal_write_register(register_id, value_hash.as_ref().to_vec())

@evgenykuzyakov
Copy link
Collaborator Author

Looks good but am confused with the spacing e.g.

I separated use since it's import, but the space between the last 2 can be removed.

@willemneal
Copy link
Contributor

Also as a Rust noob, is there a reason to import so late?

@evgenykuzyakov
Copy link
Collaborator Author

Also as a Rust noob, is there a reason to import so late?

I think we import Digest to be local only to avoid name conflict with other Digest(s).

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.

Refactor near_vm_logic to remove pure methods from ::External.
5 participants