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

[fungible_assets] fix bugs, add tests, rename and change object api #7608

Merged
merged 9 commits into from
Apr 12, 2023

Conversation

lightmark
Copy link
Contributor

Description

  1. rename wallet to store. rename FungibleAssetSupport to DeriveRefPod.
  2. add tests to primary_store. Also fixed a bug there.
  3. change create_user_derived_object to be a friend function w/o signer but use address instead.

Test Plan

ut

@lightmark lightmark force-pushed the lightmark/fa_again branch 2 times, most recently from e86dbf6 to c9b05f1 Compare April 6, 2023 17:40
@lightmark lightmark marked this pull request as ready for review April 6, 2023 17:40

#[resource_group_member(group = aptos_framework::object::ObjectGroup)]
/// Resource stored on the fungible asset metadata object to allow creating primary stores for it.
struct DeriveRefPod has key {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is DeriveRefPod a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it can be used for other purpose. If you agree that function is friend function, I agree to change it back to the original name. Otherwise, it is just a holder of derived ref.

Copy link
Contributor

Choose a reason for hiding this comment

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

@gregnazario Any naming suggestion here? :P

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean I would make it PrimaryWalletCapability, though I think we overloaded that word now...

PrimaryWalletDeriveRef

Tells you what it is, and what it's used for. Do you suspect it'll be used for anything else in the future? Then

FungibleAssetDeriveRef

@lightmark lightmark force-pushed the lightmark/fa_again branch from c9b05f1 to 889dd58 Compare April 6, 2023 18:24
@lightmark lightmark force-pushed the lightmark/fa_again branch from 889dd58 to c767194 Compare April 6, 2023 20:34
@@ -471,6 +472,14 @@ module aptos_framework::object {
}

/// Accessors
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a // and not a ///


#[resource_group_member(group = aptos_framework::object::ObjectGroup)]
/// Resource stored on the fungible asset metadata object to allow creating primary stores for it.
struct DeriveRefPod has key {
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean I would make it PrimaryWalletCapability, though I think we overloaded that word now...

PrimaryWalletDeriveRef

Tells you what it is, and what it's used for. Do you suspect it'll be used for anything else in the future? Then

FungibleAssetDeriveRef

@lightmark
Copy link
Contributor Author

@movekevin Can you take another look of fungible_asset.move for the aggregator?

@lightmark lightmark force-pushed the lightmark/fa_again branch 2 times, most recently from d7b03b5 to 15d8c88 Compare April 12, 2023 18:32
@lightmark lightmark force-pushed the lightmark/fa_again branch from 15d8c88 to 7ad8958 Compare April 12, 2023 18:59
@lightmark lightmark enabled auto-merge (rebase) April 12, 2023 19:04
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

/// Maximum possible coin supply.
const MAX_U128: u128 = 340282366920938463463374607431768211455;

struct Supply has store {
Copy link
Contributor

Choose a reason for hiding this comment

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

object::object_from_constructor_ref<FungibleStore>(constructor_ref)
}

public fun remove_store(delete_ref: &DeleteRef) acquires FungibleStore, FungibleAssetEvents {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want this?

const MAX_U128: u128 = 340282366920938463463374607431768211455;

struct Supply has store {
current: OptionalAggregator,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a function to "activate" aggregator for this or can we add later?

const ASSET_SYMBOL: vector<u8> = b"APT";

/// Initialize metadata object and store the refs.
fun init_module(admin: &signer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have two separate modules and not just one? In many cases people just deploy once and expect the fungible asset to be created

/// The address of the base metadata object.
metadata: Object<Metadata>,
/// The balance of the fungible metadata.
balance: u64,
/// Fungible Assets transferring is a common operation, this allows for freezing/unfreezing accounts.
allow_ungated_transfer: bool,
allow_ungated_balance_transfer: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

allow_owner_balance_transfer?

// Constants
//

const MAX_NAME_LENGTH: u64 = 32;
Copy link
Contributor

Choose a reason for hiding this comment

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

How did you come up with these numbers?

@github-actions
Copy link
Contributor

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 7ad895827c880f6c1602933a951d8d7d792379e8

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 7ad895827c880f6c1602933a951d8d7d792379e8 (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7795 TPS, 4908 ms latency, 6900 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: 7ad895827c880f6c1602933a951d8d7d792379e8
compatibility::simple-validator-upgrade::single-validator-upgrade : 4649 TPS, 8807 ms latency, 12000 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: 7ad895827c880f6c1602933a951d8d7d792379e8
compatibility::simple-validator-upgrade::half-validator-upgrade : 4846 TPS, 8462 ms latency, 11500 ms p99 latency,no expired txns
4. upgrading second batch to new version: 7ad895827c880f6c1602933a951d8d7d792379e8
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6587 TPS, 5879 ms latency, 9600 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 7ad895827c880f6c1602933a951d8d7d792379e8 passed
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite land_blocking success on 7ad895827c880f6c1602933a951d8d7d792379e8

performance benchmark with full nodes : 5562 TPS, 7097 ms latency, 15100 ms p99 latency,(!) expired 20 out of 2375220 txns
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite framework_upgrade success on aptos-node-v1.3.0_3fc3d42b6cfe27460004f9a0326451bcda840a60 ==> 7ad895827c880f6c1602933a951d8d7d792379e8

Compatibility test results for aptos-node-v1.3.0_3fc3d42b6cfe27460004f9a0326451bcda840a60 ==> 7ad895827c880f6c1602933a951d8d7d792379e8 (PR)
Upgrade the nodes to version: 7ad895827c880f6c1602933a951d8d7d792379e8
framework_upgrade::framework-upgrade::full-framework-upgrade : 6322 TPS, 6072 ms latency, 8900 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for aptos-node-v1.3.0_3fc3d42b6cfe27460004f9a0326451bcda840a60 ==> 7ad895827c880f6c1602933a951d8d7d792379e8 passed
Test Ok

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