diff --git a/.github/actions/program/action.yml b/.github/actions/program/action.yml index 7b849ce1ba..c3226d4764 100644 --- a/.github/actions/program/action.yml +++ b/.github/actions/program/action.yml @@ -12,6 +12,9 @@ runs: - uses: actions/checkout@v3 # Build and install deps + - uses: ./.github/actions/program/auction-house + if: ${{ inputs.name == 'auction-house' }} + - uses: ./.github/actions/program/auctioneer if: ${{ inputs.name == 'auctioneer' }} @@ -21,7 +24,7 @@ runs: - uses: ./.github/actions/program/token-metadata-and-metaplex if: ${{ inputs.name == 'nft-packs' }} - - name: "Dump token metadata" + - name: 'Dump token metadata' working-directory: ./${{ inputs.name }}/program run: | mkdir -p ../../test-programs diff --git a/.github/actions/program/auction-house/action.yml b/.github/actions/program/auction-house/action.yml new file mode 100644 index 0000000000..67fd19a024 --- /dev/null +++ b/.github/actions/program/auction-house/action.yml @@ -0,0 +1,17 @@ +# Implicit dependencies +# - actions/checkout@v3 +# - ./.github/actions/install-linux-build-deps +# - ./.github/actions/install-solana +# - ./.github/actions/install-rust + +name: Auction House Program Dependencies +description: Builds the dependencies for the Auction House program test +runs: + using: 'composite' + steps: + # Get Token Auth Rules program + - name: Get Token Auth Rules + run: | + mkdir -p test-programs + solana program dump -u https://api.mainnet-beta.solana.com auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg test-programs/mpl_token_auth_rules.so + shell: bash diff --git a/.github/workflows/apply-version-update.yml b/.github/workflows/apply-version-update.yml index d65ef3f87b..8906edd857 100644 --- a/.github/workflows/apply-version-update.yml +++ b/.github/workflows/apply-version-update.yml @@ -120,7 +120,7 @@ jobs: update-pr-with-changes: needs: [ get-changes-scope, get-version-scope ] if: needs.get-version-scope.outputs.has-versioning == 'true' && needs.get-changes-scope.outputs.num-packages > 0 - runs-on: buildjet-16vcpu-ubuntu-2204 + runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v3 - uses: ./.github/actions/install-linux-build-deps diff --git a/.github/workflows/integration-reusable.yml b/.github/workflows/integration-reusable.yml index 5dc57bbb14..86ed27963d 100644 --- a/.github/workflows/integration-reusable.yml +++ b/.github/workflows/integration-reusable.yml @@ -47,7 +47,7 @@ jobs: - '.github/workflows/integration-reusable.yml' build-and-test: name: Build and Test - runs-on: buildjet-8vcpu-ubuntu-2204 + runs-on: ubuntu-latest-16-cores needs: changes if: | inputs.changes == false || diff --git a/.github/workflows/program-reusable.yml b/.github/workflows/program-reusable.yml index 43d5e7654f..170f48017b 100644 --- a/.github/workflows/program-reusable.yml +++ b/.github/workflows/program-reusable.yml @@ -55,7 +55,7 @@ jobs: build-lint-and-test: name: Build Lint and Test - runs-on: buildjet-8vcpu-ubuntu-2204 + runs-on: ubuntu-latest-16-cores needs: changes if: | inputs.changes == false || diff --git a/.github/workflows/program.yml b/.github/workflows/program.yml index d265dd060a..d0102a2132 100644 --- a/.github/workflows/program.yml +++ b/.github/workflows/program.yml @@ -30,7 +30,6 @@ jobs: - name: "fixed-price-sale" - name: "gumdrop" - name: "hydra" - - name: "nft-packs" - name: "token-entangler" uses: ./.github/workflows/program-reusable.yml diff --git a/.github/workflows/verify-lib-on-pr-open.yml b/.github/workflows/verify-lib-on-pr-open.yml index e732d0ed4e..3ceb1f96e3 100644 --- a/.github/workflows/verify-lib-on-pr-open.yml +++ b/.github/workflows/verify-lib-on-pr-open.yml @@ -83,7 +83,7 @@ jobs: needs: [get-changes-scope] # note: checking for empty string just doesn't work, so we explicitly return and check null in the case that there's nothing to verify if: ${{ needs.get-changes-scope.outputs.packages != 'null' }} - runs-on: buildjet-16vcpu-ubuntu-2204 + runs-on: ubuntu-latest-16-cores steps: # branch should be the branch from which the PR is opened - uses: actions/checkout@v3 diff --git a/build.sh b/build.sh index e034d782dc..3cfd4c2876 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ function exists_in_list() { input=$1 -programs="auction-house auctioneer candy-machine candy-machine-core fixed-price-sale gumdrop hydra nft-packs token-entangler" +programs="auction-house auctioneer candy-machine fixed-price-sale gumdrop hydra token-entangler" mkdir -p test-programs @@ -28,10 +28,10 @@ then cargo build-bpf --bpf-out-dir ../../test-programs/ cd ../../ done - echo "building testing-utils" - cd core/rust/testing-utils - cargo build-bpf --bpf-out-dir ../../../test-programs/ - cd ../../../ + #echo "building testing-utils" + #cd core/rust/testing-utils + #cargo build-bpf --bpf-out-dir ../../../test-programs/ + #cd ../../../ elif [[ $input = "token-auth-rules" ]] then solana program dump -u https://api.mainnet-beta.solana.com auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg ./test-programs/mpl_token_auth_rules.so diff --git a/candy-machine/program/tests/initialize.rs b/candy-machine/program/tests/initialize.rs index 25affb15e5..49a581906e 100644 --- a/candy-machine/program/tests/initialize.rs +++ b/candy-machine/program/tests/initialize.rs @@ -92,283 +92,3 @@ async fn init_default_success() { assert_account_empty(context, &candy_manager.collection_info.pda).await; assert!(post_balance > pre_balance); } - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn bot_tax_on_gatekeeper_expire_token() { - test_start("Bot Tax On Gatekeeper Expire Token"); - let mut context = candy_machine_program_test().start_with_context().await; - let context = &mut context; - - let gatekeeper_network = Keypair::new(); - let gatekeeper_authority = Keypair::new(); - - let client = RpcClient::new("https://api.devnet.solana.com".to_string()); - - let gateway_account_pubkey = GATEWAY_ACCOUNT_PUBKEY; - let gateway_executable_pubkey = - Pubkey::from_str("D5iXG4Z4hajVFAs8UbmBwdfe7PFqvoT4LNVvt1nKU5bx").unwrap(); - let gateway_account = client.get_account(&gateway_account_pubkey).unwrap(); - let gateway_executable_account = client.get_account(&gateway_executable_pubkey).unwrap(); - context.set_account(&gateway_account_pubkey, &gateway_account.into()); - context.set_account( - &gateway_executable_pubkey, - &gateway_executable_account.into(), - ); - - let mut candy_manager = CandyManager::init( - context, - None, - false, - None, - None, - Some(GatekeeperInfo { - set: true, - network_expire_feature: None, - gateway_app: GATEWAY_ACCOUNT_PUBKEY, - gateway_token_info: gatekeeper_network.pubkey(), - gatekeeper_config: GatekeeperConfig { - gatekeeper_network: gatekeeper_network.pubkey(), - expire_on_use: true, - }, - }), - ) - .await; - - airdrop(context, &candy_manager.minter.pubkey(), sol(2.0)) - .await - .unwrap(); - - let candy_data = custom_config( - candy_manager.authority.pubkey(), - Some(0), - true, - true, - None, - None, - None, - Some(GKConfig { - gatekeeper_network: gatekeeper_network.pubkey(), - expire_on_use: true, - }), - ); - - candy_manager - .create(context, candy_data.clone()) - .await - .unwrap(); - candy_manager.fill_config_lines(context).await.unwrap(); - - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - let transaction = Transaction::new_signed_with_payer( - &[instruction::add_gatekeeper( - &candy_manager.minter.pubkey(), - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - )], - Some(&candy_manager.minter.pubkey()), - &[&candy_manager.minter, &gatekeeper_network], - block_hash, - ); - - context - .banks_client - .process_transaction(transaction) - .await - .unwrap(); - - let (gatekeeper_account, _) = get_gatekeeper_address_with_seed( - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - ); - - let start = SystemTime::now(); - let now = start - .duration_since(UNIX_EPOCH) - .expect("Time went backwards"); - - // creating with an already expired token to fail the mint - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - let transaction = Transaction::new_signed_with_payer( - &[instruction::issue_vanilla( - &context.payer.pubkey(), - &candy_manager.minter.pubkey(), - &gatekeeper_account, - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - None, - Some(now.as_secs() as UnixTimestamp - 10), - )], - Some(&context.payer.pubkey()), - &[&context.payer, &gatekeeper_authority], - block_hash, - ); - - context - .banks_client - .process_transaction(transaction) - .await - .unwrap(); - - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - context - .banks_client - .process_transaction(Transaction::new_signed_with_payer( - &[instruction::add_feature_to_network( - context.payer.pubkey(), - gatekeeper_network.pubkey(), - NetworkFeature::UserTokenExpiry, - )], - Some(&context.payer.pubkey()), - &[&context.payer, &gatekeeper_network], - block_hash, - )) - .await - .unwrap(); - - candy_manager - .mint_and_assert_bot_tax(context) - .await - .unwrap(); -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn bot_tax_on_gatekeeper() { - test_start("Bot Tax On Gatekeeper"); - let mut context = candy_machine_program_test().start_with_context().await; - let context = &mut context; - - let gatekeeper_network = Keypair::new(); - let gatekeeper_authority = Keypair::new(); - - let client = RpcClient::new("https://api.devnet.solana.com".to_string()); - - let gateway_account_pubkey = GATEWAY_ACCOUNT_PUBKEY; - let gateway_executable_pubkey = - Pubkey::from_str("D5iXG4Z4hajVFAs8UbmBwdfe7PFqvoT4LNVvt1nKU5bx").unwrap(); - let gateway_account = client.get_account(&gateway_account_pubkey).unwrap(); - let gateway_executable_account = client.get_account(&gateway_executable_pubkey).unwrap(); - context.set_account(&gateway_account_pubkey, &gateway_account.into()); - context.set_account( - &gateway_executable_pubkey, - &gateway_executable_account.into(), - ); - - let mut candy_manager = CandyManager::init( - context, - None, - false, - None, - None, - Some(GatekeeperInfo { - set: true, - network_expire_feature: None, - gateway_app: GATEWAY_ACCOUNT_PUBKEY, - gateway_token_info: gatekeeper_network.pubkey(), - gatekeeper_config: GatekeeperConfig { - gatekeeper_network: gatekeeper_network.pubkey(), - expire_on_use: false, - }, - }), - ) - .await; - - airdrop(context, &candy_manager.minter.pubkey(), sol(2.0)) - .await - .unwrap(); - - let candy_data = custom_config( - candy_manager.authority.pubkey(), - Some(0), - true, - true, - None, - None, - None, - Some(GKConfig { - gatekeeper_network: gatekeeper_network.pubkey(), - expire_on_use: false, - }), - ); - - candy_manager - .create(context, candy_data.clone()) - .await - .unwrap(); - candy_manager.fill_config_lines(context).await.unwrap(); - - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - let transaction = Transaction::new_signed_with_payer( - &[instruction::add_gatekeeper( - &candy_manager.minter.pubkey(), - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - )], - Some(&candy_manager.minter.pubkey()), - &[&candy_manager.minter, &gatekeeper_network], - block_hash, - ); - - context - .banks_client - .process_transaction(transaction) - .await - .unwrap(); - - let (gatekeeper_account, _) = get_gatekeeper_address_with_seed( - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - ); - - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - let transaction = Transaction::new_signed_with_payer( - &[instruction::issue_vanilla( - &context.payer.pubkey(), - &candy_manager.minter.pubkey(), - &gatekeeper_account, - &gatekeeper_authority.pubkey(), - &gatekeeper_network.pubkey(), - None, - None, - )], - Some(&context.payer.pubkey()), - &[&context.payer, &gatekeeper_authority], - block_hash, - ); - - context - .banks_client - .process_transaction(transaction) - .await - .unwrap(); - - let (gateway_account, _) = get_gateway_token_address_with_seed( - &candy_manager.minter.pubkey(), - &None, - &gatekeeper_network.pubkey(), - ); - - let block_hash = context.banks_client.get_latest_blockhash().await.unwrap(); - // revoking the token so verification fails inside of gateway triggering bot tax - let transaction = Transaction::new_signed_with_payer( - &[instruction::set_state( - &gateway_account, - &gatekeeper_authority.pubkey(), - &gatekeeper_account, - GatewayTokenState::Revoked, - )], - Some(&context.payer.pubkey()), - &[&context.payer, &gatekeeper_authority], - block_hash, - ); - - context - .banks_client - .process_transaction(transaction) - .await - .unwrap(); - - candy_manager - .mint_and_assert_bot_tax(context) - .await - .unwrap(); -} diff --git a/candy-machine/program/tests/utils/candy_manager.rs b/candy-machine/program/tests/utils/candy_manager.rs index b4f9698fea..b819821318 100644 --- a/candy-machine/program/tests/utils/candy_manager.rs +++ b/candy-machine/program/tests/utils/candy_manager.rs @@ -1028,7 +1028,7 @@ impl CandyManager { } let sol_fees = { - let mut fees = 5000 + 5616720 + 2853600; + let mut fees = 5000 + 5616720 + 2853600 + 10000000; if self.freeze_info.set { let freeze_pda = self.get_freeze_pda(context).await; fees += freeze_pda.freeze_fee; diff --git a/candy-machine/program/tests/utils/helper_transactions.rs b/candy-machine/program/tests/utils/helper_transactions.rs index cc93099925..dbae7972c7 100644 --- a/candy-machine/program/tests/utils/helper_transactions.rs +++ b/candy-machine/program/tests/utils/helper_transactions.rs @@ -27,6 +27,7 @@ use std::result::Result; pub fn candy_machine_program_test() -> ProgramTest { let mut program = ProgramTest::new("mpl_candy_machine", mpl_candy_machine::id(), None); program.add_program("mpl_token_metadata", mpl_token_metadata::id(), None); + program.set_compute_max_units(400_000); program }