Limit message encoding to base-64 (#19468)
This commit is contained in:
parent
84db04ce6c
commit
f81bfc8462
|
@ -3892,12 +3892,7 @@ impl RpcClient {
|
||||||
serialize_and_encode::<Message>(message, UiTransactionEncoding::Base64)?;
|
serialize_and_encode::<Message>(message, UiTransactionEncoding::Base64)?;
|
||||||
let result = self.send::<Response<Option<u64>>>(
|
let result = self.send::<Response<Option<u64>>>(
|
||||||
RpcRequest::GetFeeForMessage,
|
RpcRequest::GetFeeForMessage,
|
||||||
json!([
|
json!([blockhash.to_string(), serialized_encoded, self.commitment()]),
|
||||||
blockhash.to_string(),
|
|
||||||
serialized_encoded,
|
|
||||||
UiTransactionEncoding::Base64,
|
|
||||||
self.commitment(),
|
|
||||||
]),
|
|
||||||
)?;
|
)?;
|
||||||
result
|
result
|
||||||
.value
|
.value
|
||||||
|
|
|
@ -1149,8 +1149,7 @@ Get the fee the network will charge for a particular Message
|
||||||
#### Parameters:
|
#### Parameters:
|
||||||
|
|
||||||
- `blockhash: <string>` - The blockhash of this block, as base-58 encoded string
|
- `blockhash: <string>` - The blockhash of this block, as base-58 encoded string
|
||||||
- `message: <string>` - Encoded Message
|
- `message: <string>` - Base-64 encoded Message
|
||||||
- `encoding: <string>` - (optional) Encoding used for the message data. Either `"base58"` (*slow*, **DEPRECATED**), or `"base64"`. (default: `"base58"`).
|
|
||||||
- `<object>` - (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash)
|
- `<object>` - (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash)
|
||||||
|
|
||||||
#### Results:
|
#### Results:
|
||||||
|
@ -1168,7 +1167,6 @@ curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
|
||||||
"method":"getFeeForMessage",
|
"method":"getFeeForMessage",
|
||||||
"params":[
|
"params":[
|
||||||
"FxVKTksYShgKjnFG3RQUEo2AEesDb4ZHGY3NGJ7KHd7F","AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",
|
"FxVKTksYShgKjnFG3RQUEo2AEesDb4ZHGY3NGJ7KHd7F","AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",
|
||||||
"base64",
|
|
||||||
{
|
{
|
||||||
"commitment":"processed"
|
"commitment":"processed"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3111,7 +3111,6 @@ pub mod rpc_full {
|
||||||
meta: Self::Metadata,
|
meta: Self::Metadata,
|
||||||
blockhash: String,
|
blockhash: String,
|
||||||
data: String,
|
data: String,
|
||||||
encoding: UiTransactionEncoding,
|
|
||||||
commitment: Option<CommitmentConfig>,
|
commitment: Option<CommitmentConfig>,
|
||||||
) -> Result<RpcResponse<Option<u64>>>;
|
) -> Result<RpcResponse<Option<u64>>>;
|
||||||
}
|
}
|
||||||
|
@ -3636,13 +3635,13 @@ pub mod rpc_full {
|
||||||
meta: Self::Metadata,
|
meta: Self::Metadata,
|
||||||
blockhash: String,
|
blockhash: String,
|
||||||
data: String,
|
data: String,
|
||||||
encoding: UiTransactionEncoding,
|
|
||||||
commitment: Option<CommitmentConfig>,
|
commitment: Option<CommitmentConfig>,
|
||||||
) -> Result<RpcResponse<Option<u64>>> {
|
) -> Result<RpcResponse<Option<u64>>> {
|
||||||
debug!("get_fee_for_message rpc request received");
|
debug!("get_fee_for_message rpc request received");
|
||||||
let blockhash = Hash::from_str(&blockhash)
|
let blockhash = Hash::from_str(&blockhash)
|
||||||
.map_err(|e| Error::invalid_params(format!("{:?}", e)))?;
|
.map_err(|e| Error::invalid_params(format!("{:?}", e)))?;
|
||||||
let (_, message) = decode_and_deserialize::<Message>(data, encoding)?;
|
let (_, message) =
|
||||||
|
decode_and_deserialize::<Message>(data, UiTransactionEncoding::Base64)?;
|
||||||
SanitizedMessage::try_from(message)
|
SanitizedMessage::try_from(message)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
Error::invalid_params(format!("invalid transaction message: {}", err))
|
Error::invalid_params(format!("invalid transaction message: {}", err))
|
||||||
|
|
Loading…
Reference in New Issue