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

Object Code Deployment module with CLI commands #11748

Merged
merged 12 commits into from
Feb 15, 2024

Conversation

JohnChangUK
Copy link
Member

@JohnChangUK JohnChangUK commented Jan 23, 2024

Description

This PR implements AIP-54, Object Code Deployment which outlines the proposal to deploy code to objects. This is an improved alternative over deploying code to accounts and resource accounts. Detailed information in this Doc

  • The module containing the logic to deploy to objects is in aptos-move/framework/aptos-framework/sources/object_code_deployment.move. Each entry function is feature gated as this feature is not available yet for use.
  • As well as the module implementation, the CLI commands are ready to use. Implementation in crates/aptos/src/move_tool/mod.rs.

Test Plan

Integration Tests

Integration tests written under aptos-move/e2e-move-tests/src/tests/object_code_deployment.rs which test end to end workflow. Main test cases defined:

  1. Calling publish in object_code_deployment module with OBJECT_CODE_DEPLOYMENT feature enabled AND disabled.
  2. Verifying PublisherRef is not created when package deployed is immutable.
  3. Calling upgrade in object_code_deployment module with OBJECT_CODE_DEPLOYMENT feature enabled AND disabled.
  4. Calling upgrade fails when transaction signer is NOT owner of PublisherRef.
  5. Calling upgrade fails when incompatible module trying to be upgraded to.
  6. Calling upgrade fails when initial module deployed was immutable to begin with.
  7. Calling freeze_package_registry happy case.
  8. Calling freeze_package_registry fails when transaction signer is NOT owner of PackageRegistry.

CLI Commands

Locally built CLI tool via cargo build --package aptos --release and ran publish and upgrade commands:

  • aptos move create-object-and-publish-package --address-name publish=<address> --named-addresses publish=<address>
  • aptos move upgrade-object-package --object-address <address> --named-addresses publish=<address>

Verified modules were deployed to new objects and upgraded as expected.

Copy link

trunk-io bot commented Jan 23, 2024

⏱️ 32h 56m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-unit-tests 7h 6m 🟩🟩🟩 (+19 more)
rust-move-unit-coverage 6h 57m 🟩🟩🟩 (+19 more)
windows-build 6h 44m 🟩🟩🟩🟩🟩 (+18 more)
rust-move-tests 4h 53m 🟥🟩🟩🟩 (+4 more)
rust-lints 2h 8m 🟩🟩🟩🟩 (+20 more)
run-tests-main-branch 1h 33m 🟥🟥🟥🟥🟥 (+18 more)
check 1h 24m 🟩🟩🟩🟩 (+18 more)
general-lints 58m 🟩🟩🟩🟩 (+19 more)
check-dynamic-deps 50m 🟩🟩🟩🟩 (+18 more)
semgrep/ci 9m 🟩🟩🟩🟩🟩 (+18 more)
file_change_determinator 5m 🟩🟩🟩🟩🟩 (+18 more)
file_change_determinator 4m 🟩🟩🟩🟩🟩 (+19 more)
permission-check 1m 🟩🟩🟩🟩🟩 (+18 more)
permission-check 1m 🟩🟩🟩🟩🟩 (+18 more)
permission-check 1m 🟩🟩🟩🟩🟩 (+18 more)
permission-check 1m 🟩🟩🟩🟩🟩 (+18 more)

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
windows-build 12m 19m -36%

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (f86d996) 71.4% compared to head (cbbd294) 71.4%.
Report is 1 commits behind head on main.

Files Patch % Lines
...cached-packages/src/aptos_framework_sdk_builder.rs 57.1% 15 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #11748    +/-   ##
========================================
  Coverage    71.4%    71.4%            
========================================
  Files         800      802     +2     
  Lines      183827   184016   +189     
========================================
+ Hits       131317   131496   +179     
- Misses      52510    52520    +10     

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

@JohnChangUK JohnChangUK force-pushed the main branch 16 times, most recently from 20292b0 to 61a57c5 Compare January 24, 2024 21:53
@JohnChangUK JohnChangUK changed the title Object Code Deployment module with CLI commands generated Object Code Deployment module with CLI commands Jan 24, 2024
@@ -45,7 +45,7 @@ fn test_module_event_enabled() {
vec![bcs::to_bytes(&10u64).unwrap()],
);
let events = h.get_events();
assert_eq!(events.len(), 12);
assert_eq!(events.len(), 13);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is because we emit PublishPackage event in code.move when a package gets published.

