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

Store versioned transactions in the ledger, disabled by default #19139

Merged
merged 12 commits into from
Aug 17, 2021

Conversation

jstarry
Copy link
Contributor

@jstarry jstarry commented Aug 10, 2021

Problem

Ledger cannot store versioned transactions

Summary of Changes

Most of the following changes are groundwork needed for enabling the processing of the new versioned transactions and aren't too interesting:

  • Added a feature switch for enabling versioned transaction processing
  • Added support for recording versioned transactions in ledger entries, but fail verification if any new versioned transactions are detected for now.
  • Added groundwork for mapping the addresses of new versioned transactions, but these transactions will fail for now since the address map cache is not implemented yet.
  • Expanded the use of SanitizedTransaction and SanitizedMessage over the legacy versions since these new structs will wrap both legacy and versioned transactions and messages, respectively.

The most significant changes in this PR are in solana-sdk and involve:

  • New MappedMessage struct which wraps the new v0 message along with a list of its mapped messages. This struct provides methods to retrieve the full list of message accounts (including the accounts loaded by mapped addresses).
  • New SanitizedMessage struct which wraps the legacy Message and the new MappedMessage and adopts a large portion of the legacy Message for compatibility across the runtime.
  • Added methods to VersionedMessage which mirror some of the legacy Message methods used for verification and hashing before the message is sanitized.
  • Much improved SanitizedTransaction struct which has now replaced the majority of the usages of legacy Transaction across the runtime.
  • New simple VersionedTransaction struct which is what is now serialized into each ledger Entry instead of legacy transactions. It has a small API since it has limited usage before the runtime converts it into a SanitizedTransaction

Feature Gate Issue: #24047

@jstarry jstarry changed the title Add support for versioned transactions, but disable by default Store versioned transactions in the ledger, disabled by default Aug 10, 2021
@jstarry jstarry force-pushed the versioned-tx branch 3 times, most recently from ed19033 to 4c035f9 Compare August 11, 2021 16:18
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got through all of the sdk/* stuff with this pass. Looking great so far! If you want to go ahead and push your outstanding conflict resolution changes, I'll take a crack at the plumbing on Monday

@jstarry jstarry force-pushed the versioned-tx branch 2 times, most recently from 3d0daec to 1ee709f Compare August 16, 2021 23:21
t-nelson
t-nelson previously approved these changes Aug 17, 2021
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this round I reviewed the new commits and skimmed the plumbing. Looks great! Thanks for addressing the first round.

r+ conflict resolution

@mergify mergify bot dismissed t-nelson’s stale review August 17, 2021 16:02

Pull request has been modified.

Comment on lines +54 to +57
let sanitized_msg = Self::Legacy(message);
if sanitized_msg.has_duplicates() {
return Err(SanitizeMessageError::DuplicateAccountKey);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi @t-nelson I just added this forgotten dupe check which is currently inconsequential but could have caused issues later

@jstarry jstarry merged commit c50b01c into solana-labs:master Aug 17, 2021
@jstarry jstarry deleted the versioned-tx branch August 17, 2021 22:17
@jstarry jstarry added the feature-gate Pull Request adds or modifies a runtime feature gate label Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-gate Pull Request adds or modifies a runtime feature gate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants