Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 3944195

Browse files
committed
cleanup
1 parent d46407c commit 3944195

File tree

4 files changed

+12
-77
lines changed

4 files changed

+12
-77
lines changed

token/cli/src/clap_app.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -859,30 +859,6 @@ pub fn app<'a, 'b>(
859859
.takes_value(false)
860860
.help("Enables group member configurations in the mint. The mint authority must initialize the member."),
861861
)
862-
.arg(
863-
Arg::with_name("enable_confidential_mint_burn")
864-
.long("enable-confidential-mint-burn")
865-
.takes_value(false)
866-
.help(
867-
"Enables minting of new tokens into confidential balance and burning of tokens directly from the confidential balance"
868-
),
869-
)
870-
.arg(
871-
Arg::with_name("auditor_pubkey")
872-
.long("auditor-pubkey")
873-
.value_name("AUDITOR_PUBKEY")
874-
.takes_value(true)
875-
.help(
876-
"The auditor encryption public key for mints with the confidential \
877-
transfer extension enabled. The corresponding private key for \
878-
this auditor public key can be used to decrypt all confidential \
879-
transfers involving tokens from this mint. Currently, the auditor \
880-
public key can only be specified as a direct *base64* encoding of \
881-
an ElGamal public key. More methods of specifying the auditor public \
882-
key will be supported in a future version. To disable auditability \
883-
feature for the token, use \"none\"."
884-
)
885-
)
886862
.nonce_args(true)
887863
.arg(memo_arg())
888864
)

