-
Notifications
You must be signed in to change notification settings - Fork 124
Labels
kernelsRelated to transaction, batch, or block kernelsRelated to transaction, batch, or block kernelsrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code
Milestone
Description
Motviation
As a follow-up to the change in TransactionInputs where Account was replaced by PartialAccount, we should consider whether we could represent public new accounts in TxAccountUpdate as a delta rather than a full Account, as mentioned in #401 (comment). Currently, it is still represented as a full Account, but this means we need to convert a PartialAccount into a full Account during transaction proving (specifically in LocalTransactionProver::build_proven_transaction).
This results in two undesirable consequences:
- The
PartialAccountinTransactionInputsneeds to actually represent the full account state for new public accounts, otherwise the prover won't be able to build the correct full account state. Until we fix this situation, we cannot change the conversion fromAccountintoPartialAccountto only track the minimal account vault and storage map entries and so this prevents us from enabling lazy loading for assets and storage map items by default. - In order to correctly map a
PartialStorageMapback to aStorageMap, it needs to include the unhashed keys (see also feat: add entry map toPartialStorageMap#1878).
Changes
The primary change would be to AccountUpdateDetails which could be changed to look like this:
pub enum AccountUpdateDetails {
/// The Account is private (no on-chain state change).
Private,
/// The delta for public accounts.
Public(AccountDelta),
}To implement this, I think we need:
- Tracking
AccountCodechanges inAccountDelta, though a minimal solution could be to just haveOption<AccountCode>as a stop gap solution. The code would beSomefor new accounts andNonefor existing accounts. This will then be replaced by proper account code deltas once Support account code updates #1771 is finalized. - To update the transaction kernel to insert the storage and asset of an account into the in-kernel account delta.
- A way to convert an
AccountDeltainto a fullAccount, if it represents a new account. This could beFrom<AccountDelta> for AccountorTryFrom<AccountDelta> for Account, depending on whether we can and want to have a check to only allow this for new accounts. This would conceptually apply the delta to an "empty account" to get the new account's state. - Most likely some other things that I'm missing here. Before working on this issue we should investigate this some more.
Impact
- Account delta commitments become more meaningful for new accounts, since they'd actually include all "changes" to the account. If every transaction can be represented as an account delta, that should allow for more uniformity when handling
SigningInputs::TransactionSummary, for example. - A
TxAccountUpdatecontains the account delta commitment which can be used to check that the delta contained inAccountUpdateDetails::Deltamatches that commitment. However, we can't do that forAccountUpdateDetails::New. Removing New would allow validating the delta of a new account as well. - We can consider reverting feat: add entry map to
PartialStorageMap#1878, i.e. letPartialStorageMaponly track hashed keys.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kernelsRelated to transaction, batch, or block kernelsRelated to transaction, batch, or block kernelsrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code