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

[feature] Add permissioned signer functionality #14521

Open
wants to merge 1 commit into
base: 08-29-create_permissioned_signer_example
Choose a base branch
from

Conversation

runtian-zhou
Copy link
Contributor

@runtian-zhou runtian-zhou commented Sep 4, 2024

Description

Implement rust extension for the permissioned signer, including the new ser/de logic.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Other (specify)

How Has This Been Tested?

This will be tested with future PRs. Also a replay-verify is executed to make sure this feature is not breaking.

Key Areas to Review

We still need to keep the old serialization logic in the bcs module because it can otherwise cause on chain divergence.

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Sep 4, 2024

⏱️ 3h 32m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
rust-move-unit-coverage 19m 🟩
rust-move-unit-coverage 18m 🟩
rust-cargo-deny 15m 🟩🟩🟩🟩🟩 (+3 more)
rust-move-unit-coverage 14m 🟩
general-lints 14m 🟩🟩🟩🟩🟩 (+3 more)
rust-move-unit-coverage 14m 🟩
rust-move-tests 13m 🟩
rust-move-unit-coverage 11m 🟩
rust-move-tests 9m 🟥
rust-move-tests 9m 🟥
rust-move-tests 9m 🟥
rust-move-tests 9m 🟥
rust-move-tests 9m 🟥
rust-move-tests 8m 🟥
check-dynamic-deps 8m 🟩🟩🟩🟩🟩 (+3 more)

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

runtian-zhou commented Sep 4, 2024

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 85.80247% with 23 lines in your changes missing coverage. Please review.

Project coverage is 60.1%. Comparing base (e7391d6) to head (7c5a356).

Files with missing lines Patch % Lines
...party/move/move-vm/types/src/values/values_impl.rs 75.0% 13 Missing ⚠️
...-move/framework/src/natives/permissioned_signer.rs 94.2% 3 Missing ⚠️
...rd_party/move/move-compiler-v2/src/plan_builder.rs 50.0% 3 Missing ⚠️
third_party/move/move-vm/types/src/value_serde.rs 40.0% 3 Missing ⚠️
third_party/move/move-core/types/src/value.rs 92.8% 1 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##           08-29-create_permissioned_signer_example   #14521    +/-   ##
==========================================================================
  Coverage                                      60.1%    60.1%            
==========================================================================
  Files                                           856      857     +1     
  Lines                                        211026   210762   -264     
==========================================================================
- Hits                                         126865   126723   -142     
+ Misses                                        84161    84039   -122     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 456f5f4 to 55771fc Compare September 4, 2024 20:29
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 31c9b2c to 6d309ff Compare September 4, 2024 20:30
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 55771fc to 070a951 Compare September 5, 2024 00:41
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 6d309ff to 703921b Compare September 5, 2024 00:41
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 070a951 to b832d3d Compare September 9, 2024 07:08
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 703921b to 48991ff Compare September 9, 2024 07:08
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from b832d3d to 6ddb481 Compare September 9, 2024 07:46
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 48991ff to 906c7c7 Compare September 9, 2024 07:47
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 6ddb481 to 8b92b98 Compare September 9, 2024 17:09
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 906c7c7 to 350db4c Compare September 9, 2024 17:09
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 8b92b98 to fa646c8 Compare September 10, 2024 17:24
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 350db4c to dad258f Compare September 10, 2024 17:25
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from fa646c8 to c3aba3a Compare September 10, 2024 17:29
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from dad258f to 6b4da66 Compare September 10, 2024 17:29
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from c3aba3a to 50b556b Compare September 12, 2024 01:49
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 6b4da66 to b1fd015 Compare September 12, 2024 01:50
@runtian-zhou runtian-zhou mentioned this pull request Sep 12, 2024
21 tasks
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 50b556b to 8cd68d5 Compare September 17, 2024 05:08
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from b1fd015 to 6592c01 Compare September 17, 2024 05:08
@lightmark lightmark changed the title Implement rust logics for permissioned signer [feature] Add permissioned signer functionality Sep 17, 2024
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch 3 times, most recently from 1835d3d to 42decc7 Compare September 18, 2024 17:52
@runtian-zhou runtian-zhou requested review from davidiw, movekevin, wrwg and a team as code owners December 14, 2024 15:27
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from bcf98d8 to 93706d9 Compare December 14, 2024 17:59
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 1302971 to 4505dc2 Compare December 14, 2024 17:59
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 93706d9 to cad586d Compare December 16, 2024 16:35
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 4505dc2 to 2dfa163 Compare December 16, 2024 16:35
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from cad586d to 59309c6 Compare December 17, 2024 02:26
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 2dfa163 to 7b93a7d Compare December 17, 2024 02:27
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 59309c6 to dec8882 Compare January 8, 2025 23:54
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 7b93a7d to 4c1f016 Compare January 8, 2025 23:54
@@ -6,7 +6,7 @@
use crate::{
gas_feature_versions::{RELEASE_V1_14, RELEASE_V1_8, RELEASE_V1_9_SKIPPED},
gas_schedule::NativeGasParameters,
ver::gas_feature_versions::{RELEASE_V1_12, RELEASE_V1_13, RELEASE_V1_23},
ver::gas_feature_versions::{RELEASE_V1_12, RELEASE_V1_13, RELEASE_V1_23, RELEASE_V1_25},
Copy link
Contributor

Choose a reason for hiding this comment

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

1_26 now :)

