-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: utxo to compressed account #544
Conversation
2b30c90
to
5f68101
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found some nits. not urgent but sharing for visibility regardless
}; | ||
}; | ||
}, | ||
{ | ||
name: 'outUtxos'; | ||
name: 'outputAccountHashes'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inconsistency w input equivalent,
outputAccountHashes
-> outputCompressedAccountHashes
type: { | ||
vec: 'u64'; | ||
}; | ||
name: 'indexMtAccount'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (consistency) elsewhere a similar value is used in outputStateMerkleTreeAccountIndices
f0f35b1
to
5f68101
Compare
pub tlv_data: TlvDataElement, | ||
} | ||
|
||
// TODO: parse utxos a more efficient way, since owner is sent multiple times this way | ||
#[derive(Debug)] | ||
#[account] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the struct InstructionDataTransfer is now used by the cpiSignatureAccount
, so tagging it as anchor account breaks the IDL.
instead, we can tag it as regular type with AnchorDeserialize,also allows us to not have to prepend 8 bytes when deserializing and can use ::deserialize instead of try_deserialize_unchecked()
@@ -243,19 +241,20 @@ pub struct TransferInstruction<'info> { | |||
pub self_program: Program<'info, crate::program::PspCompressedToken>, | |||
} | |||
|
|||
// TODO: parse utxos a more efficient way, since owner is sent multiple times this way | |||
// TODO: parse compressed_accounts a more efficient way, since owner is sent multiple times this way | |||
// This struct is equivalent to the InstructionDataTransfer, but uses the imported types from the psp_compressed_pda | |||
#[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize)] | |||
pub struct InstructionDataTransfer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we give this struct the same name as in compress-pda, we break the IDL.
(previously it just didn't break because compressed-pda was defining its InstructionDataTransfer struct as account not as type)
In my feature branch, I've temporarily renamed this to CompressedTokenInstructionDataTransfer in order to fix the IDL. there's probably a better name for it tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some more comments on what i found while working on #548 re: fixing IDL
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize)] | ||
pub struct TokenTransferOutUtxo { | ||
pub struct TokenTransferOutputData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TokenTransferOutputData
still has index_mt_account
so we're currently sending the same data to the chain twice. once as part of the TokenTransferOutputData
and once in the output_state_merkle_tree_account_indices
of the InstructionDataTransfer of compressed-token in line 487
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pub input_compressed_accounts: Vec<CompressedAccountWithMerkleContext>, | ||
pub output_compressed_accounts: Vec<CompressedAccount>, | ||
// index of Merkle tree account in remaining accounts | ||
pub output_state_merkle_tree_account_indices: Vec<u8>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for these to be fully useful in the mock-rpc (i.e. client/mock-rpc doesn't have to fetch additional data) we'd also have to emit the output_nullifier_queue_indices
and put them into the pubkey_array... but onchain doesn't have access to that data AFAIK since its only needed for spending accounts. instead of finding a workaround for this we should prolly make the PublicTransactionEvent smaller again, not emit the output_queues, and not emit any of the redundant info at all either and just implement a few additional steps in the test-rpc. cc @ananas-block
9fd61ce
to
d691e58
Compare
* fix: enabled group access control, added more tests * Update programs/compressed-pda/src/compressed_account.rs Co-authored-by: Swen Schäferjohann <[email protected]> * Update programs/account-compression/src/instructions/insert_into_indexed_array.rs Co-authored-by: Swen Schäferjohann <[email protected]> --------- Co-authored-by: Swen Schäferjohann <[email protected]>
* fix: enabled group access control, added more tests * feat: add address checks and insert logic * removed prints
0d00e28
to
8347826
Compare
2cb969c
to
fa66793
Compare
fa66793
to
03f10ad
Compare
pub index_merkle_tree_account: u8, | ||
pub index_nullifier_array_account: u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ananas-block should we just clean up the api now? i.e. merkle_tree_account_index
and nullifier_array_account_index
such that the naming is consistent with _index suffix in leaf_index.
(and more consistent with use of nullifier queue elsewhere would be to do
nullifier_queue_account_index
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
pub relay_fee: Option<u64>, | ||
pub de_compress_amount: Option<u64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ananas-block do we want to add the is_compress
: bool now?
Changes: