Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 9 additions & 35 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,48 +49,22 @@ jobs:
solana config set --url localhost
solana-keygen new --no-bip39-passphrase --silent --outfile ~/.config/solana/id.json

- name: Start Solana Test Validator
- name: Configure Validator Limits
run: |
mb-test-validator \
--ledger ./my-ledger-1 \
--reset &

# Wait for validator to be ready
timeout 30 bash -c 'until solana cluster-version --url http://localhost:8899 >/dev/null 2>&1; do sleep 1; done'

- name: Start MagicBlock Ephemeral Validator
run: |
# Magic voodoo to increase resource limits
sudo prlimit --pid $$ --nofile=1048576:1048576
sudo sysctl fs.inotify.max_user_instances=1280
sudo sysctl fs.inotify.max_user_watches=655360
RUST_LOG=info ephemeral-validator \
--remotes "http://localhost:8899" \
--remotes "ws://localhost:8900" \
-l "7799" \
--lifecycle ephemeral \
> /tmp/ephemeral-validator.log 2>&1 &

# Wait for validator to be ready
timeout 60 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done' || {
echo "ephemeral-validator did not become ready within 60 seconds"
echo "=== Last 100 lines of validator log ==="
tail -100 /tmp/ephemeral-validator.log || true
exit 1
}

- name: Test anchor-counter
env:
PROVIDER_ENDPOINT: http://127.0.0.1:8899
WS_ENDPOINT: ws://127.0.0.1:8900
EPHEMERAL_PROVIDER_ENDPOINT: http://127.0.0.1:7799
EPHEMERAL_WS_ENDPOINT: ws://127.0.0.1:7800
run: |
sudo prlimit --pid $$ --nofile=1048576:1048576
cd anchor-counter
anchor build && anchor deploy --provider.cluster localnet
yarn install
EPHEMERAL_PROVIDER_ENDPOINT="http://localhost:7799" \
EPHEMERAL_WS_ENDPOINT="ws://localhost:7800" \
PROVIDER_ENDPOINT=http://localhost:8899 \
WS_ENDPOINT=http://localhost:8900 \
anchor test \
--provider.cluster localnet \
--skip-local-validator \
--skip-deploy
anchor test --provider.cluster localnet
Comment thread
GabrielePicco marked this conversation as resolved.

# - name: Test anchor-minter
# run: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
**/.next/
**/.env
**/tsconfig.tsbuildinfo
!/anchor-counter/target/deploy/anchor_counter-keypair.json
!/anchor-counter/target/deploy/
/anchor-counter/target/deploy/*
!/anchor-counter/target/deploy/*-keypair.json
!/bolt-counter/target/deploy/counter-keypair.json
!/bolt-counter/target/deploy/increase-keypair.json

Expand Down
4 changes: 3 additions & 1 deletion anchor-counter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
**/.next/
**/.env
**/magicblock-test-storage
!/anchor-counter/target/deploy/anchor_counter-keypair.json
!target/deploy/
target/deploy/*
!target/deploy/*-keypair.json
!/bolt-counter/target/deploy/counter-keypair.json
!/bolt-counter/target/deploy/increase-keypair.json

Expand Down
2 changes: 1 addition & 1 deletion anchor-counter/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ skip-lint = false
url = "https://api.apr.dev"

[provider]
cluster = "devnet"
cluster = "localnet"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep default cluster aligned with test endpoint defaults

Changing the default provider cluster to localnet makes anchor test enter the local-validator path by default, but the test files still default their base-layer RPC to devnet when PROVIDER_ENDPOINT is unset (anchor-counter/tests/public-counter.ts and private-counter.ts), and fullstack-test.sh does not export PROVIDER_ENDPOINT/WS_ENDPOINT for local runs. In a normal local invocation (cd anchor-counter && anchor test), this now deploys programs to localnet while the test client sends transactions to devnet, which leads to consistent failures unless callers manually set extra env vars.

Useful? React with 👍 / 👎.

wallet = "~/.config/solana/id.json"

[scripts]
Expand Down
2 changes: 1 addition & 1 deletion anchor-counter/programs/private-counter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ephemeral_rollups_sdk::consts::PERMISSION_PROGRAM_ID;
use ephemeral_rollups_sdk::cpi::DelegateConfig;
use ephemeral_rollups_sdk::ephem::MagicIntentBundleBuilder;

declare_id!("91L33vBqfNaNfieqNCoqpxGZ2xVyJ29N3VcErR6LoepZ");
declare_id!("7Y2rYVGqRY31m7ogMHjmtdRMUjeWakoJ6iVx12i6voCY");

pub const COUNTER_SEED: &[u8] = b"counter";

Expand Down
2 changes: 1 addition & 1 deletion anchor-counter/programs/public-counter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ephemeral_rollups_sdk::anchor::{commit, delegate, ephemeral};
use ephemeral_rollups_sdk::cpi::DelegateConfig;
use ephemeral_rollups_sdk::ephem::MagicIntentBundleBuilder;

declare_id!("9RPwaXayVZHna1BYuRS4cLPJZuNGU1uS5V3heXB7v6Qi");
declare_id!("A4D1N6zdiwtAFr7mQcHkNbk2yXmDcpvovvU5D27kZoGv");
Comment thread
GabrielePicco marked this conversation as resolved.

pub const COUNTER_SEED: &[u8] = b"counter";

Expand Down
1 change: 1 addition & 0 deletions anchor-counter/target/deploy/private_counter-keypair.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[119,46,244,54,52,50,191,114,206,197,170,24,175,166,19,3,6,17,59,122,49,186,70,124,216,43,13,202,198,181,103,214,97,25,57,34,18,212,173,207,238,164,136,58,10,45,107,233,195,189,65,84,182,242,104,176,149,52,246,45,128,129,82,141]
1 change: 1 addition & 0 deletions anchor-counter/target/deploy/public_counter-keypair.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[106,108,44,14,228,142,138,192,251,141,149,227,72,172,124,173,42,3,203,113,154,21,153,82,212,199,168,15,115,100,198,39,134,139,128,19,183,247,83,39,234,34,183,10,57,232,90,108,188,49,31,188,22,201,57,242,183,210,9,200,162,251,250,195]
6 changes: 3 additions & 3 deletions anchor-counter/tests/private-counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import * as nacl from "tweetnacl";

const COUNTER_SEED = "counter";

describe.only("private-counter", () => {
describe("private-counter", () => {
console.log("private-counter.ts");

let provider = new anchor.AnchorProvider(
new anchor.web3.Connection(process.env.PROVIDER_ENDPOINT || "https://api.devnet.solana.com", {
wsEndpoint: process.env.PROVIDER_ENDPOINT?.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://") || undefined,
wsEndpoint: process.env.WS_ENDPOINT || undefined,
commitment: "confirmed",
}),
anchor.Wallet.local(),
Expand All @@ -27,7 +27,7 @@ describe.only("private-counter", () => {

let providerEphemeralRollup = new anchor.AnchorProvider(
new anchor.web3.Connection(ephemeralRpcEndpoint, {
wsEndpoint: process.env.TEE_PROVIDER_ENDPOINT?.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://") || undefined,
wsEndpoint: process.env.TEE_WS_ENDPOINT || undefined,
commitment: "confirmed",
}),
anchor.Wallet.local(),
Expand Down
6 changes: 3 additions & 3 deletions anchor-counter/tests/public-counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { GetCommitmentSignature } from "@magicblock-labs/ephemeral-rollups-sdk";

const COUNTER_SEED = "counter";

describe("public-counter", () => {
describe.only("public-counter", () => {
console.log("public-counter.ts");

const provider = new anchor.AnchorProvider(
new anchor.web3.Connection(
process.env.PROVIDER_ENDPOINT || "https://api.devnet.solana.com",
{
wsEndpoint: process.env.PROVIDER_ENDPOINT?.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://") || undefined,
wsEndpoint: process.env.WS_ENDPOINT || undefined,
commitment: "confirmed",
},
),
Expand All @@ -27,7 +27,7 @@ describe("public-counter", () => {
"https://devnet-as.magicblock.app/",
{
wsEndpoint:
process.env.EPHEMERAL_PROVIDER_ENDPOINT?.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://") || "wss://devnet-as.magicblock.app/",
process.env.EPHEMERAL_WS_ENDPOINT || "wss://devnet-as.magicblock.app/",
commitment: "confirmed",
},
),
Expand Down
41 changes: 9 additions & 32 deletions anchor-counter/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@magicblock-labs/ephemeral-rollups-sdk@0.8.8":
version "0.8.8"
resolved "https://registry.yarnpkg.com/@magicblock-labs/ephemeral-rollups-sdk/-/ephemeral-rollups-sdk-0.8.8.tgz#5df525ceedf1a667d0f2931f8ddcd83e2c06e062"
integrity sha512-qrhZXSjt4lY3io6pY/VTVkNj2FYGSu/uNwNuT6g3WUFvBVK9pH+enWQHEMSk/f9MsqRbn+prBPCYYVo+1QKMUA==
"@magicblock-labs/ephemeral-rollups-sdk@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@magicblock-labs/ephemeral-rollups-sdk/-/ephemeral-rollups-sdk-0.11.1.tgz#cfc8eb49b625e1f8971cbde7de474f4c39f381c9"
integrity sha512-4z0uFiCqpjUqdbavTVenvSdrLp4DD6EIcvlDYhwl6MMevogj9yrW9w0epyDigyB0xcGW2YH3C4ObzZ6H1a6o3w==
dependencies:
"@noble/curves" "^1.4.2"
"@noble/hashes" "^1.4.0"
"@phala/dcap-qvl" "^0.3.9"
"@solana/web3.js" "^1.98.0"
bs58 "^6.0.0"
Expand Down Expand Up @@ -1041,16 +1043,7 @@ stream-json@^1.9.1:
dependencies:
stream-chain "^2.2.5"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -1068,14 +1061,7 @@ string-width@^5.0.1, string-width@^5.1.2:
emoji-regex "^9.2.2"
strip-ansi "^7.0.1"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -1219,16 +1205,7 @@ workerpool@^9.2.0:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-9.3.4.tgz#f6c92395b2141afd78e2a889e80cb338fe9fca41"
integrity sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down
Loading
Loading