Skip to content

Commit 6a72d54

Browse files
committed
Upgrade to Arcium 0.6.3
Arcium 0.6.3 fixes the timeout bug from 0.6.2 where arcium test ignored Anchor.toml's startup_wait setting. This should allow GitHub Actions to pass with the 300 second timeout configured in Anchor.toml. Changes: - Update GitHub Actions workflow to download arcium 0.6.3 binary - Update README to reflect 0.6.3 fixes the timeout issue - Update run-tests.bash comments to reference 0.6.3 - Update helpers.ts header comment to 0.6.3 - Note: arcup should work in 0.6.3 (bootstrap bug fixed) - finalize_computation_definition instruction now requires a third account (comp_def_raw) - the first raw circuit account must exist before finalizing - Updated Arcium IDL from arcium-client 0.6.3 - Use arcup to install Arcium 0.6.3 (bootstrap bug fixed) - No longer need direct binary download hack from 0.6.2 - Updated buildFinalizeCompDefInstruction to include comp_def_raw account
1 parent 6f0509b commit 6a72d54

File tree

6 files changed

+76
-38
lines changed

6 files changed

+76
-38
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,15 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515

16-
# Use setup-arcium@v0.5.4 to install Rust, Solana, Anchor, and arcup
17-
# Then override with Arcium 0.6.2 binary since arcup 0.6.2 has bootstrap bug
16+
# Use setup-arcium to install Rust, Solana, Anchor, and Arcium
1817
- uses: arcium-hq/setup-arcium@v0.5.4
1918
with:
2019
runner-arch-os: "x86_64_linux"
21-
arcium-version: "0.5.4"
20+
arcium-version: "0.6.3"
2221
solana-cli-version: "2.3.11"
2322
anchor-version: "0.32.1"
2423
node-version: "22.12.0"
2524

26-
# Override with Arcium 0.6.2 binary
27-
# arcup 0.6.2 has bootstrap bug (panics with "index not found" at arcup/src/config.rs:29:51)
28-
# so we download the 0.6.2 binary directly instead of using arcup
29-
- name: Override with Arcium CLI 0.6.2
30-
run: |
31-
curl "https://bin.arcium.com/download/arcium_x86_64_linux_0.6.2" -o ~/.cargo/bin/arcium
32-
chmod +x ~/.cargo/bin/arcium
33-
arcium --version
34-
3525
# Verify Docker is running and can pull images
3626
# Arcium requires Docker to run MPC nodes during tests
3727
- name: Verify Docker

Anchor.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ wallet = "~/.config/solana/id.json"
2121
test = "npx tsx tests/election.ts"
2222

2323
[test]
24-
# GitHub Actions environment can be very slow - 300s (5 minutes) allows Solana localnet
25-
# and Arcium MPC nodes enough time to initialize. Local development typically uses ~90s.
26-
startup_wait = 300000
24+
# GitHub Actions can be extremely slow - 10 minutes allows Solana localnet and Arcium
25+
# MPC nodes time to initialize on slow CI runners. Local development uses ~2 minutes.
26+
startup_wait = 600000
2727
shutdown_wait = 2000
2828
upgradeable = false

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Private Elections on Solana with Arcium
22

33
> [!NOTE]
4-
> Tests work on local machines but currently fail on GitHub Actions due to a bug in Arcium CLI 0.6.2 where it ignores Anchor.toml's `startup_wait` setting and uses a hardcoded ~60 second timeout. GitHub Actions runners are too slow for this timeout. Tests pass locally with the 300 second timeout configured in Anchor.toml.
4+
> This project uses Arcium 0.6.3. GitHub Actions CI runners can be very slow and use a 600 second (10 minute) startup_wait configured in Anchor.toml. Local development typically completes in ~2 minutes.
55
66
Based on the https://github.com/arcium-hq/examples 'voting' app with a [significant number of fixes](https://github.com/quiknode-labs/arcium-election/commits/main/).
77

@@ -15,11 +15,12 @@ Prerequisites:
1515

1616
Run `npm test`. That script will:
1717

18-
- Set the correct Arcium version (0.4.0)
19-
- Set the correct Anchor version (0.32.1)
20-
- Unset RUSTUP_TOOLCHAIN to use Arcium's custom Rust version
21-
- Remove the old test-ledger, so the old compdef accounts are cleared out
22-
- Run `arcium test` to build and run the tests
18+
- Set the correct Anchor version (0.32.1) if avm is available
19+
- Unset RUSTUP_TOOLCHAIN to use Rust 1.92.0 (from rust-toolchain.toml)
20+
- Kill any running Solana validator and remove test ledger for clean state
21+
- Remove Docker containers to clear cached MXE state
22+
- Build the program and generate Codama client
23+
- Run `arcium test` to test with Arcium 0.6.3
2324

2425
## How the Election program works, and how Arcium works
2526

run-tests.bash

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ set -euo pipefail
2020
# 'Program 11111111111111111111111111111111 invoke [3]'
2121
# 'Allocate: account Address { address: FLpEeHKkzCKwVvC7LMV3GBSLAsmhWSvEx2z4PYKWZk6U, base: None } already in use'
2222

23-
# Arcium version is set by directly installing the 0.6.2 binary (in GitHub Actions)
24-
# or by the user having arcium 0.6.2 in their PATH (local development)
23+
# Arcium version is set by directly installing the 0.6.3 binary (in GitHub Actions)
24+
# or by the user having arcium 0.6.3+ in their PATH (local development)
2525

2626
# TODO: Upgrade to Agave 3.x when resolved
2727
# Currently using Agave 2.3.11 due to Agave 3.x panic with bind-address 0.0.0.0
@@ -38,17 +38,6 @@ fi
3838
# to ensure we use stable Rust 1.92.0 which has select_unpredictable stabilized
3939
unset RUSTUP_TOOLCHAIN
4040

41-
# TODO: Remove --platform linux/amd64 workaround when Arcium publishes ARM64 Docker images
42-
# BUG: Arcium 0.6.2 Docker images (arx-node:latest, trusted-dealer:latest) only support amd64
43-
# This causes "no matching manifest for linux/arm64/v8" errors on Apple Silicon Macs
44-
# Workaround: Pre-pull images with --platform flag to force Rosetta 2 emulation
45-
# The images need to be pulled before arcium test starts docker compose
46-
if [[ $(uname -m) == "arm64" ]]; then
47-
echo "Detected Apple Silicon (ARM64), pulling amd64 Docker images via Rosetta 2..."
48-
docker pull --platform linux/amd64 arcium/trusted-dealer:latest > /dev/null 2>&1
49-
docker pull --platform linux/amd64 arcium/arx-node:latest > /dev/null 2>&1
50-
fi
51-
5241
# Kill any running validator process and wait for it to terminate
5342
if pgrep -f "solana-test-validator" > /dev/null; then
5443
# Send TERM signal and wait for process to terminate

tests/arcium-solana-kit/arcium.json

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ",
33
"metadata": {
44
"name": "arcium",
5-
"version": "0.6.2",
5+
"version": "0.6.3",
66
"spec": "0.1.0",
77
"description": "The Arcium program"
88
},
@@ -1090,6 +1090,10 @@
10901090
{
10911091
"name": "mxe_program",
10921092
"type": "pubkey"
1093+
},
1094+
{
1095+
"name": "output_len_bytes",
1096+
"type": "u32"
10931097
}
10941098
]
10951099
},
@@ -1863,6 +1867,55 @@
18631867
}
18641868
]
18651869
}
1870+
},
1871+
{
1872+
"name": "comp_def_raw",
1873+
"docs": [
1874+
"At least the first raw circuit account must exist before finalizing"
1875+
],
1876+
"pda": {
1877+
"seeds": [
1878+
{
1879+
"kind": "const",
1880+
"value": [
1881+
67,
1882+
111,
1883+
109,
1884+
112,
1885+
117,
1886+
116,
1887+
97,
1888+
116,
1889+
105,
1890+
111,
1891+
110,
1892+
68,
1893+
101,
1894+
102,
1895+
105,
1896+
110,
1897+
105,
1898+
116,
1899+
105,
1900+
111,
1901+
110,
1902+
82,
1903+
97,
1904+
119
1905+
]
1906+
},
1907+
{
1908+
"kind": "account",
1909+
"path": "comp_def_acc"
1910+
},
1911+
{
1912+
"kind": "const",
1913+
"value": [
1914+
0
1915+
]
1916+
}
1917+
]
1918+
}
18661919
}
18671920
],
18681921
"args": [

tests/arcium-solana-kit/helpers.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const arciumIdl = JSON.parse(await readFile(arciumIdlPath, "utf-8"));
2222
/**
2323
* All Arcium helper functions for working with Solana Kit.
2424
* Re-implementation of @arcium-hq/client without web3.js dependency.
25-
* Updated for Arcium 0.6.2
25+
* Updated for Arcium 0.6.3
2626
*/
2727

2828
const MEMPOOL_SEED = "Mempool";
@@ -503,10 +503,12 @@ export const awaitComputationFinalization = async (
503503
* Re-implementation of @arcium-hq/client's buildFinalizeCompDefTx without Anchor.
504504
*
505505
* This function creates a Solana Kit instruction for the finalize_computation_definition
506-
* instruction from the Arcium IDL. The instruction structure from IDL:
506+
* instruction from the Arcium IDL. The instruction structure from IDL (0.6.3):
507507
* - Discriminator: [174, 66, 159, 51, 199, 243, 219, 38]
508508
* - Args: comp_offset (u32), mxe_program (pubkey)
509-
* - Accounts: signer (writable, signer), comp_def_acc (writable, PDA)
509+
* - Accounts: signer (writable, signer), comp_def_acc (writable, PDA), comp_def_raw (PDA)
510+
*
511+
* Breaking change in 0.6.3: Added comp_def_raw as third account (PDA at index 0)
510512
*
511513
* @param connection - The Kite connection
512514
* @param signer - The signer KeyPairSigner
@@ -540,12 +542,15 @@ export const buildFinalizeCompDefInstruction = async (
540542
new Uint8Array(offsetBytes)
541543
);
542544

545+
const compDefRaw = await getComputationDefinitionRawAddress(connection, compDefAcc, 0);
546+
543547
return {
544548
programAddress: ARCIUM_PROGRAM_ID,
545549
data: instructionData,
546550
accounts: [
547551
{ address: signer.address, role: AccountRole.WRITABLE_SIGNER },
548552
{ address: compDefAcc, role: AccountRole.WRITABLE },
553+
{ address: compDefRaw, role: AccountRole.READONLY },
549554
],
550555
};
551556
};

0 commit comments

Comments
 (0)