@JohnChangUK JohnChangUK force-pushed the main branch 2 times, most recently from ee850e2 to 1b7d0ae Compare February 1, 2024 23:20
@JohnChangUK JohnChangUK force-pushed the main branch 2 times, most recently from 970275b to cef4244 Compare February 13, 2024 21:11
@JohnChangUK JohnChangUK enabled auto-merge (squash) February 15, 2024 01:35

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite compat success on aptos-node-v1.8.3 ==> cbbd29441d59761a3dece31ebd6532d67bdc984b

Compatibility test results for aptos-node-v1.8.3 ==> cbbd29441d59761a3dece31ebd6532d67bdc984b (PR)
1. Check liveness of validators at old version: aptos-node-v1.8.3
compatibility::simple-validator-upgrade::liveness-check : committed: 4643 txn/s, latency: 6694 ms, (p50: 6900 ms, p90: 9600 ms, p99: 11900 ms), latency samples: 181100
2. Upgrading first Validator to new version: cbbd29441d59761a3dece31ebd6532d67bdc984b
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 1772 txn/s, latency: 15670 ms, (p50: 19200 ms, p90: 21900 ms, p99: 22300 ms), latency samples: 92160
3. Upgrading rest of first batch to new version: cbbd29441d59761a3dece31ebd6532d67bdc984b
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 1814 txn/s, latency: 16164 ms, (p50: 18900 ms, p90: 22200 ms, p99: 22300 ms), latency samples: 94360
4. upgrading second batch to new version: cbbd29441d59761a3dece31ebd6532d67bdc984b
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 3261 txn/s, latency: 9507 ms, (p50: 9900 ms, p90: 13000 ms, p99: 14200 ms), latency samples: 130460
5. check swarm health
Compatibility test for aptos-node-v1.8.3 ==> cbbd29441d59761a3dece31ebd6532d67bdc984b passed
Test Ok

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on cbbd29441d59761a3dece31ebd6532d67bdc984b

two traffics test: inner traffic : committed: 7697 txn/s, latency: 4963 ms, (p50: 4500 ms, p90: 6000 ms, p99: 12600 ms), latency samples: 3325240
two traffics test : committed: 100 txn/s, latency: 2253 ms, (p50: 2100 ms, p90: 2400 ms, p99: 8000 ms), latency samples: 1820
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.218, avg: 0.204", "QsPosToProposal: max: 0.169, avg: 0.150", "ConsensusProposalToOrdered: max: 0.572, avg: 0.532", "ConsensusOrderedToCommit: max: 0.468, avg: 0.447", "ConsensusProposalToCommit: max: 1.003, avg: 0.979"]
Max round gap was 1 [limit 4] at version 1248986. Max no progress secs was 4.864744 [limit 15] at version 1248986.
Test Ok

