Skip to content

Commit

Permalink
fix: pre cargo generate cleanups (#1239)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Sergey Timoshin <[email protected]>
  • Loading branch information
ananas-block and sergeytimoshin authored Sep 20, 2024
1 parent 46b89e0 commit 9bc4b63
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 486 deletions.
1 change: 1 addition & 0 deletions .github/workflows/light-examples-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- name: ${{ matrix.program }}
run: |
source ./scripts/devenv.sh
npx nx build @lightprotocol/zk-compression-cli
IFS=',' read -r -a sub_tests <<< "${{ join(fromJSON(matrix['sub-tests']), ', ') }}"
for subtest in "${sub_tests[@]}"
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/light-system-programs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ jobs:
sub-tests: '[
"RUST_MIN_STACK=8388608 cargo-test-sbf -p e2e-test -- --nocapture --test-threads=1"
]'
- program: token-escrow-test
sub-tests: '[
"cargo test-sbf -p token-escrow -- --test-threads=1"
]'
- program: name-service-test
sub-tests: '[
"cargo test-sbf -p name-service -- --test-threads=1"
]'

steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions circuit-lib/light-prover-client/src/gnark/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use serde_json::json;
use sysinfo::{Signal, System};

static IS_LOADING: AtomicBool = AtomicBool::new(false);
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub enum ProofType {
Inclusion,
NonInclusion,
Expand Down Expand Up @@ -96,7 +96,7 @@ pub async fn health_check(retries: usize, timeout: usize) -> bool {
result
}

fn get_project_root() -> Option<String> {
pub fn get_project_root() -> Option<String> {
let output = Command::new("git")
.args(["rev-parse", "--show-toplevel"])
.output()
Expand Down
1 change: 0 additions & 1 deletion cli/src/utils/processProverServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export async function startProver(
args.push(`--non-inclusion=${proveNewAddresses ? "true" : "false"}`);
args.push("--keys-dir", keysDir);
args.push("--prover-address", `0.0.0.0:${proverPort}`);

console.log("Starting prover...");
spawnBinary(getProverNameByArch(), args);
await waitForServers([{ port: proverPort, path: "/" }]);
Expand Down
28 changes: 16 additions & 12 deletions client/src/indexer/test_indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use light_prover_client::{
gnark::{
combined_json_formatter::CombinedJsonStruct,
constants::{PROVE_PATH, SERVER_ADDRESS},
helpers::{spawn_prover, ProofType},
helpers::health_check,
inclusion_json_formatter::BatchInclusionJsonStruct,
non_inclusion_json_formatter::BatchNonInclusionJsonStruct,
proof_helpers::{compress_proof, deserialize_gnark_proof_json, proof_from_json_struct},
Expand Down Expand Up @@ -57,7 +57,6 @@ where
pub token_compressed_accounts: Vec<TokenDataWithMerkleContext>,
pub token_nullified_compressed_accounts: Vec<TokenDataWithMerkleContext>,
pub events: Vec<PublicTransactionEvent>,
proof_types: Vec<ProofType>,
_rpc: PhantomData<R>,
}

Expand Down Expand Up @@ -301,7 +300,6 @@ where
} else {
warn!("Error: {}", response_result.text().await.unwrap());
tokio::time::sleep(Duration::from_secs(1)).await;
spawn_prover(true, self.proof_types.as_slice()).await;
retries -= 1;
}
}
Expand Down Expand Up @@ -351,16 +349,23 @@ where
.map(|accounts| Self::add_address_merkle_tree_bundle(accounts))
.collect::<Vec<_>>();

let mut proof_types = vec![];
if inclusion {
proof_types.push(ProofType::Inclusion);
let mut types = vec!["start-prover"];
if !inclusion {
types.push("-c");
}
if non_inclusion {
proof_types.push(ProofType::NonInclusion);
}
if !proof_types.is_empty() {
spawn_prover(true, proof_types.as_slice()).await;
if !non_inclusion {
types.push("-n");
}
let project_root = light_prover_client::gnark::helpers::get_project_root().unwrap();
let project_root = project_root.trim_end_matches('\n').to_string();
let cli_bin_path = format!("{}/cli/test_bin", project_root);

std::process::Command::new("./run")
.args(types.as_slice())
.current_dir(cli_bin_path)
.spawn()
.expect("Failed to start prover");
health_check(20, 1).await;

Self {
state_merkle_trees,
Expand All @@ -370,7 +375,6 @@ where
token_compressed_accounts: Vec::new(),
token_nullified_compressed_accounts: Vec::new(),
events: Vec::new(),
proof_types,
_rpc: PhantomData,
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/name-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"@coral-xyz/anchor": "^0.29.0"
},
"devDependencies": {
"@lightprotocol/zk-compression-cli": "workspace:*",

"chai": "^4.3.4",
"mocha": "^10.7.3",
"ts-mocha": "^10.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/name-service/programs/name-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bench-sbf = []
idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build"]

[dependencies]
anchor-lang = { workspace = true, features = ["init-if-needed"] }
anchor-lang = { workspace=true}
borsh = { workspace = true }
light-hasher = { workspace = true, features = ["solana"] }
light-macros = { workspace = true }
Expand All @@ -35,6 +35,6 @@ solana-sdk = { workspace = true }

[dev-dependencies]
light-client = { workspace = true }
light-test-utils = { path = "../../../../test-utils", version = "1.0.0" }
light-test-utils = { path = "../../../../test-utils", version = "1.0.0", features = ["devenv"] }
solana-program-test = { workspace = true }
tokio = "1.36.0"
2 changes: 1 addition & 1 deletion examples/token-escrow/programs/token-escrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ solana-sdk = { workspace = true }

[dev-dependencies]
solana-program-test = { workspace = true }
light-test-utils = { version = "1.0.0", path = "../../../../test-utils" }
light-test-utils = { version = "1.0.0", path = "../../../../test-utils", features = ["devenv"] }
reqwest = "0.12"
tokio = { workspace = true }
light-prover-client = { path = "../../../../circuit-lib/light-prover-client", version = "1.0.0" }
Expand Down
Loading

0 comments on commit 9bc4b63

Please sign in to comment.