Skip to content
Open
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
2 changes: 1 addition & 1 deletion api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "verified_programs_api"
version = "1.4.3"
version = "1.4.4"
edition = "2021"

[features]
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WORKDIR /solana_verified_program_api/api

RUN cargo build --release

RUN cargo install solana-verify --git https://github.com/Ellipsis-Labs/solana-verifiable-build --tag v0.4.11
RUN cargo install solana-verify --git https://github.com/Ellipsis-Labs/solana-verifiable-build --tag v0.4.12

FROM debian:stable-slim AS api_final

Expand Down
2 changes: 1 addition & 1 deletion api/src/api/handlers/async_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) async fn process_async_verification(

/// Handler for asynchronous program verification with a specific signer
///
/// # Endpoint: POST /verify/with-signer
/// # Endpoint: POST /verify-with-signer
pub(crate) async fn process_async_verification_with_signer(
State(db): State<DbClient>,
Json(payload): Json<SolanaProgramBuildParamsWithSigner>,
Expand Down
2 changes: 1 addition & 1 deletion api/src/api/handlers/job_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tracing::{error, info};

/// Handler for retrieving the status of a verification job
///
/// # Endpoint: GET /jobs/:job_id
/// # Endpoint: GET /job/:job_id
///
/// # Arguments
/// * `db` - Database client from application state
Expand Down
2 changes: 1 addition & 1 deletion api/src/api/handlers/sync_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tracing::{error, info};

/// Handler for synchronous program verification
///
/// # Endpoint: POST /verify/sync
/// # Endpoint: POST /verify_sync
///
/// # Arguments
/// * `db` - Database client from application state
Expand Down
2 changes: 1 addition & 1 deletion api/src/api/handlers/verification_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub(crate) async fn get_verification_status(

/// Handler for retrieving all verification information for a program
///
/// # Endpoint: GET /status/:address/all
/// # Endpoint: GET /status-all/:address
///
/// # Arguments
/// * `db` - Database client from application state
Expand Down
82 changes: 67 additions & 15 deletions api/src/api/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ pub fn index() -> Json<Value> {
let value = INDEX_JSON.get_or_init(|| {
json!({
"endpoints": [
{
"path": "/",
"method": "GET",
"description": "Index route providing API endpoint documentation",
"params": {}
},
{
"path": "/verify",
"method": "POST",
"description": "Asynchronously verify a Solana program",
"description": "Deprecated: use /verify-with-signer. Asynchronously verify a Solana program",
"params": {
"repository": {
"type": "string",
Expand Down Expand Up @@ -62,15 +68,37 @@ pub fn index() -> Json<Value> {
"items": "string",
"required": false,
"description": "Additional cargo build arguments"
},
"arch": {
"type": "string",
"required": false,
"description": "Build for the given target architecture [default: v0]"
}
}
},
{
"path": "/verify/sync",
"path": "/verify-with-signer",
"method": "POST",
"description": "Synchronously verify a Solana program",
"description": "Preferred endpoint. Asynchronously verify using PDA params for the provided signer, PDA signer should be the program authority",
"params": {
"$ref": "#/endpoints/0/params"
"signer": {
"type": "string",
"required": true,
"description": "PDA signer public key should be the program authority"
},
"program_id": {
"type": "string",
"required": true,
"description": "Solana program ID on mainnet"
}
}
},
{
"path": "/verify_sync",
"method": "POST",
"description": "Deprecated: use /verify-with-signer. Synchronously verify a Solana program",
"params": {
"$ref": "#/endpoints/1/params"
}
},
{
Expand All @@ -86,19 +114,19 @@ pub fn index() -> Json<Value> {
}
},
{
"path": "/verified-programs",
"path": "/status-all/:address",
"method": "GET",
"description": "Get list of all verified programs",
"params": {}
},
{
"path": "/verified-programs/status",
"method": "GET",
"description": "Get detailed status of all verified programs",
"params": {}
"description": "Get all verification information for a program",
"params": {
"address": {
"type": "string",
"required": true,
"description": "Mainnet program address to check"
}
}
},
{
"path": "/jobs/:job_id",
"path": "/job/:job_id",
"method": "GET",
"description": "Check status of an async verification job",
"params": {
Expand All @@ -120,7 +148,31 @@ pub fn index() -> Json<Value> {
"description": "Program address to fetch logs for"
}
}
}
},
{
"path": "/verified-programs",
"method": "GET",
"description": "Get list of all verified programs",
"params": {}
},
{
"path": "/verified-programs/:page",
"method": "GET",
"description": "Get paginated list of verified programs",
"params": {
"page": {
"type": "integer",
"required": true,
"description": "Page number (starting from 1)"
}
}
},
{
"path": "/verified-programs-status",
"method": "GET",
"description": "Get detailed status of all verified programs",
"params": {}
},
]
})
});
Expand Down
70 changes: 58 additions & 12 deletions api/src/db/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,74 @@ impl DbClient {
query = query.filter(program_id.eq(payload.program_id.to_owned()));
query = query.filter(repository.eq(payload.repository.to_owned()));

if let Some(hash) = &payload.commit_hash {
query = query.filter(commit_hash.eq(hash));
// Handle commit_hash - must match exactly (Some vs Some, None vs None)
match &payload.commit_hash {
Some(hash) => {
query = query.filter(commit_hash.eq(hash));
}
None => {
query = query.filter(commit_hash.is_null());
}
}

if let Some(lib) = &payload.lib_name {
query = query.filter(lib_name.eq(lib));
// Handle lib_name - must match exactly
match &payload.lib_name {
Some(lib) => {
query = query.filter(lib_name.eq(lib));
}
None => {
query = query.filter(lib_name.is_null());
}
}

if let Some(bpf) = &payload.bpf_flag {
query = query.filter(bpf_flag.eq(bpf));
// Handle bpf_flag - NOT NULL field (use default when None)
match &payload.bpf_flag {
Some(bpf) => {
query = query.filter(bpf_flag.eq(bpf));
}
None => {
query = query.filter(bpf_flag.eq(false));
}
}

if let Some(base) = &payload.base_image {
query = query.filter(base_docker_image.eq(base));
// Handle base_image - must match exactly
match &payload.base_image {
Some(base) => {
query = query.filter(base_docker_image.eq(base));
}
None => {
query = query.filter(base_docker_image.is_null());
}
}

if let Some(mount) = &payload.mount_path {
query = query.filter(mount_path.eq(mount));
// Handle mount_path - must match exactly
match &payload.mount_path {
Some(mount) => {
query = query.filter(mount_path.eq(mount));
}
None => {
query = query.filter(mount_path.is_null());
}
}

if let Some(args) = payload.cargo_args.clone() {
query = query.filter(cargo_args.eq(args));
// Handle cargo_args - must match exactly
match &payload.cargo_args {
Some(ref args) => {
query = query.filter(cargo_args.eq(args.clone()));
}
None => {
query = query.filter(cargo_args.is_null());
}
}

// Handle arch - must match exactly
match &payload.arch {
Some(arch_value) => {
query = query.filter(arch.eq(arch_value));
}
None => {
query = query.filter(arch.is_null());
}
}

query = query.filter(signer.eq(pda_signer));
Expand Down