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

Migrate token objects into the framework at 0x4 #7277

Merged
merged 13 commits into from
Mar 26, 2023
Merged

Conversation

davidiw
Copy link
Contributor

@davidiw davidiw commented Mar 18, 2023

Will start working immediately on writing / updating the appropriate AIPs.

@davidiw davidiw force-pushed the davidiw_token_pt2 branch 2 times, most recently from 39c8ce2 to e009be7 Compare March 19, 2023 01:11
@@ -0,0 +1,13 @@
[package]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make this a new package vs merging into aptos-token? This would require making sure aptos-token-objects is supported as a new package in many places (genesis, release-tooling, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is the better approach... the constructs at 0x3 share names and would all be but confusing to co-exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call though... I need to actually run a local node and ensure that it is taken in otherwise this change won't impact devnet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest ensuring both genesis and framework upgrade work. Otherwise, this would potentially bypass tests, compat checks, etc. which can somehow break the release process down the line

Copy link
Contributor

Choose a reason for hiding this comment

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

A new package just because of shared names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I worry users would end up even more confused.

Base automatically changed from davidiw_token to main March 22, 2023 21:43
object::address_to_object<AptosCollection>(collection_addr)
}

entry fun set_collection_description_call(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer required now that #7090 is getting merged soon. set_collection_description can become public fun. Similar comment for other functions here

}

#[test(creator = @0x123)]
entry fun est_property_remove(creator: &signer) acquires AptosCollection, AptosToken {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing t at the beginning of test name

@davidiw davidiw force-pushed the davidiw_token_pt2 branch from e009be7 to bc68f50 Compare March 24, 2023 00:52
@@ -192,48 +192,6 @@ module aptos_token_objects::collection {
}
}

