This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: TransactionMessage.decompile() now counts the correct number of unsigned, writable accounts #28990
Merged
steveluscher
merged 2 commits into
solana-labs:master
from
steveluscher:repair-deserialization-versioned-transactions
Nov 30, 2022
Merged
fix: TransactionMessage.decompile() now counts the correct number of unsigned, writable accounts #28990
steveluscher
merged 2 commits into
solana-labs:master
from
steveluscher:repair-deserialization-versioned-transactions
Nov 30, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #28990 +/- ##
=========================================
- Coverage 77.1% 76.7% -0.5%
=========================================
Files 55 55
Lines 2934 3084 +150
Branches 408 454 +46
=========================================
+ Hits 2264 2367 +103
- Misses 529 559 +30
- Partials 141 158 +17 |
…r of writable unsigned accounts
steveluscher
commented
Nov 30, 2022
@@ -49,7 +49,9 @@ export class TransactionMessage { | |||
assert(numWritableSignedAccounts > 0, 'Message header is invalid'); | |||
|
|||
const numWritableUnsignedAccounts = | |||
message.staticAccountKeys.length - numReadonlyUnsignedAccounts; | |||
message.staticAccountKeys.length - | |||
numRequiredSignatures - |
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.
Without this change, the test in this commit incorrectly marks the last account as writable.
jstarry
approved these changes
Nov 30, 2022
steveluscher
deleted the
repair-deserialization-versioned-transactions
branch
November 30, 2022 17:57
Got the idea to double check the Rust code, and found it to already be correct. solana/sdk/program/src/message/versions/v0/mod.rs Lines 284 to 286 in 98525dd
|
gnapoli23
pushed a commit
to gnapoli23/solana
that referenced
this pull request
Dec 16, 2022
…unsigned, writable accounts (solana-labs#28990) * Test that `TransactionMessage.decompile()` can decompile a legacy `Message` * `TransactionMessage.decompile()` now correctly accounts for the number of writable unsigned accounts
This was referenced Dec 23, 2022
This was referenced Dec 28, 2022
nickfrosty
pushed a commit
to nickfrosty/solana
that referenced
this pull request
Jan 4, 2023
…unsigned, writable accounts (solana-labs#28990) * Test that `TransactionMessage.decompile()` can decompile a legacy `Message` * `TransactionMessage.decompile()` now correctly accounts for the number of writable unsigned accounts
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Message headers give you the following:
numRequiredSignatures
)numReadonlySignedAccounts
)numReadonlyUnsignedAccounts
)If we want to know how many writable unsigned accounts there are, we have to:
numRequiredSignatures
)numReadonlyUnsignedAccounts
)That spells:
Unfortunately, we forgot to subtract out the number of signers, making it possible to overcount
numWritableUnsignedAccounts
. This played havoc when deserializing messages like the one in #28900's repro.All of this could result in accounts being needlessly marked as writeable, which could only serve to make the network slower (ie. causing the validator to run transactions in serial that could otherwise have been safely run in parallel).
Summary of Changes
numWritableUnsignedAccounts
TransactionMessage
Fixes #28900.