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

[natives] expose all feature flags inside NativeContext as an extension #7038

Merged
merged 5 commits into from
Mar 11, 2023

Conversation

alinush
Copy link
Contributor

@alinush alinush commented Mar 9, 2023

Description

Exposes the feature flags inside the Rust implementation of Move native functions. This is useful for the generic elliptic-curves Move module (#6550), which will be upgradeable by feature gating newly-added curves directly inside the Rust natives.

@alinush alinush requested review from zjma and mstraka100 March 9, 2023 23:34
@alinush alinush force-pushed the alin/native-feature-flag-context branch 2 times, most recently from 1c79058 to 272bce7 Compare March 9, 2023 23:40
@alinush alinush requested a review from vgao1996 March 10, 2023 01:35
Copy link
Contributor

@vgao1996 vgao1996 left a comment

Choose a reason for hiding this comment

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

Hmm... I feel like this may not be the best way to expose feature flags to native functions.

Extensions are rather heavy-weight and involve dynamic casting. Instead, you can pass the features to the make_all function in each crate, which will then pass them down to each native function. I'd also recommend you add a features: Features field to the SafeNativeContext and make it available to natives. Notice that SafeNativeContext already contains the timed features, so we just need to replicate that pattern for features.

@vgao1996
Copy link
Contributor

I'm aware that struct Features contains a vector, so we may not want to clone it often. Feel free to put it in an Arc before passing it down to the natives. Alternatively you could also change its representation from Vec to something like SmallVec, but I don't know if that's gonna work with serde.

@alinush
Copy link
Contributor Author

alinush commented Mar 10, 2023

I'm aware that struct Features contains a vector, so we may not want to clone it often. Feel free to put it in an Arc before passing it down to the natives. Alternatively you could also change its representation from Vec to something like SmallVec, but I don't know if that's gonna work with serde.

Makes sense to me! I'll use an std::sync::Arc then & see how things work out.

@alinush alinush force-pushed the alin/native-feature-flag-context branch from 272bce7 to fef208a Compare March 10, 2023 16:57
@alinush alinush requested a review from vgao1996 March 10, 2023 18:45
@alinush alinush enabled auto-merge (squash) March 10, 2023 23:18
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 8023 TPS, 4742 ms latency, 7100 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: 3b17b868d4642e25455d65318fbf7f4de4260ddb
compatibility::simple-validator-upgrade::single-validator-upgrade : 5352 TPS, 7304 ms latency, 10500 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: 3b17b868d4642e25455d65318fbf7f4de4260ddb
compatibility::simple-validator-upgrade::half-validator-upgrade : 5118 TPS, 7869 ms latency, 11200 ms p99 latency,no expired txns
4. upgrading second batch to new version: 3b17b868d4642e25455d65318fbf7f4de4260ddb
compatibility::simple-validator-upgrade::rest-validator-upgrade : 7009 TPS, 5463 ms latency, 10100 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb passed
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite framework_upgrade success on cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb

Compatibility test results for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb (PR)
Upgrade the nodes to version: 3b17b868d4642e25455d65318fbf7f4de4260ddb
framework_upgrade::framework-upgrade::full-framework-upgrade : 6674 TPS, 5797 ms latency, 9700 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 3b17b868d4642e25455d65318fbf7f4de4260ddb passed
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite land_blocking success on 3b17b868d4642e25455d65318fbf7f4de4260ddb

performance benchmark with full nodes : 5768 TPS, 6878 ms latency, 13000 ms p99 latency,(!) expired 140 out of 2463260 txns
Test Ok

@alinush alinush merged commit 01f97ef into main Mar 11, 2023
@alinush alinush deleted the alin/native-feature-flag-context branch March 11, 2023 00:05
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.

3 participants