diff --git a/aptos-move/e2e-benchmark/src/main.rs b/aptos-move/e2e-benchmark/src/main.rs index 27a152e57c9a2..88e2e1973c3ae 100644 --- a/aptos-move/e2e-benchmark/src/main.rs +++ b/aptos-move/e2e-benchmark/src/main.rs @@ -172,6 +172,7 @@ fn main() { EntryPoints::TokenV1MintAndTransferFT, EntryPoints::TokenV1MintAndTransferNFTSequential, EntryPoints::TokenV2AmbassadorMint { numbered: true }, + EntryPoints::CompressedTokenAmbassadorMint { numbered: true }, EntryPoints::LiquidityPoolSwap { is_stable: true }, EntryPoints::LiquidityPoolSwap { is_stable: false }, EntryPoints::CoinInitAndMint, diff --git a/aptos-move/move-examples/token_objects/ambassador/Move.toml b/aptos-move/move-examples/token_objects/ambassador/Move.toml index 16e6328fbbf72..5e49252d2297b 100644 --- a/aptos-move/move-examples/token_objects/ambassador/Move.toml +++ b/aptos-move/move-examples/token_objects/ambassador/Move.toml @@ -7,5 +7,9 @@ version = '1.0.0' ambassador = "0xCAFE" [dependencies] -AptosFramework = { git = "https://github.com/aptos-labs/aptos-framework.git", subdir = "aptos-framework", rev = "mainnet" } -AptosTokenObjects = { git = "https://github.com/aptos-labs/aptos-framework.git", subdir = "aptos-token-objects", rev = "mainnet" } + +AptosFramework = { local = "../../../../aptos-move/framework/aptos-framework" } +AptosTokenObjects = { local = "../../../../aptos-move/framework/aptos-token-objects" } + +# AptosFramework = { git = "https://github.com/aptos-labs/aptos-framework.git", subdir = "aptos-framework", rev = "mainnet" } +# AptosTokenObjects = { git = "https://github.com/aptos-labs/aptos-framework.git", subdir = "aptos-token-objects", rev = "mainnet" } diff --git a/aptos-move/move-examples/token_objects/ambassador/sources/compressed_ambassador.move b/aptos-move/move-examples/token_objects/ambassador/sources/compressed_ambassador.move new file mode 100644 index 0000000000000..0052ccaa62e66 --- /dev/null +++ b/aptos-move/move-examples/token_objects/ambassador/sources/compressed_ambassador.move @@ -0,0 +1,503 @@ +/// This module is used to create ambassador tokens which are example soulbound tokens. +/// A collection for ambassador tokens is created when the module is published and initialized. +/// The creator of the collection is the only one who can mint and burn ambassador tokens. +/// Ambassador tokens are souldbound, thus non-transferable. Each ambassador token has a custom attribute +/// called level. The level of a newly minted token is 0, and can be updated by the creator. +/// Whenever the level of a token is updated, an event called LevelUpdate is emitted. +/// Each ambassador token has another custom attribute called rank, which is associated with the level. +/// The rank is determined by the level such that the rank is Bronze if the level is between 0 and 9, +/// Silver if the level is between 10 and 19, and Gold if the level is 20 or greater. +/// The rank is stored in the property map, thus displayed in a wallet as a trait of the token. +/// The token uri is the concatenation of the base uri and the rank, where the base uri is given +/// as an argument of the minting function. So, the token uri changes when the rank changes. +module ambassador::compressed_ambassador { + use std::error; + use std::option; + use std::string::{Self, String}; + use std::signer; + + use aptos_framework::object::{Self, Object}; + use aptos_token_objects::collection; + use aptos_token_objects::token; + use aptos_token_objects::property_map; + use aptos_std::any_map; + use aptos_std::string_utils::{to_string}; + + /// The token does not exist + const ETOKEN_DOES_NOT_EXIST: u64 = 1; + /// The provided signer is not the creator + const ENOT_CREATOR: u64 = 2; + /// Attempted to mutate an immutable field + const EFIELD_NOT_MUTABLE: u64 = 3; + /// Attempted to burn a non-burnable token + const ETOKEN_NOT_BURNABLE: u64 = 4; + /// Attempted to mutate a property map that is not mutable + const EPROPERTIES_NOT_MUTABLE: u64 = 5; + // The collection does not exist + const ECOLLECTION_DOES_NOT_EXIST: u64 = 6; + + const ENOT_OWNER: u64 = 7; + + /// The ambassador token collection name + const COLLECTION_NAME: vector = b"Compressed Collection Name"; + /// The ambassador token collection description + const COLLECTION_DESCRIPTION: vector = b"Compressed Collection Description"; + /// The ambassador token collection URI + const COLLECTION_URI: vector = b"Compressed Collection URI"; + + /// The ambassador rank + const RANK_GOLD: vector = b"Gold"; + const RANK_SILVER: vector = b"Silver"; + const RANK_BRONZE: vector = b"Bronze"; + + struct AmbassadorTokenPermission has drop, store { + object_addr: address, + } + + #[resource_group_member(group = aptos_framework::object::ObjectGroup)] + /// The ambassador token + struct AmbassadorToken has key, drop, store { + /// Used to mutate the token uri + mutator_ref: token::MutatorRef, + /// Used to burn. + burn_ref: token::BurnRef, + /// Used to mutate properties + property_mutator_ref: property_map::MutatorRef, + /// the base URI of the token + base_uri: String, + } + + // easiest to have this separate, as we cannot copy it / keep in external value + #[resource_group_member(group = aptos_framework::object::ObjectGroup)] + struct AmbassadorCompression has key { + /// Used to compress/decompress tokens + compression_ref: token::CompressionRef, + } + + #[resource_group_member(group = aptos_framework::object::ObjectGroup)] + /// The ambassador level + struct AmbassadorLevel has key, drop, store { + ambassador_level: u64, + } + + #[event] + /// The ambassador level update event + struct LevelUpdate has drop, store { + token: Object, + old_level: u64, + new_level: u64, + } + + /// Initializes the module, creating the ambassador collection. The creator of the module is the creator of the + /// ambassador collection. As this init function is called only once when the module is published, there will + /// be only one ambassador collection. + fun init_module(sender: &signer) { + create_ambassador_collection(sender); + } + + // #[view] + // /// Returns the ambassador level of the token + // public fun ambassador_level(token: Object): u64 acquires AmbassadorLevel { + // let ambassador_level = borrow_global(object::object_address(&token)); + // ambassador_level.ambassador_level + // } + + // #[view] + // /// Returns the ambassador rank of the token + // public fun ambassador_rank(token: Object): String { + // property_map::read_string(&token, &string::utf8(b"Rank")) + // } + + // #[view] + // /// Returns the ambassador level of the token of the address + // public fun ambassador_level_from_address(addr: address): u64 acquires AmbassadorLevel { + // let token = object::address_to_object(addr); + // ambassador_level(token) + // } + + // #[view] + // /// Returns the ambassador rank of the token of the address + // public fun ambassador_rank_from_address(addr: address): String { + // let token = object::address_to_object(addr); + // ambassador_rank(token) + // } + + /// Creates the ambassador collection. This function creates a collection with unlimited supply using + /// the module constants for description, name, and URI, defined above. The collection will not have + /// any royalty configuration because the tokens in this collection will not be transferred or sold. + fun create_ambassador_collection(creator: &signer) { + // Constructs the strings from the bytes. + let description = string::utf8(COLLECTION_DESCRIPTION); + let name = string::utf8(COLLECTION_NAME); + let uri = string::utf8(COLLECTION_URI); + + // Creates the collection with unlimited supply and without establishing any royalty configuration. + let constructor_ref = collection::create_unlimited_collection( + creator, + description, + name, + option::none(), + uri, + ); + token::collection_enable_compressed_tokens(constructor_ref); + } + + /// Mints an ambassador token. This function mints a new ambassador token and transfers it to the + /// `soul_bound_to` address. The token is minted with level 0 and rank Bronze. + public entry fun mint_ambassador_token( + creator: &signer, + description: String, + name: String, + base_uri: String, + soul_bound_to: address, + ) { + mint_ambassador_token_impl(creator, description, name, base_uri, soul_bound_to, false); + } + + /// Mints an ambassador token. This function mints a new ambassador token and transfers it to the + /// `soul_bound_to` address. The token is minted with level 0 and rank Bronze. + public entry fun mint_numbered_ambassador_token( + creator: &signer, + description: String, + name: String, + base_uri: String, + soul_bound_to: address, + ) { + mint_ambassador_token_impl(creator, description, name, base_uri, soul_bound_to, true); + } + + /// Function used for benchmarking. + /// Uses multisig to mint to user, with creator permissions. + /// Uses users address as unique name of the soulbound token. + public entry fun mint_ambassador_token_by_user( + user: &signer, + creator: &signer, + description: String, + uri: String, + ) { + let user_addr = signer::address_of(user); + mint_ambassador_token(creator, description, to_string
(&user_addr), uri, user_addr); + } + + /// Function used for benchmarking. + /// Uses multisig to mint to user, with creator permissions. + public entry fun mint_numbered_ambassador_token_by_user( + user: &signer, + creator: &signer, + description: String, + name: String, + uri: String, + ) { + mint_numbered_ambassador_token(creator, description, name, uri, signer::address_of(user)); + } + + /// Mints an ambassador token. This function mints a new ambassador token and transfers it to the + /// `soul_bound_to` address. The token is minted with level 0 and rank Bronze. + fun mint_ambassador_token_impl( + creator: &signer, + description: String, + name: String, + base_uri: String, + soul_bound_to: address, + numbered: bool, + ) { + // The collection name is used to locate the collection object and to create a new token object. + let collection = string::utf8(COLLECTION_NAME); + + // Creates the ambassador token, and get the constructor ref of the token. The constructor ref + // is used to generate the refs of the token. + let uri = base_uri; + string::append(&mut uri, string::utf8(RANK_BRONZE)); + let constructor_ref = if (numbered) { + token::create_numbered_token( + creator, + collection, + description, + name, + string::utf8(b""), + option::none(), + uri, + ) + } else { + token::create( + creator, + collection, + description, + name, + option::none(), + uri, + ) + }; + + // Generates the object signer and the refs. The object signer is used to publish a resource + // (e.g., AmbassadorLevel) under the token object address. The refs are used to manage the token. + let object_signer = object::generate_signer(&constructor_ref); + let transfer_ref = object::generate_transfer_ref(&constructor_ref); + let mutator_ref = token::generate_mutator_ref(&constructor_ref); + let burn_ref = token::generate_burn_ref(&constructor_ref); + let property_mutator_ref = property_map::generate_mutator_ref(&constructor_ref); + + // Transfers the token to the `soul_bound_to` address + let linear_transfer_ref = object::generate_linear_transfer_ref(&transfer_ref); + object::transfer_with_ref(linear_transfer_ref, soul_bound_to); + + // Disables ungated transfer, thus making the token soulbound and non-transferable + object::disable_ungated_transfer(&transfer_ref); + + // Publishes the AmbassadorToken resource with the refs. + let ambassador_token = AmbassadorToken { + mutator_ref, + burn_ref, + property_mutator_ref, + base_uri + }; + + let resources = any_map::new(); + + // Publishes the AmbassadorToken resource with the refs. + resources.add(ambassador_token); + + // Initializes the ambassador level as 0 + resources.add(AmbassadorLevel { ambassador_level: 0 }); + + // Initialize the property map and the ambassador rank as Bronze + let properties = property_map::prepare_input(vector[], vector[], vector[]); + property_map::add_typed_to_struct(&mut properties, string::utf8(b"Rank"), string::utf8(RANK_BRONZE)); + resources.add(properties); + + token::compress_token( + token::generate_compression_ref(&constructor_ref), + resources, + AmbassadorTokenPermission { + object_addr: signer::address_of(&object_signer), + } + ); + } + + public entry fun decompress_token(user: &signer, object: address, external_bytes: vector) { + let (constructor_ref, resources) = token::decompress_token( + external_bytes, + AmbassadorTokenPermission { + object_addr: object, + }, + ); + + // We can control permissions in the ambassador module - so here we only allow owners to compress/decompress + assert!( + object::owns(object::object_from_constructor_ref(&constructor_ref), signer::address_of(user)), + error::permission_denied(ENOT_CREATOR), + ); + + let object_signer = object::generate_signer(&constructor_ref); + + let ambassador_token = any_map::remove(resources.get_resources_mut()); + move_to(&object_signer, ambassador_token); + + let ambassador_level = any_map::remove(resources.get_resources_mut()); + move_to(&object_signer, ambassador_level); + + move_to(&object_signer, AmbassadorCompression { compression_ref: token::generate_compression_ref(&constructor_ref) }); + + resources.destroy_empty(); + } + + public entry fun compress_token(user: &signer, token: Object) acquires AmbassadorToken, AmbassadorLevel, AmbassadorCompression { + // We can control permissions in the ambassador module - so here we only allow owners to compress/decompress + assert!( + object::owns(token, signer::address_of(user)), + error::permission_denied(ENOT_OWNER), + ); + + let resources = any_map::new(); + resources.add(move_from(token.object_address())); + resources.add(move_from(token.object_address())); + + let AmbassadorCompression { compression_ref } = move_from(token.object_address()); + + token::compress_token( + compression_ref, + resources, + AmbassadorTokenPermission { + object_addr: token.object_address(), + } + ); + } + + // /// Burns an ambassador token. This function burns the ambassador token and destroys the + // /// AmbassadorToken resource, AmbassadorLevel resource, the event handle, and the property map. + // public entry fun burn(creator: &signer, token: Object) acquires AmbassadorToken, AmbassadorLevel { + // authorize_creator(creator, &token); + // let ambassador_token = move_from(object::object_address(&token)); + // let AmbassadorToken { + // mutator_ref: _, + // burn_ref, + // property_mutator_ref, + // base_uri: _ + // } = ambassador_token; + + // let AmbassadorLevel { + // ambassador_level: _ + // } = move_from(object::object_address(&token)); + + // property_map::burn(property_mutator_ref); + // token::burn(burn_ref); + // } + + // /// Function used for benchmarking. + // /// Uses multisig to mint to user, with creator permissions. + // /// Uses users address as unique name of the soulbound token. + // /// Burns token that was minted by mint_ambassador_token_by_user + // public entry fun burn_named_by_user(user: &signer, creator: &signer) acquires AmbassadorToken, AmbassadorLevel { + // let collection_name = string::utf8(COLLECTION_NAME); + // let token_address = token::create_token_address( + // &signer::address_of(creator), + // &collection_name, + // &to_string
(&signer::address_of(user)), + // ); + // let token = object::address_to_object(token_address); + // burn(creator, token); + // } + + // /// Sets the ambassador level of the token. Only the creator of the token can set the level. When the level + // /// is updated, the `LevelUpdate` is emitted. The ambassador rank is updated based on the new level. + // public entry fun set_ambassador_level( + // creator: &signer, + // token: Object, + // new_ambassador_level: u64 + // ) acquires AmbassadorLevel, AmbassadorToken { + // // Asserts that `creator` is the creator of the token. + // authorize_creator(creator, &token); + + // let token_address = object::object_address(&token); + // let ambassador_level = borrow_global_mut(token_address); + // // Emits the `LevelUpdate`. + // event::emit( + // LevelUpdate { + // token, + // old_level: ambassador_level.ambassador_level, + // new_level: new_ambassador_level, + // } + // ); + // // Updates the ambassador level. + // ambassador_level.ambassador_level = new_ambassador_level; + // // Updates the ambassador rank based on the new level. + // update_ambassador_rank(token, new_ambassador_level); + // } + + // /// Updates the ambassador rank of the token based on the new level + // fun update_ambassador_rank( + // token: Object, + // new_ambassador_level: u64 + // ) acquires AmbassadorToken { + // // `new_rank` is determined based on the new level. + // let new_rank = if (new_ambassador_level < 10) { + // RANK_BRONZE + // } else if (new_ambassador_level < 20) { + // RANK_SILVER + // } else { + // RANK_GOLD + // }; + + // let token_address = object::object_address(&token); + // let ambassador_token = borrow_global(token_address); + // // Gets `property_mutator_ref` to update the rank in the property map. + // let property_mutator_ref = &ambassador_token.property_mutator_ref; + // // Updates the rank in the property map. + // property_map::update_typed(property_mutator_ref, &string::utf8(b"Rank"), string::utf8(new_rank)); + // // Updates the token URI based on the new rank. + // let uri = ambassador_token.base_uri; + // string::append(&mut uri, string::utf8(new_rank)); + // token::set_uri(&ambassador_token.mutator_ref, uri); + // } + + // /// Authorizes the creator of the token. Asserts that the token exists and the creator of the token + // /// is `creator`. + // inline fun authorize_creator(creator: &signer, token: &Object) { + // let token_address = object::object_address(token); + // assert!( + // exists(token_address), + // error::not_found(ETOKEN_DOES_NOT_EXIST), + // ); + // assert!( + // token::creator(*token) == signer::address_of(creator), + // error::permission_denied(ENOT_CREATOR), + // ); + // } + + // #[test(creator = @0x123, user1 = @0x456)] + // fun test_mint_burn(creator: &signer, user1: &signer) acquires AmbassadorToken, AmbassadorLevel { + // // ------------------------------------------ + // // Creator creates the Ambassador Collection. + // // ------------------------------------------ + // create_ambassador_collection(creator); + + // // ------------------------------------------- + // // Creator mints a Ambassador token for User1. + // // ------------------------------------------- + // let token_name = string::utf8(b"Ambassador Token #1"); + // let token_description = string::utf8(b"Ambassador Token #1 Description"); + // let token_uri = string::utf8(b"Ambassador Token #1 URI/"); + // let user1_addr = signer::address_of(user1); + // // Creates the Ambassador token for User1. + // mint_ambassador_token( + // creator, + // token_description, + // token_name, + // token_uri, + // user1_addr, + // ); + // let collection_name = string::utf8(COLLECTION_NAME); + // let token_address = token::create_token_address( + // &signer::address_of(creator), + // &collection_name, + // &token_name + // ); + // let token = object::address_to_object(token_address); + // // Asserts that the owner of the token is User1. + // assert!(object::owner(token) == user1_addr, 1); + + // // ----------------------- + // // Creator sets the level. + // // ----------------------- + // // Asserts that the initial level of the token is 0. + // assert!(ambassador_level(token) == 0, 2); + // // Asserts that the initial rank of the token is "Bronze". + // assert!(ambassador_rank(token) == string::utf8(RANK_BRONZE), 3); + // assert!(token::uri(token) == string::utf8(b"Ambassador Token #1 URI/Bronze"), 4); + // // `creator` sets the level to 15. + // set_ambassador_level(creator, token, 15); + // // Asserts that the level is updated to 15. + // assert!(ambassador_level(token) == 15, 4); + // // Asserts that the rank is updated to "Silver" which is the expected rank for level 15. + // assert!(token::uri(token) == string::utf8(b"Ambassador Token #1 URI/Silver"), 5); + + // // ------------------------ + // // Creator burns the token. + // // ------------------------ + // let token_addr = object::object_address(&token); + // // Asserts that the token exists before burning. + // assert!(exists(token_addr), 6); + // // Burns the token. + // burn(creator, token); + // // Asserts that the token does not exist after burning. + // assert!(!exists(token_addr), 7); + // } + + // #[test(creator = @0x123, user1 = @0x456)] + // fun test_mint_burn_by_user(creator: &signer, user1: &signer) acquires AmbassadorToken, AmbassadorLevel { + // // ------------------------------------------ + // // Creator creates the Ambassador Collection. + // // ------------------------------------------ + // create_ambassador_collection(creator); + + // let token_description = string::utf8(b"Ambassador Token #1 Description"); + // let token_uri = string::utf8(b"Ambassador Token #1 URI/"); + // mint_ambassador_token_by_user( + // user1, + // creator, + // token_description, + // token_uri + // ); + // burn_named_by_user(user1, creator); + // } +} diff --git a/crates/transaction-workloads-lib/src/args.rs b/crates/transaction-workloads-lib/src/args.rs index 402c4aeb3b54c..e0a67dd1339c8 100644 --- a/crates/transaction-workloads-lib/src/args.rs +++ b/crates/transaction-workloads-lib/src/args.rs @@ -64,6 +64,7 @@ pub enum TransactionTypeArg { FungibleAssetMint, TokenV2AmbassadorMint, TokenV2AmbassadorMintAndBurn1M, + CompressedTokenAmbassadorMint, LiquidityPoolSwap, LiquidityPoolSwapStable, VectorPictureCreate30k, @@ -301,6 +302,9 @@ impl TransactionTypeArg { use_account_pool: sender_use_account_pool, progress_type: workflow_progress_type, }, + TransactionTypeArg::CompressedTokenAmbassadorMint => { + call_custom_module(EntryPoints::CompressedTokenAmbassadorMint { numbered: false }) + }, TransactionTypeArg::LiquidityPoolSwap => { call_custom_module(EntryPoints::LiquidityPoolSwap { is_stable: false }) }, diff --git a/crates/transaction-workloads-lib/src/move_workloads.rs b/crates/transaction-workloads-lib/src/move_workloads.rs index 8b5a191c55510..e3c10b2f4b870 100644 --- a/crates/transaction-workloads-lib/src/move_workloads.rs +++ b/crates/transaction-workloads-lib/src/move_workloads.rs @@ -206,6 +206,10 @@ pub enum EntryPoints { /// Burn an NFT token, only works with numbered=false tokens. TokenV2AmbassadorBurn, + CompressedTokenAmbassadorMint { + numbered: bool, + }, + LiquidityPoolSwapInit { is_stable: bool, }, @@ -285,9 +289,9 @@ impl EntryPointTrait for EntryPoints { | EntryPoints::ResourceGroupsSenderMultiChange { .. } | EntryPoints::CoinInitAndMint | EntryPoints::FungibleAssetMint => "framework_usecases", - EntryPoints::TokenV2AmbassadorMint { .. } | EntryPoints::TokenV2AmbassadorBurn => { - "ambassador_token" - }, + EntryPoints::TokenV2AmbassadorMint { .. } + | EntryPoints::TokenV2AmbassadorBurn + | EntryPoints::CompressedTokenAmbassadorMint { .. } => "ambassador_token", EntryPoints::LiquidityPoolSwapInit { .. } | EntryPoints::LiquidityPoolSwap { .. } | EntryPoints::InitializeVectorPicture { .. } @@ -351,6 +355,7 @@ impl EntryPointTrait for EntryPoints { EntryPoints::TokenV2AmbassadorMint { .. } | EntryPoints::TokenV2AmbassadorBurn => { "ambassador" }, + EntryPoints::CompressedTokenAmbassadorMint { .. } => "compressed_ambassador", EntryPoints::LiquidityPoolSwapInit { .. } | EntryPoints::LiquidityPoolSwap { .. } => { "liquidity_pool_wrapper" }, @@ -679,7 +684,8 @@ impl EntryPointTrait for EntryPoints { bcs::to_bytes(&1000u64).unwrap(), // amount ]) }, - EntryPoints::TokenV2AmbassadorMint { numbered: true } => { + EntryPoints::TokenV2AmbassadorMint { numbered: true } + | EntryPoints::CompressedTokenAmbassadorMint { numbered: true } => { let rng: &mut StdRng = rng.expect("Must provide RNG"); get_payload( module_id, @@ -691,7 +697,8 @@ impl EntryPointTrait for EntryPoints { ], ) }, - EntryPoints::TokenV2AmbassadorMint { numbered: false } => { + EntryPoints::TokenV2AmbassadorMint { numbered: false } + | EntryPoints::CompressedTokenAmbassadorMint { numbered: false } => { let rng: &mut StdRng = rng.expect("Must provide RNG"); get_payload( module_id, @@ -707,7 +714,6 @@ impl EntryPointTrait for EntryPoints { ident_str!("burn_named_by_user").to_owned(), vec![], ), - EntryPoints::LiquidityPoolSwapInit { is_stable } => get_payload( module_id, ident_str!("initialize_liquid_pair").to_owned(), @@ -827,9 +833,9 @@ impl EntryPointTrait for EntryPoints { EntryPoints::CoinInitAndMint | EntryPoints::FungibleAssetMint => { MultiSigConfig::Publisher }, - EntryPoints::TokenV2AmbassadorMint { .. } | EntryPoints::TokenV2AmbassadorBurn => { - MultiSigConfig::Publisher - }, + EntryPoints::TokenV2AmbassadorMint { .. } + | EntryPoints::TokenV2AmbassadorBurn + | EntryPoints::CompressedTokenAmbassadorMint { .. } => MultiSigConfig::Publisher, EntryPoints::LiquidityPoolSwap { .. } => MultiSigConfig::Publisher, EntryPoints::CreateGlobalMilestoneAggV2 { .. } => MultiSigConfig::Publisher, _ => MultiSigConfig::None, @@ -885,9 +891,9 @@ impl EntryPointTrait for EntryPoints { EntryPoints::CoinInitAndMint | EntryPoints::FungibleAssetMint => { AutomaticArgs::SignerAndMultiSig }, - EntryPoints::TokenV2AmbassadorMint { .. } | EntryPoints::TokenV2AmbassadorBurn => { - AutomaticArgs::SignerAndMultiSig - }, + EntryPoints::TokenV2AmbassadorMint { .. } + | EntryPoints::TokenV2AmbassadorBurn + | EntryPoints::CompressedTokenAmbassadorMint { .. } => AutomaticArgs::SignerAndMultiSig, EntryPoints::LiquidityPoolSwapInit { .. } => AutomaticArgs::Signer, EntryPoints::LiquidityPoolSwap { .. } => AutomaticArgs::SignerAndMultiSig, EntryPoints::InitializeVectorPicture { .. } => AutomaticArgs::Signer, diff --git a/testsuite/single_node_performance.py b/testsuite/single_node_performance.py index 119ba8a250efd..b2f84cfb6cbf9 100755 --- a/testsuite/single_node_performance.py +++ b/testsuite/single_node_performance.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.11 # Copyright © Aptos Foundation # SPDX-License-Identifier: Apache-2.0 @@ -33,6 +33,8 @@ class Flow(Flag): RESOURCE_GROUPS = auto() # Test different executor types EXECUTORS = auto() + # + COMPRESSSED_TOKENS = auto() # Tests that are run on LAND_BLOCKING and continuously on main @@ -169,7 +171,6 @@ class RunGroupConfig: with open('testsuite/single_node_performance_values.tsv', 'r') as file: CALIBRATION = file.read() - # when adding a new test, add estimated expected_tps to it, as well as waived=True. # And then after a day or two - add calibration result for it above, removing expected_tps/waived fields. @@ -237,9 +238,11 @@ class RunGroupConfig: RunGroupConfig(key=RunGroupKey("no-op5-signers"), included_in=Flow.CONTINUOUS), - RunGroupConfig(key=RunGroupKey("token-v2-ambassador-mint"), included_in=LAND_BLOCKING_AND_C | Flow.REPRESENTATIVE | Flow.MAINNET), + RunGroupConfig(key=RunGroupKey("token-v2-ambassador-mint"), included_in=LAND_BLOCKING_AND_C | Flow.REPRESENTATIVE | Flow.MAINNET | Flow.COMPRESSSED_TOKENS), RunGroupConfig(key=RunGroupKey("token-v2-ambassador-mint", module_working_set_size=DEFAULT_MODULE_WORKING_SET_SIZE), included_in=Flow.CONTINUOUS), + RunGroupConfig(expected_tps=3000, key=RunGroupKey("compressed-token-ambassador-mint"), included_in=LAND_BLOCKING_AND_C | Flow.REPRESENTATIVE | Flow.COMPRESSSED_TOKENS), + RunGroupConfig(key=RunGroupKey("liquidity-pool-swap"), included_in=LAND_BLOCKING_AND_C | Flow.REPRESENTATIVE), RunGroupConfig(key=RunGroupKey("liquidity-pool-swap", module_working_set_size=DEFAULT_MODULE_WORKING_SET_SIZE), included_in=Flow.CONTINUOUS),