Skip to content

Commit 23789d8

Browse files
authored
Replace buildjet runners (#1162)
1 parent d49ff0a commit 23789d8

11 files changed

+32
-292
lines changed

.github/actions/program/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ runs:
1212
- uses: actions/checkout@v3
1313

1414
# Build and install deps
15+
- uses: ./.github/actions/program/auction-house
16+
if: ${{ inputs.name == 'auction-house' }}
17+
1518
- uses: ./.github/actions/program/auctioneer
1619
if: ${{ inputs.name == 'auctioneer' }}
1720

@@ -21,7 +24,7 @@ runs:
2124
- uses: ./.github/actions/program/token-metadata-and-metaplex
2225
if: ${{ inputs.name == 'nft-packs' }}
2326

24-
- name: "Dump token metadata"
27+
- name: 'Dump token metadata'
2528
working-directory: ./${{ inputs.name }}/program
2629
run: |
2730
mkdir -p ../../test-programs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Implicit dependencies
2+
# - actions/checkout@v3
3+
# - ./.github/actions/install-linux-build-deps
4+
# - ./.github/actions/install-solana
5+
# - ./.github/actions/install-rust
6+
7+
name: Auction House Program Dependencies
8+
description: Builds the dependencies for the Auction House program test
9+
runs:
10+
using: 'composite'
11+
steps:
12+
# Get Token Auth Rules program
13+
- name: Get Token Auth Rules
14+
run: |
15+
mkdir -p test-programs
16+
solana program dump -u https://api.mainnet-beta.solana.com auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg test-programs/mpl_token_auth_rules.so
17+
shell: bash

.github/workflows/apply-version-update.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
update-pr-with-changes:
121121
needs: [ get-changes-scope, get-version-scope ]
122122
if: needs.get-version-scope.outputs.has-versioning == 'true' && needs.get-changes-scope.outputs.num-packages > 0
123-
runs-on: buildjet-16vcpu-ubuntu-2204
123+
runs-on: ubuntu-latest-16-cores
124124
steps:
125125
- uses: actions/checkout@v3
126126
- uses: ./.github/actions/install-linux-build-deps

.github/workflows/integration-reusable.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- '.github/workflows/integration-reusable.yml'
4848
build-and-test:
4949
name: Build and Test
50-
runs-on: buildjet-8vcpu-ubuntu-2204
50+
runs-on: ubuntu-latest-16-cores
5151
needs: changes
5252
if: |
5353
inputs.changes == false ||

.github/workflows/program-reusable.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
build-lint-and-test:
5757
name: Build Lint and Test
58-
runs-on: buildjet-8vcpu-ubuntu-2204
58+
runs-on: ubuntu-latest-16-cores
5959
needs: changes
6060
if: |
6161
inputs.changes == false ||

.github/workflows/program.yml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
- name: "fixed-price-sale"
3131
- name: "gumdrop"
3232
- name: "hydra"
33-
- name: "nft-packs"
3433
- name: "token-entangler"
3534

3635
uses: ./.github/workflows/program-reusable.yml

.github/workflows/verify-lib-on-pr-open.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
needs: [get-changes-scope]
8484
# 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
8585
if: ${{ needs.get-changes-scope.outputs.packages != 'null' }}
86-
runs-on: buildjet-16vcpu-ubuntu-2204
86+
runs-on: ubuntu-latest-16-cores
8787
steps:
8888
# branch should be the branch from which the PR is opened
8989
- uses: actions/checkout@v3

build.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function exists_in_list() {
99

1010
input=$1
1111

12-
programs="auction-house auctioneer candy-machine candy-machine-core fixed-price-sale gumdrop hydra nft-packs token-entangler"
12+
programs="auction-house auctioneer candy-machine fixed-price-sale gumdrop hydra token-entangler"
1313

1414
mkdir -p test-programs
1515

@@ -28,10 +28,10 @@ then
2828
cargo build-bpf --bpf-out-dir ../../test-programs/
2929
cd ../../
3030
done
31-
echo "building testing-utils"
32-
cd core/rust/testing-utils
33-
cargo build-bpf --bpf-out-dir ../../../test-programs/
34-
cd ../../../
31+
#echo "building testing-utils"
32+
#cd core/rust/testing-utils
33+
#cargo build-bpf --bpf-out-dir ../../../test-programs/
34+
#cd ../../../
3535
elif [[ $input = "token-auth-rules" ]]
3636
then
3737
solana program dump -u https://api.mainnet-beta.solana.com auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg ./test-programs/mpl_token_auth_rules.so

candy-machine/program/tests/initialize.rs

-280
Original file line numberDiff line numberDiff line change
@@ -92,283 +92,3 @@ async fn init_default_success() {
9292
assert_account_empty(context, &candy_manager.collection_info.pda).await;
9393
assert!(post_balance > pre_balance);
9494
}
95-
96-
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
97-
async fn bot_tax_on_gatekeeper_expire_token() {
98-
test_start("Bot Tax On Gatekeeper Expire Token");
99-
let mut context = candy_machine_program_test().start_with_context().await;
100-
let context = &mut context;
101-
102-
let gatekeeper_network = Keypair::new();
103-
let gatekeeper_authority = Keypair::new();
104-
105-
let client = RpcClient::new("https://api.devnet.solana.com".to_string());
106-
107-
let gateway_account_pubkey = GATEWAY_ACCOUNT_PUBKEY;
108-
let gateway_executable_pubkey =
109-
Pubkey::from_str("D5iXG4Z4hajVFAs8UbmBwdfe7PFqvoT4LNVvt1nKU5bx").unwrap();
110-
let gateway_account = client.get_account(&gateway_account_pubkey).unwrap();
111-
let gateway_executable_account = client.get_account(&gateway_executable_pubkey).unwrap();
112-
context.set_account(&gateway_account_pubkey, &gateway_account.into());
113-
context.set_account(
114-
&gateway_executable_pubkey,
115-
&gateway_executable_account.into(),
116-
);
117-
118-
let mut candy_manager = CandyManager::init(
119-
context,
120-
None,
121-
false,
122-
None,
123-
None,
124-
Some(GatekeeperInfo {
125-
set: true,
126-
network_expire_feature: None,
127-
gateway_app: GATEWAY_ACCOUNT_PUBKEY,
128-
gateway_token_info: gatekeeper_network.pubkey(),
129-
gatekeeper_config: GatekeeperConfig {
130-
gatekeeper_network: gatekeeper_network.pubkey(),
131-
expire_on_use: true,
132-
},
133-
}),
134-
)
135-
.await;
136-
137-
airdrop(context, &candy_manager.minter.pubkey(), sol(2.0))
138-
.await
139-
.unwrap();
140-
141-
let candy_data = custom_config(
142-
candy_manager.authority.pubkey(),
143-
Some(0),
144-
true,
145-
true,
146-
None,
147-
None,
148-
None,
149-
Some(GKConfig {
150-
gatekeeper_network: gatekeeper_network.pubkey(),
151-
expire_on_use: true,
152-
}),
153-
);
154-
155-
candy_manager
156-
.create(context, candy_data.clone())
157-
.await
158-
.unwrap();
159-
candy_manager.fill_config_lines(context).await.unwrap();
160-
161-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
162-
let transaction = Transaction::new_signed_with_payer(
163-
&[instruction::add_gatekeeper(
164-
&candy_manager.minter.pubkey(),
165-
&gatekeeper_authority.pubkey(),
166-
&gatekeeper_network.pubkey(),
167-
)],
168-
Some(&candy_manager.minter.pubkey()),
169-
&[&candy_manager.minter, &gatekeeper_network],
170-
block_hash,
171-
);
172-
173-
context
174-
.banks_client
175-
.process_transaction(transaction)
176-
.await
177-
.unwrap();
178-
179-
let (gatekeeper_account, _) = get_gatekeeper_address_with_seed(
180-
&gatekeeper_authority.pubkey(),
181-
&gatekeeper_network.pubkey(),
182-
);
183-
184-
let start = SystemTime::now();
185-
let now = start
186-
.duration_since(UNIX_EPOCH)
187-
.expect("Time went backwards");
188-
189-
// creating with an already expired token to fail the mint
190-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
191-
let transaction = Transaction::new_signed_with_payer(
192-
&[instruction::issue_vanilla(
193-
&context.payer.pubkey(),
194-
&candy_manager.minter.pubkey(),
195-
&gatekeeper_account,
196-
&gatekeeper_authority.pubkey(),
197-
&gatekeeper_network.pubkey(),
198-
None,
199-
Some(now.as_secs() as UnixTimestamp - 10),
200-
)],
201-
Some(&context.payer.pubkey()),
202-
&[&context.payer, &gatekeeper_authority],
203-
block_hash,
204-
);
205-
206-
context
207-
.banks_client
208-
.process_transaction(transaction)
209-
.await
210-
.unwrap();
211-
212-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
213-
context
214-
.banks_client
215-
.process_transaction(Transaction::new_signed_with_payer(
216-
&[instruction::add_feature_to_network(
217-
context.payer.pubkey(),
218-
gatekeeper_network.pubkey(),
219-
NetworkFeature::UserTokenExpiry,
220-
)],
221-
Some(&context.payer.pubkey()),
222-
&[&context.payer, &gatekeeper_network],
223-
block_hash,
224-
))
225-
.await
226-
.unwrap();
227-
228-
candy_manager
229-
.mint_and_assert_bot_tax(context)
230-
.await
231-
.unwrap();
232-
}
233-
234-
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
235-
async fn bot_tax_on_gatekeeper() {
236-
test_start("Bot Tax On Gatekeeper");
237-
let mut context = candy_machine_program_test().start_with_context().await;
238-
let context = &mut context;
239-
240-
let gatekeeper_network = Keypair::new();
241-
let gatekeeper_authority = Keypair::new();
242-
243-
let client = RpcClient::new("https://api.devnet.solana.com".to_string());
244-
245-
let gateway_account_pubkey = GATEWAY_ACCOUNT_PUBKEY;
246-
let gateway_executable_pubkey =
247-
Pubkey::from_str("D5iXG4Z4hajVFAs8UbmBwdfe7PFqvoT4LNVvt1nKU5bx").unwrap();
248-
let gateway_account = client.get_account(&gateway_account_pubkey).unwrap();
249-
let gateway_executable_account = client.get_account(&gateway_executable_pubkey).unwrap();
250-
context.set_account(&gateway_account_pubkey, &gateway_account.into());
251-
context.set_account(
252-
&gateway_executable_pubkey,
253-
&gateway_executable_account.into(),
254-
);
255-
256-
let mut candy_manager = CandyManager::init(
257-
context,
258-
None,
259-
false,
260-
None,
261-
None,
262-
Some(GatekeeperInfo {
263-
set: true,
264-
network_expire_feature: None,
265-
gateway_app: GATEWAY_ACCOUNT_PUBKEY,
266-
gateway_token_info: gatekeeper_network.pubkey(),
267-
gatekeeper_config: GatekeeperConfig {
268-
gatekeeper_network: gatekeeper_network.pubkey(),
269-
expire_on_use: false,
270-
},
271-
}),
272-
)
273-
.await;
274-
275-
airdrop(context, &candy_manager.minter.pubkey(), sol(2.0))
276-
.await
277-
.unwrap();
278-
279-
let candy_data = custom_config(
280-
candy_manager.authority.pubkey(),
281-
Some(0),
282-
true,
283-
true,
284-
None,
285-
None,
286-
None,
287-
Some(GKConfig {
288-
gatekeeper_network: gatekeeper_network.pubkey(),
289-
expire_on_use: false,
290-
}),
291-
);
292-
293-
candy_manager
294-
.create(context, candy_data.clone())
295-
.await
296-
.unwrap();
297-
candy_manager.fill_config_lines(context).await.unwrap();
298-
299-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
300-
let transaction = Transaction::new_signed_with_payer(
301-
&[instruction::add_gatekeeper(
302-
&candy_manager.minter.pubkey(),
303-
&gatekeeper_authority.pubkey(),
304-
&gatekeeper_network.pubkey(),
305-
)],
306-
Some(&candy_manager.minter.pubkey()),
307-
&[&candy_manager.minter, &gatekeeper_network],
308-
block_hash,
309-
);
310-
311-
context
312-
.banks_client
313-
.process_transaction(transaction)
314-
.await
315-
.unwrap();
316-
317-
let (gatekeeper_account, _) = get_gatekeeper_address_with_seed(
318-
&gatekeeper_authority.pubkey(),
319-
&gatekeeper_network.pubkey(),
320-
);
321-
322-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
323-
let transaction = Transaction::new_signed_with_payer(
324-
&[instruction::issue_vanilla(
325-
&context.payer.pubkey(),
326-
&candy_manager.minter.pubkey(),
327-
&gatekeeper_account,
328-
&gatekeeper_authority.pubkey(),
329-
&gatekeeper_network.pubkey(),
330-
None,
331-
None,
332-
)],
333-
Some(&context.payer.pubkey()),
334-
&[&context.payer, &gatekeeper_authority],
335-
block_hash,
336-
);
337-
338-
context
339-
.banks_client
340-
.process_transaction(transaction)
341-
.await
342-
.unwrap();
343-
344-
let (gateway_account, _) = get_gateway_token_address_with_seed(
345-
&candy_manager.minter.pubkey(),
346-
&None,
347-
&gatekeeper_network.pubkey(),
348-
);
349-
350-
let block_hash = context.banks_client.get_latest_blockhash().await.unwrap();
351-
// revoking the token so verification fails inside of gateway triggering bot tax
352-
let transaction = Transaction::new_signed_with_payer(
353-
&[instruction::set_state(
354-
&gateway_account,
355-
&gatekeeper_authority.pubkey(),
356-
&gatekeeper_account,
357-
GatewayTokenState::Revoked,
358-
)],
359-
Some(&context.payer.pubkey()),
360-
&[&context.payer, &gatekeeper_authority],
361-
block_hash,
362-
);
363-
364-
context
365-
.banks_client
366-
.process_transaction(transaction)
367-
.await
368-
.unwrap();
369-
370-
candy_manager
371-
.mint_and_assert_bot_tax(context)
372-
.await
373-
.unwrap();
374-
}

candy-machine/program/tests/utils/candy_manager.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ impl CandyManager {
10281028
}
10291029

10301030
let sol_fees = {
1031-
let mut fees = 5000 + 5616720 + 2853600;
1031+
let mut fees = 5000 + 5616720 + 2853600 + 10000000;
10321032
if self.freeze_info.set {
10331033
let freeze_pda = self.get_freeze_pda(context).await;
10341034
fees += freeze_pda.freeze_fee;

0 commit comments

Comments
 (0)