/// Entry function for creating a collection
public entry fun create_collection(
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to remove

@@ -247,7 +247,7 @@ module aptos_token_objects::property_map {
let (type, value) = read(object, key);
assert!(
type == type_info::type_name<V>(),
error::invalid_argument(ETYPE_INVALID),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use 2 different errors for the 2 remaining uses of ETYPE_INVALID as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is the right error and they appear in different contexts. This was intended to be mismatch, but copypasta, I guess

@davidiw davidiw enabled auto-merge (rebase) March 24, 2023 04:52
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@@ -151,6 +151,9 @@ module aptos_token_objects::collection {
royalty::init(&constructor_ref, option::extract(&mut royalty))
};

let transfer_ref = object::generate_transfer_ref(&constructor_ref);
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! Can you add a comment here explaining that transferring collection objects is disabled as it's meaningless - the new owner wouldn't gain any control over the collection.

@davidiw davidiw disabled auto-merge March 26, 2023 04:37
@@ -562,11 +546,11 @@ module token_objects::aptos_token {
collection: String,
name: String,
key: String,
type: String,
type_: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😮‍💨

let aptos_token = authorized_borrow(&token, signer::address_of(creator));
assert!(
option::is_some(&aptos_token.property_mutator_ref),
are_properties_mutable(token),
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the rationale behind this change? Basically you use a bool of a collection to decide whether tokens in this collection has properties mutable and store a mutable_ref in all tokens? Why do you have this ref. My guess is for potential upgrade to control each one individually but not sure how this can work later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figure it is okay to just make this a collection level configuration for our no-code solution... the code complexity here isn't great and it is mostly just a bunch of control flags.. so I became a little oppressive here and there.

@@ -0,0 +1,13 @@
[package]
Copy link
Contributor

Choose a reason for hiding this comment

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

A new package just because of shared names?

@davidiw davidiw force-pushed the davidiw_token_pt2 branch from 0375413 to 9bb3ecf Compare March 26, 2023 05:00
@davidiw davidiw enabled auto-merge (rebase) March 26, 2023 05:03
davidiw added 8 commits March 25, 2023 23:50
construct the container for aptos-token-objects
migrate examples token-objects to framework/aptos-token-objects
if a user attempts to freeze, unfreeze a soul bound token for which the
collection enables freeze, unfreeze, they would get a weird error.
The current abigen depends on TypeTags to represent abis. Unfortunately
this excludes it from representing any generic entry function. That
should NOT prevent us from writing these entry functions in Move or in
the framework. The current code creates that unnecessary restriction, so
instead of panicing, just return none as if it cannot understand it.
upgrade to more effective interfaces -- still need to improve both the
abigen in move and then the rust sdk builder
@davidiw davidiw force-pushed the davidiw_token_pt2 branch 2 times, most recently from 56f0c93 to b649d89 Compare March 26, 2023 06:54
@davidiw davidiw enabled auto-merge (rebase) March 26, 2023 06:55
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

davidiw added 5 commits March 26, 2023 00:35
* Named Objects
* Named tokens
* Named collections
* Moved auth key generation back into the account_address module from
  ed25519 for multi-ed as that's where it was defined for other
  frameworks
* this validates much of the token objects code
* demonstrates a means to read objects efficiently using python
* how to perform property type operations
* read from property types
* how to tie your shoes
@davidiw davidiw force-pushed the davidiw_token_pt2 branch 2 times, most recently from 56f0c93 to 8b74f89 Compare March 26, 2023 07:44
@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 land_blocking success on 8b74f89f142a6e7d587301b050edb5aa216e6bf6

performance benchmark with full nodes : 5640 TPS, 7027 ms latency, 12300 ms p99 latency,(!) expired 20 out of 2408620 txns
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6 (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7539 TPS, 5066 ms latency, 7500 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: 8b74f89f142a6e7d587301b050edb5aa216e6bf6
compatibility::simple-validator-upgrade::single-validator-upgrade : 4732 TPS, 8735 ms latency, 12100 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: 8b74f89f142a6e7d587301b050edb5aa216e6bf6
compatibility::simple-validator-upgrade::half-validator-upgrade : 4600 TPS, 8905 ms latency, 11500 ms p99 latency,no expired txns
4. upgrading second batch to new version: 8b74f89f142a6e7d587301b050edb5aa216e6bf6
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6404 TPS, 5928 ms latency, 10300 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6 passed
Test Ok

@davidiw davidiw merged commit 3a9984b into main Mar 26, 2023
@davidiw davidiw deleted the davidiw_token_pt2 branch March 26, 2023 08:33
@github-actions
Copy link
Contributor

❌ Forge suite framework_upgrade failure on cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6

Compatibility test results for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6 (PR)
Upgrade the nodes to version: 8b74f89f142a6e7d587301b050edb5aa216e6bf6
Test Failed: API error: Unknown error Transaction committed on chain, but failed execution: Transaction Executed and Committed with Error CONSTRAINT_NOT_SATISFIED
Trailing Log Lines:
INCLUDING DEPENDENCY MoveStdlib
BUILDING ExecuteProposal
::error::API error: Unknown error Transaction committed on chain, but failed execution: Transaction Executed and Committed with Error CONSTRAINT_NOT_SATISFIED
test framework_upgrade::framework-upgrade ... FAILED
Error: API error: Unknown error Transaction committed on chain, but failed execution: Transaction Executed and Committed with Error CONSTRAINT_NOT_SATISFIED
Test Statistics: 
Compatibility test results for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> 8b74f89f142a6e7d587301b050edb5aa216e6bf6 (PR)
Upgrade the nodes to version: 8b74f89f142a6e7d587301b050edb5aa216e6bf6
Test Failed: API error: Unknown error Transaction committed on chain, but failed execution: Transaction Executed and Committed with Error CONSTRAINT_NOT_SATISFIED


Swarm logs can be found here: See fgi output for more information.
{"level":"INFO","source":{"package":"aptos_forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:281"},"thread_name":"main","hostname":"forge-framework-upgrade-pr-7277-1679818405-cb4ba0a57c998c60cbab","timestamp":"2023-03-26T08:35:19.849662Z","message":"Deleting namespace forge-framework-upgrade-pr-7277: Some(NamespaceStatus { phase: Some(\"Terminating\") })"}
{"level":"INFO","source":{"package":"aptos_forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:389"},"thread_name":"main","hostname":"forge-framework-upgrade-pr-7277-1679818405-cb4ba0a57c998c60cbab","timestamp":"2023-03-26T08:35:19.849687Z","message":"aptos-node resources for Forge removed in namespace: forge-framework-upgrade-pr-7277"}

failures:
    framework_upgrade::framework-upgrade

test result: FAILED. 0 passed; 1 failed; 0 filtered out

Failed to run tests:
Tests Failed
Error: Tests Failed
Debugging output:
NAME                                   READY   STATUS      RESTARTS   AGE
aptos-node-0-validator-0               1/1     Running     0          14m
aptos-node-1-validator-0               1/1     Running     0          12m
aptos-node-2-validator-0               1/1     Running     0          10m
aptos-node-3-validator-0               1/1     Running     0          8m43s
aptos-node-4-validator-0               1/1     Running     0          6m53s
genesis-aptos-genesis-eforge32-vw99k   0/1     Completed   0          19m

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