debug_assert!(arguments.len() == 2);

let permission_addr = safely_pop_arg!(arguments, AccountAddress);
let master_addr = safely_pop_arg!(arguments, AccountAddress);
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to verify that the handle exists, either here, or in the move code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was indeed validated on the move side.

third_party/move/move-core/types/src/value.rs Show resolved Hide resolved
Comment on lines +496 to +502
let (_, fields) = MoveStructLayout::signer()
.deserialize(deserializer)?
.into_optional_variant_and_fields();
Ok(MoveValue::Signer(match fields[0] {
MoveValue::Address(addr) => addr,
_ => return Err(D::Error::custom("signer deserialization error")),
}))
Copy link
Contributor

Choose a reason for hiding this comment

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

this deserves a comment on what it does here and why

@@ -691,7 +704,9 @@ impl serde::Serialize for MoveValue {
MoveValue::U128(i) => serializer.serialize_u128(*i),
MoveValue::U256(i) => i.serialize(serializer),
MoveValue::Address(a) => a.serialize(serializer),
MoveValue::Signer(a) => a.serialize(serializer),
MoveValue::Signer(a) => {
MoveStruct::new_variant(0, vec![MoveValue::Address(*a)]).serialize(serializer)
Copy link
Contributor

Choose a reason for hiding this comment

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

this deserves a comment on what it does here and why

@@ -691,7 +704,9 @@ impl serde::Serialize for MoveValue {
MoveValue::U128(i) => serializer.serialize_u128(*i),
MoveValue::U256(i) => i.serialize(serializer),
MoveValue::Address(a) => a.serialize(serializer),
MoveValue::Signer(a) => a.serialize(serializer),
MoveValue::Signer(a) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

MoveValue::Signer doesn't change?

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from dec8882 to cadf003 Compare January 9, 2025 00:54
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch 2 times, most recently from 558c74e to beacad5 Compare January 9, 2025 03:43
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from beacad5 to 5a4e0b4 Compare January 9, 2025 07:57
.github/actions/rust-targeted-unit-tests/action.yaml Outdated Show resolved Hide resolved
aptos-move/e2e-move-tests/src/lib.rs Outdated Show resolved Hide resolved
aptos-move/framework/src/aptos.rs Outdated Show resolved Hide resolved
aptos-move/framework/tests/gate_v2_features.rs Outdated Show resolved Hide resolved
third_party/move/scripts/move_pr.sh Outdated Show resolved Hide resolved
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from cadf003 to 1fd9d08 Compare January 10, 2025 18:47
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 5a4e0b4 to 3bc592c Compare January 10, 2025 18:47
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 1fd9d08 to 600433c Compare January 10, 2025 22:50
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 3bc592c to efd4b1b Compare January 10, 2025 22:50
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 600433c to 2109874 Compare January 10, 2025 22:58
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from efd4b1b to b7dadf2 Compare January 10, 2025 22:58
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from b7dadf2 to a96ae99 Compare January 10, 2025 23:51
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.

4 participants