token/cli/src/command.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ use {
6969
token::{ComputeUnitLimit, ExtensionInitializationParams, ProofAccount, Token},
7070
},
7171
spl_token_confidential_transfer_proof_generation::{
72-
transfer::TransferProofData,
73-
withdraw::WithdrawProofData,
72+
transfer::TransferProofData, withdraw::WithdrawProofData,
7473
},
7574
spl_token_group_interface::state::TokenGroup,
7675
spl_token_metadata_interface::state::{Field, TokenMetadata},
@@ -256,7 +255,6 @@ async fn command_create_token(
256255
enable_group: bool,
257256
enable_member: bool,
258257
bulk_signers: Vec<Arc<dyn Signer>>,
259-
auditor_pubkey: ElGamalPubkeyOrNone,
260258
) -> CommandResult {
261259
println_display(
262260
config,
@@ -316,7 +314,7 @@ async fn command_create_token(
316314
extensions.push(ExtensionInitializationParams::ConfidentialTransferMint {
317315
authority: Some(authority),
318316
auto_approve_new_accounts: auto_approve,
319-
auditor_elgamal_pubkey: auditor_pubkey.into(),
317+
auditor_elgamal_pubkey: None,
320318
});
321319
if transfer_fee.is_some() {
322320
// Deriving ElGamal key from default signer. Custom ElGamal keys
@@ -3234,7 +3232,7 @@ enum ConfidentialInstructionType {
32343232
}
32353233

32363234
#[allow(clippy::too_many_arguments)]
3237-
async fn command_deposit_withdraw_mint_confidential_tokens(
3235+
async fn command_deposit_withdraw_confidential_tokens(
32383236
config: &Config<'_>,
32393237
token_pubkey: Pubkey,
32403238
owner: Pubkey,
@@ -3568,9 +3566,6 @@ pub async fn process_command<'a>(
35683566
.value_of("enable_confidential_transfers")
35693567
.map(|b| b == "auto");
35703568

3571-
let auditor_elgamal_pubkey =
3572-
elgamal_pubkey_or_none(arg_matches, "auditor_pubkey").unwrap();
3573-
35743569
command_create_token(
35753570
config,
35763571
decimals,
@@ -3593,7 +3588,6 @@ pub async fn process_command<'a>(
35933588
arg_matches.is_present("enable_group"),
35943589
arg_matches.is_present("enable_member"),
35953590
bulk_signers,
3596-
auditor_elgamal_pubkey,
35973591
)
35983592
.await
35993593
}
@@ -4583,7 +4577,7 @@ pub async fn process_command<'a>(
45834577
push_signer_with_dedup(owner_signer, &mut bulk_signers);
45844578
}
45854579

4586-
command_deposit_withdraw_mint_confidential_tokens(
4580+
command_deposit_withdraw_confidential_tokens(
45874581
config,
45884582
token,
45894583
owner,

token/cli/src/encryption_keypair.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
//! NOTE: this module should be remoeved in the next Solana upgrade.
44
55
use {
6-
base64::{prelude::BASE64_STANDARD, Engine}, clap::ArgMatches, solana_sdk::signer::EncodableKey, spl_token_2022::solana_zk_sdk::encryption::{
7-
auth_encryption::AeKey, elgamal::{ElGamalKeypair, ElGamalPubkey}, pod::elgamal::PodElGamalPubkey
8-
}
6+
base64::{prelude::BASE64_STANDARD, Engine},
7+
clap::ArgMatches,
8+
spl_token_2022::solana_zk_sdk::encryption::{
9+
elgamal::{ElGamalKeypair, ElGamalPubkey},
10+
pod::elgamal::PodElGamalPubkey,
11+
},
912
};
1013

1114
const ELGAMAL_PUBKEY_MAX_BASE64_LEN: usize = 44;
@@ -29,9 +32,6 @@ pub(crate) fn elgamal_pubkey_or_none(
2932
matches: &ArgMatches,
3033
name: &str,
3134
) -> Result<ElGamalPubkeyOrNone, String> {
32-
if !matches.is_present(name) {
33-
return Ok(ElGamalPubkeyOrNone::None);
34-
}
3535
let arg_str = matches.value_of(name).unwrap();
3636
if arg_str == "none" {
3737
return Ok(ElGamalPubkeyOrNone::None);
@@ -65,14 +65,6 @@ pub(crate) fn elgamal_keypair_of(
6565
ElGamalKeypair::read_json_file(path).map_err(|e| e.to_string())
6666
}
6767

68-
pub(crate) fn aes_key_of(
69-
matches: &ArgMatches,
70-
name: &str,
71-
) -> Result<AeKey, String> {
72-
let path = matches.value_of(name).unwrap();
73-
AeKey::read_from_file(path).map_err(|e| e.to_string())
74-
}
75-
7668
fn elgamal_pubkey_from_str(s: &str) -> Option<PodElGamalPubkey> {
7769
if s.len() > ELGAMAL_PUBKEY_MAX_BASE64_LEN {
7870
return None;

token/client/src/token.rs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use {
2929
},
3030
spl_record::state::RecordData,
3131
spl_token_2022::{
32-
error::TokenError as Token2022Error,
3332
extension::{
3433
confidential_transfer::{
3534
self,
@@ -38,7 +37,7 @@ use {
3837
WithdrawAccountInfo,
3938
},
4039
instruction::{ProofContextState, ZkProofData},
41-
ConfidentialTransferAccount, ConfidentialTransferMint, DecryptableBalance,
40+
ConfidentialTransferAccount, DecryptableBalance,
4241
},
4342
confidential_transfer_fee::{
4443
self, account_info::WithheldTokensInfo, ConfidentialTransferFeeAmount,
@@ -110,14 +109,8 @@ pub enum TokenError {
110109
MissingDecimals,
111110
#[error("decimals specified, but incorrect")]
112111
InvalidDecimals,
113-
#[error("TokenProgramError: {0}")]
114-
TokenProgramError(String),
115-
}
116-
impl From<Token2022Error> for TokenError {
117-
fn from(e: Token2022Error) -> Self {
118-
Self::TokenProgramError(e.to_string())
119-
}
120112
}
113+
121114
impl PartialEq for TokenError {
122115
fn eq(&self, other: &Self) -> bool {
123116
match (self, other) {
@@ -3435,26 +3428,6 @@ where
34353428
));
34363429
self.process_ixs(&instructions, signing_keypairs).await
34373430
}
3438-
3439-
pub async fn auditor_elgamal_pubkey(&self) -> TokenResult<Option<ElGamalPubkey>> {
3440-
Ok(Into::<Option<PodElGamalPubkey>>::into(
3441-
self.get_mint_info()
3442-
.await?
3443-
.get_extension::<ConfidentialTransferMint>()?
3444-
.auditor_elgamal_pubkey,
3445-
)
3446-
.map(|pk| TryInto::<ElGamalPubkey>::try_into(pk).unwrap()))
3447-
}
3448-
3449-
pub async fn account_elgamal_pubkey(&self, account: &Pubkey) -> TokenResult<ElGamalPubkey> {
3450-
TryInto::<ElGamalPubkey>::try_into(
3451-
self.get_account_info(account)
3452-
.await?
3453-
.get_extension::<ConfidentialTransferAccount>()?
3454-
.elgamal_pubkey,
3455-
)
3456-
.map_err(|_| TokenError::Program(ProgramError::InvalidAccountData))
3457-
}
34583431
}
34593432

34603433
/// Calculates the maximum chunk size for a zero-knowledge proof record

0 commit comments

Comments
 (0)