Add precompile verification to preflight (#12486)
This commit is contained in:
parent
f0e02d2588
commit
6583c8cffe
|
@ -2210,6 +2210,10 @@ impl RpcSol for RpcSolImpl {
|
||||||
return Err(RpcCustomError::TransactionSignatureVerificationFailure.into());
|
return Err(RpcCustomError::TransactionSignatureVerificationFailure.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Err(e) = transaction.verify_precompiles() {
|
||||||
|
return Err(RpcCustomError::TransactionPrecompileVerificationFailure(e).into());
|
||||||
|
}
|
||||||
|
|
||||||
if meta.health.check() != RpcHealthStatus::Ok {
|
if meta.health.check() != RpcHealthStatus::Ok {
|
||||||
return Err(RpcCustomError::RpcNodeUnhealthy.into());
|
return Err(RpcCustomError::RpcNodeUnhealthy.into());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ const JSON_RPC_SERVER_ERROR_2: i64 = -32002;
|
||||||
const JSON_RPC_SERVER_ERROR_3: i64 = -32003;
|
const JSON_RPC_SERVER_ERROR_3: i64 = -32003;
|
||||||
const JSON_RPC_SERVER_ERROR_4: i64 = -32004;
|
const JSON_RPC_SERVER_ERROR_4: i64 = -32004;
|
||||||
const JSON_RPC_SERVER_ERROR_5: i64 = -32005;
|
const JSON_RPC_SERVER_ERROR_5: i64 = -32005;
|
||||||
|
const JSON_RPC_SERVER_ERROR_6: i64 = -32006;
|
||||||
|
|
||||||
pub enum RpcCustomError {
|
pub enum RpcCustomError {
|
||||||
BlockCleanedUp {
|
BlockCleanedUp {
|
||||||
|
@ -22,6 +23,7 @@ pub enum RpcCustomError {
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
},
|
},
|
||||||
RpcNodeUnhealthy,
|
RpcNodeUnhealthy,
|
||||||
|
TransactionPrecompileVerificationFailure(solana_sdk::transaction::TransactionError),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RpcCustomError> for Error {
|
impl From<RpcCustomError> for Error {
|
||||||
|
@ -58,6 +60,11 @@ impl From<RpcCustomError> for Error {
|
||||||
message: "RPC node is unhealthy".to_string(),
|
message: "RPC node is unhealthy".to_string(),
|
||||||
data: None,
|
data: None,
|
||||||
},
|
},
|
||||||
|
RpcCustomError::TransactionPrecompileVerificationFailure(e) => Self {
|
||||||
|
code: ErrorCode::ServerError(JSON_RPC_SERVER_ERROR_6),
|
||||||
|
message: format!("Transaction precompile verification failure {:?}", e),
|
||||||
|
data: None,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue