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

feat: Add ability to import methods guarded by protocol feature #3826

Merged
merged 3 commits into from
Jan 21, 2021

Conversation

evgenykuzyakov
Copy link
Collaborator

@evgenykuzyakov evgenykuzyakov commented Jan 20, 2021

Modifies wrapped_import macro to add an ability to introduce new host methods.
This change doesn't modify the protocol.

Test plan:

@@ -264,4 +277,7 @@ wrapped_imports! {
// ###############
validator_stake<[account_id_len: u64, account_id_ptr: u64, stake_ptr: u64] -> []>,
validator_total_stake<[stake_ptr: u64] -> []>,
// ###############
// An example to add a protocol feature guarded host method
// #["protocol_feature_evm", EVM] test_api<[a: u64] -> []>,
Copy link
Member

Choose a reason for hiding this comment

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

This example seems to be confusing, as evm is not executed in near-vm-runner. Should we use another information here?
Also, consider add a test to guarded api?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. The test is here: #3827

But I need to compile a contract with this import and check that it fails to run in the previous protocol version and runs in the new protocol version.

We can do this for a real new import. For example burn_near

@evgenykuzyakov evgenykuzyakov merged commit 0ef1b85 into master Jan 21, 2021
@evgenykuzyakov evgenykuzyakov deleted the ability-to-add-imports branch January 21, 2021 19:03
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