@JohnChangUK JohnChangUK merged commit 18994ca into aptos-labs:main Feb 15, 2024
83 of 86 checks passed
danielxiangzl added a commit that referenced this pull request Feb 16, 2024
* clean error log lines (#12019)

* [table info][2/4] add utils for table info backup and restore and redesign the db read (#11793)

* separate indexer async v2 db from aptosdb

* address comments

* add utils for table info backup and restore and redesign the db read

* address comments to spawn block sync file ops

* address comments

* tests for events and improve event v1 handling (#12012)

* [move-vm] Cache verified modules (#12002)

* [move-vm] Cache verified modules

* fixup! [move-vm] Cache verified modules

* [passkey] Add MAX_BYTES limit for signatures (#11697)

* [passkey] Add MAX_BYTES limit for signatures

* [passkey] Add tracing for AssertionSignature type and fix README

* [passkey] Rebased on latest main, rerun authenticator_regenerate.sh

* Object Code Deployment module with CLI commands generated (#11748)

* [simple] rename RG split in VmChangeSet flag (#12027)

* rename RG split in VmChangeSet flag

old name was stale, when charging was different

* [fuzzing] fixes oss-fuzz FP and fuzz.sh (#12030)

* [fuzzing] fixes oss-fuzz FP and fuzz.sh

* Update Docker images (#12026)

Co-authored-by: sionescu <sionescu@users.noreply.github.com>

* Update release.yaml (#12020)

* Update release.yaml

* enable REFUNDABLE_BYTES

* enable FairnessShuffler

* enable WEBAUTHN_SIGNATURE

* AIP-54 Object Code Deployment release addition

* enable vtxn and jwk consensus

* Update release.yaml

adding aggregators v2 flags, and updating execution onchain config

* add feature flag for zkID (ZK-only mode)

* fix jwk/zkid entries in release yaml 1.10 (#12024)

* update

* update

* Update release.yaml

fix flag name

* Update release.yaml

rename feature

---------

Co-authored-by: aldenhu <msmouse@gmail.com>
Co-authored-by: hariria <hariria@usc.edu>
Co-authored-by: John Chang <johnchang9094@gmail.com>
Co-authored-by: danielxiangzl <xiangzhuolun@gmail.com>
Co-authored-by: igor-aptos <110557261+igor-aptos@users.noreply.github.com>
Co-authored-by: Alin Tomescu <tomescu.alin@gmail.com>
Co-authored-by: zhoujunma <zjma@users.noreply.github.com>

* Cherry-pick VM changes (#12021)

* [gas] add gas charges for type creation

* [gas-calibration] Add calibration sample

* [move-vm] Implement a per-frame cache for paranoid mode

* fixup! [move-vm] Implement a per-frame cache for paranoid mode

* fixup! fixup! [move-vm] Implement a per-frame cache for paranoid mode

* fixup! fixup! fixup! [move-vm] Implement a per-frame cache for paranoid mode

* fixup! fixup! fixup! fixup! [move-vm] Implement a per-frame cache for paranoid mode

* [gas] add gas charges for dependencies

---------

Co-authored-by: Runtian Zhou <runtian@aptoslabs.com>

* trivial doc fix

* [GHA] Upgrade actions/checkout to v4

* jwk ob counters (#12048)

* Revert "[GHA] Upgrade actions/checkout to v4"

This reverts commit 04d078f.

* [CI][indexer] fix the e2e localnet. (#12047)

* fix the e2e localnet.

* fix the e2e localnet.

* bump latest gas feature version to 14

Also be conservative and leave legacy parameters in >14 versions for
now. Need to clean up after REFUNDABLE_BYTES feature is actually enabled
on all networks.

* compat test to be against the testnet tag

* [GHA] Upgrade lint-test.yaml and the dependent actions to checkout@v4

actions/checkout@v4 doesn't behave well if both a workflow and an
invoked action checkout the source code on top of each other.

* [GHA] Update pin for tj-actions/changed-files

* start jwk consensus for google (#12053)

* [consensus] check rpc epoch in epoch_manager (#12018)

* [consensus] check rpc epoch in epoch_manager

* fix gas version (13 is deprecated/cannot be used) (#12064)

* FatalVMError shouldn't create "Delayed materialization code invariant" (#12044)

* Move all visibility checking into AST-level function_checker, simplify that code a bit, and improve diagnostics. (#11948)

* rust changes to move all visibility checking to AST and clean it up a bit
* change `Known attribute ... position` warning to a neater `Attribute .. position` warning
* add FunctionData id_loc to allow pointing at function name in declaration for more concise error messages. abstract messages a bit in function_checker
* add 'inlined from' labels to diagnostics with labels, fix bug in function_checker to enable post-inlining visibility checking

* lint

* fix for small stakes

* assert

---------

Co-authored-by: igor-aptos <110557261+igor-aptos@users.noreply.github.com>
Co-authored-by: jill <121921928+jillxuu@users.noreply.github.com>
Co-authored-by: George Mitenkov <georgemitenk0v@gmail.com>
Co-authored-by: runtianz <runtian@aptoslabs.com>
Co-authored-by: Andrew Hariri <hariria@usc.edu>
Co-authored-by: John Chang <johnchang9094@gmail.com>
Co-authored-by: Gerardo Di Giacomo <gerardo@aptoslabs.com>
Co-authored-by: sionescu <sionescu@users.noreply.github.com>
Co-authored-by: Junkil Park <jpark@aptoslabs.com>
Co-authored-by: aldenhu <msmouse@gmail.com>
Co-authored-by: danielxiangzl <xiangzhuolun@gmail.com>
Co-authored-by: Alin Tomescu <tomescu.alin@gmail.com>
Co-authored-by: Victor Gao <10379359+vgao1996@users.noreply.github.com>
Co-authored-by: Stelian Ionescu <stelian@aptoslabs.com>
Co-authored-by: Stelian Ionescu <sionescu@cddr.org>
Co-authored-by: larry-aptos <112209412+larry-aptos@users.noreply.github.com>
Co-authored-by: Balaji Arun <balaji@aptoslabs.com>
Co-authored-by: Brian R. Murphy <132495859+brmataptos@users.noreply.github.com>
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.

7 participants