Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Confidential mint-burn extension #6881

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8fbb0fb
confidential mint-burn extension
abcalphabet Jun 19, 2024
de3d227
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Jul 1, 2024
32d528e
add ciphertext validity proof to confidential mint
abcalphabet Jul 1, 2024
3a9318d
simplify burn proofs
abcalphabet Jul 2, 2024
fee8acb
add confidential supply
abcalphabet Jul 5, 2024
5bbafec
remove debug statements
abcalphabet Jul 5, 2024
d6724a0
add tests for confidential mint-burn
abcalphabet Jul 5, 2024
0ec8537
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Jul 10, 2024
5939b72
fix clippy & serde tests
abcalphabet Jul 11, 2024
d4ad146
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Sep 4, 2024
8479bad
fix some tests
abcalphabet Sep 4, 2024
96d8f92
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Sep 4, 2024
0b20da3
clippy
abcalphabet Sep 4, 2024
48fcb02
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Sep 25, 2024
18aa58d
mint burn with new proof generation
abcalphabet Oct 1, 2024
59234ba
remove old mintburn proof generation
abcalphabet Oct 1, 2024
89c7cd2
cleanup
abcalphabet Oct 1, 2024
ddd02d5
more cleanup
abcalphabet Oct 1, 2024
9eb6147
rustfmt
abcalphabet Oct 1, 2024
c21c723
fix clippy; serde logic
abcalphabet Oct 2, 2024
86f734d
Update token/program-2022/src/extension/confidential_mint_burn/mod.rs
abcalphabet Oct 4, 2024
abfc681
Update token/program-2022/src/extension/confidential_mint_burn/instru…
abcalphabet Oct 4, 2024
8714445
review fixes
abcalphabet Oct 4, 2024
a7fadee
refactor proof location processing
abcalphabet Oct 4, 2024
c00ad20
comment
abcalphabet Oct 4, 2024
042d5fc
fix tests after ProofLocation changes
abcalphabet Oct 4, 2024
ab15bfc
fix target_os=solana ; test-sbf
abcalphabet Oct 5, 2024
fbed7b4
gate mint burn test to test-sbf
abcalphabet Oct 5, 2024
764afbb
review fixes
abcalphabet Oct 7, 2024
f208e36
fix fmt / serde
abcalphabet Oct 8, 2024
a4e9ece
construct supply account info from ref to extension
abcalphabet Oct 8, 2024
ea9d69f
use new logic
abcalphabet Oct 8, 2024
2346506
add conf mint/burn failure docs; remove todo
abcalphabet Oct 9, 2024
3c6014d
remove obsolete null check
abcalphabet Oct 9, 2024
91d49a9
Update token/program-2022/src/error.rs
abcalphabet Oct 24, 2024
06550b3
Update token/program-2022/src/extension/confidential_mint_burn/instru…
abcalphabet Oct 24, 2024
ccdf363
Update token/program-2022/src/extension/confidential_mint_burn/accoun…
abcalphabet Oct 24, 2024
a7f1259
review fixes
abcalphabet Oct 24, 2024
0d17b1e
more fixes
abcalphabet Oct 28, 2024
5cad122
clippy; review fixes
abcalphabet Oct 29, 2024
ac1d380
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Oct 31, 2024
2f3a6bb
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Dec 9, 2024
0c003dc
Merge branch 'master' into confidential_mint_burn_ext
abcalphabet Dec 9, 2024
fd29474
fix tests
abcalphabet Dec 9, 2024
6ddba8e
remove debug statements
abcalphabet Dec 10, 2024
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
256 changes: 256 additions & 0 deletions token/cli/src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ pub enum CommandName {
ApplyPendingBalance,
UpdateGroupAddress,
UpdateMemberAddress,
MintConfidentialTokens,
BurnConfidentialTokens,
ConfidentialBalance,
ConfidentialSupply,
RotateSupplyElgamal,
}
impl fmt::Display for CommandName {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -890,6 +895,42 @@ pub fn app<'a>(
.takes_value(false)
.help("Enables group member configurations in the mint. The mint authority must initialize the member."),
)
.arg(
Arg::with_name("enable_confidential_mint_burn")
.long("enable-confidential-mint-burn")
.takes_value(false)
.help(
"Enables minting of new tokens into confidential balance and burning of tokens directly from the confidential balance"
),
)
.arg(
Arg::with_name("auditor_pubkey")
.long("auditor-pubkey")
.value_name("AUDITOR_PUBKEY")
.takes_value(true)
.help(
"The auditor encryption public key for mints with the confidential \
transfer extension enabled. The corresponding private key for \
this auditor public key can be used to decrypt all confidential \
transfers involving tokens from this mint. Currently, the auditor \
public key can only be specified as a direct *base64* encoding of \
an ElGamal public key. More methods of specifying the auditor public \
key will be supported in a future version. To disable auditability \
feature for the token, use \"none\"."
)
)
.arg(
Arg::with_name("confidential_supply_pubkey")
.long("confidential-supply-pubkey")
.value_name("CONFIDENTIAL_SUPPLY_PUBKEY")
.takes_value(true)
.help(
"The confidential supply encryption public key for mints with the \
confidential transfer and confidential mint-burn extension enabled. \
The corresponding private key for this supply public key can be \
used to decrypt the confidential supply of the token."
)
)
.arg(multisig_signer_arg())
.nonce_args(true)
.arg(memo_arg())
Expand Down Expand Up @@ -2688,4 +2729,219 @@ pub fn app<'a>(
.arg(multisig_signer_arg())
.nonce_args(true)
)
.subcommand(
SubCommand::with_name(CommandName::MintConfidentialTokens.into())
.about("Mint tokens amounts for into confidential balance")
.arg(
Arg::with_name("token")
.long("token")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("The token address with confidential transfers enabled"),
)
.arg(
Arg::with_name("amount")
.value_parser(Amount::parse)
.value_name("TOKEN_AMOUNT")
.takes_value(true)
.index(2)
.required(true)
.help("Amount to deposit; accepts keyword ALL"),
)
.arg(
Arg::with_name("address")
.long("address")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_ACCOUNT_ADDRESS")
.takes_value(true)
.help("The address of the token account to configure confidential transfers for \
[default: owner's associated token account]")
)
.arg(
owner_address_arg()
)
.arg(multisig_signer_arg())
.arg(mint_decimals_arg())
.nonce_args(true)
)
.subcommand(
SubCommand::with_name(CommandName::BurnConfidentialTokens.into())
.about("Burn tokens from available confidential balance")
.arg(
Arg::with_name("token")
.long("token")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("The token address with confidential transfers enabled"),
)
.arg(
Arg::with_name("amount")
.value_parser(Amount::parse)
.value_name("TOKEN_AMOUNT")
.takes_value(true)
.index(2)
.required(true)
.help("Amount to deposit; accepts keyword ALL"),
)
.arg(
Arg::with_name("address")
.long("address")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_ACCOUNT_ADDRESS")
.takes_value(true)
.help("The address of the token account to configure confidential transfers for \
[default: owner's associated token account]")
)
.arg(
owner_address_arg()
)
.arg(multisig_signer_arg())
.arg(mint_decimals_arg())
.nonce_args(true)
)
.subcommand(
SubCommand::with_name(CommandName::ConfidentialBalance.into())
.about("Display confidential balance")
.arg(
Arg::with_name("token")
.long("token")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("The token address with confidential transfers enabled"),
)
.arg(
Arg::with_name("address")
.long("address")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_ACCOUNT_ADDRESS")
.takes_value(true)
.index(2)
.help("The address of the token account to for which to fetch the confidential balance")
)
.arg(
Arg::with_name("authority")
.long("authority")
.alias("owner")
.validator(|s| is_valid_signer(s))
.value_name("SIGNER")
.takes_value(true)
.help("Keypair from which encryption keys for token account were derived.")
)
.arg(
owner_address_arg()
)
.arg(multisig_signer_arg())
.arg(mint_decimals_arg())
.nonce_args(true)
)
.subcommand(
SubCommand::with_name(CommandName::ConfidentialSupply.into())
.about("Display supply of confidential token")
.arg(
Arg::with_name("token")
.long("token")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("The token address with confidential transfers enabled"),
)
.arg(
Arg::with_name("authority")
.long("authority")
.alias("owner")
.validator(|s| is_valid_signer(s))
.value_name("SIGNER")
.takes_value(true)
.help("Keypair from which the supply elgamal keypair is derived. \
Either the authority or the confidential-supply-keypair have \
to be specified in order for the supply to be decrypted.")
)
.arg(
Arg::with_name("confidential_supply_keypair")
.long("confidential-supply-keypair")
.value_name("CONFIDENTIAL_SUPPLY_KEYPAIR")
.takes_value(true)
.help(
"The confidential supply encryption keypair used to decrypt ElGamalCiphertext supply. \
Either the authority or the confidential-supply-keypair have \
to be specified in order for the supply to be decrypted."
)
)
.arg(
Arg::with_name("confidential_supply_aes_key")
.long("confidential-supply-aes-key")
.value_name("CONFIDENTIAL_SUPPLY_AES_KEY")
.takes_value(true)
.help(
"The aes key used to decrypt the decryptable portion of the confidential supply."
)
)
.nonce_args(true)
)
.subcommand(
SubCommand::with_name(CommandName::RotateSupplyElgamal.into())
.about("Display supply of confidential token")
.arg(
Arg::with_name("token")
.long("token")
.validator(|s| is_valid_pubkey(s))
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("The token address with confidential transfers enabled"),
)
.arg(
Arg::with_name("authority")
.long("authority")
.alias("owner")
.validator(|s| is_valid_signer(s))
.value_name("SIGNER")
.takes_value(true)
.required(true)
.help("Keypair holding the authority over the confidential-mint-burn extension.")
)
.arg(
Arg::with_name("current_supply_keypair")
.long("current-supply-keypair")
.value_name("CURRENT_SUPPLY_KEYPAIR")
.takes_value(true)
.required(true)
.help(
"The current confidential supply encryption keypair."
)
)
.arg(
Arg::with_name("supply_aes_key")
.long("supply-aes-key")
.value_name("SUPPLY_AES_KEY")
.takes_value(true)
.required(true)
.help(
"The aes key to decrypt the decryptable confidential supply."
)
)
.arg(
Arg::with_name("new_supply_keypair")
.long("new-supply-keypair")
.value_name("NEW_SUPPLY_KEYPAIR")
.takes_value(true)
.required(true)
.help(
"The new confidential supply encryption keypair to rotate to."
)
)
.nonce_args(true)
)
}
Loading
Loading