Book: Update SPV section to reflect new account state query mechanism #5399
Book: Update SPV section to reflect new account state query mechanism #5399t-nelson merged 4 commits intosolana-labs:masterfrom
Conversation
| such as a credit of 0 Lamports. | ||
| An account's state (balance or other data) can be verified by submitting a | ||
| transaction with a ___TBD___ Instruction to the cluster. This instruction contains | ||
| the slot boundary of interest and the expected state hash at that boundary. The |
There was a problem hiding this comment.
We can’t enforce the slot boundary for this query. I think it’s basically is the query true when it’s executed by the cluster.
There was a problem hiding this comment.
Hrm. That's a pretty narrow window to hit on a high throughput account, basically the next slot and 🤞, right?
There was a problem hiding this comment.
to be able to do "slot of interest": would it be terribly expensive to hang onto the account hash vector at the end of every slot for 256 slots? worst case is 256*2.5*sizeof(Hash)*TPS, similar to StatusCache
There was a problem hiding this comment.
@t-nelson why would the slot boundary provide any safety? The state can change immediately on the next slot. It’s up to the contract to have some meaningful terminal state, like “game over”
There was a problem hiding this comment.
@rob-solana by "hash vector" you mean the "inclusion proof" or "merkle path"? They'd be log(N) and mergable per-slot, so that's certainly something to explore
@aeyakovenko there's no safety at the boundary. I was getting at the race between receiving the "Don't squash this slot" instruction and the slot being squashed, though after review Carl's snapshot work, I realize we have until the bank in question falls out of the locktower. This will require us scanning all bank forks and taking action on an unfinalized transaction, right?
There was a problem hiding this comment.
@t-nelson we can take action on it after that bank is rooted, and provide the result way later, maybe 1024 slots after or something long enough, or at an epoch boundary.
|
Cool! This is missing the checkpoint proof generation. |
|
Oof. I got to thinking about whether there was potential for a cheap resource exhaustion attack here and forgot to write it up 😆 |
|
@t-nelson so I think this would work on Ethereum. Since the BankHash's are connected, the SPV check on ethereum can skip PoH. @pgarg66 I think this would replace the "Ancestor Verification" section in: |
|
@t-nelson, what's this PR blocked by? |
7edb070 to
afd7dee
Compare
|
@aeyakovenko Sorry, this fell off my radar with the colo setup stuff. Last two commits address the issues I think. LMK what you think |
|
@rob-solana, since @aeyakovenko is travelling, would you mind giving this a once over to see if it jives with your understanding of the proposal? |
I think @sakridge has better information about the current plan. |
|
So we are considering making the accounts hash value as:
where |
|
440 bytes comes from this paper, avoiding xor collision with 0 (or thus any other given bit pattern): |
|
@sakridge OK thanks! Funny, I was actually typing up some clarifications that your second reply addressed 🙂 I get that it's cheaper to calculate and add/remove entries from this construction, but I don't see how we can build an inclusion proof? Or is that a tangential requirement? |
|
@t-nelson well, I was mainly after the performance side of it compared to what we are doing now or potentially computing a merkle tree of the accounts. @aeyakovenko had some idea that it would reduce the need to compute a merkle tree with old account states but I can't say I fully grok how that works yet. |
|
@sakridge Gotcha! I think you and I are on the same page. We'll have to await input from the big guy 🙃 |
oh man, this is gonna get messy... have a PR yet? |
|
@rob-solana #5573 this is the PR. Yea, it's not super clean, but not the worst. Not sure how it combines with what changes you are planning. |
| such as a credit of 0 Lamports. | ||
| A complication of this method is avoiding bank accounts squashing discarding | ||
| information required to verify blocks referenced by an inclusion proof. A solution | ||
| is to instead snapshot/checkpoint these banks by submitting a ___TBDb_Instruction___, |
There was a problem hiding this comment.
This is no longer necessary. The bank hash is derived from the snapshot image
There was a problem hiding this comment.
But we may want the bank hash to be the hash of the block transaction merkle root, hash of the snapshot image and the previous bank hash
There was a problem hiding this comment.
What about the accounts XOR? I think I missed some convo on that somewhere (didn't seem to be more in discord/#consensus, anyway). Do we not need inclusion proofs on the account state anymore?
Oh, and if you're on vacation, feel free to tell me to shove off 🙂
There was a problem hiding this comment.
we don’t have an account inclusion proof. So you still need a tx. Shove off :)
| with the Previous Bank-Merkle, and the Block-Merkle. | ||
| An account's state (balance or other data) can be verified by submitting a | ||
| transaction with a ___TBDa_Instruction___ to the cluster. The client can then use | ||
| a [Transaction Inclusion Proof](#transaction-inclusion-proof) to verify whether |
There was a problem hiding this comment.
Is the purpose of the account state verification to prove that an account has some expected state, at some given point in the past (some block)?
There was a problem hiding this comment.
ah ok, I see, the Accounts-Hash only includes accounts that were modified during a slot, which is why a transaction inclusion proof of the transaction that caused the modification is necessary. Thanks!
| or | ||
| * Transaction -> Entry-Merkle -> Block-Merkle -> Bank-Merkle | ||
|
|
||
| * Transaction -> Entry-Merkle -> Block-Merkle -> Bank-Hash |
There was a problem hiding this comment.
If we are generating the SPV of a transaction in a block A, for the vector of validator vote entries mentioned below, do we include all future votes for each validator up until MAX_LOCKOUT? If not, what is the locktower depth that we are interested in for confirmation?
There was a problem hiding this comment.
The confirmation depth should be configurable (with a safe min and default) and would be dependent on the economic value of the transaction. $10 TX, low confirmation, $10M TX, high confirmation.
Note that this is a little WIP ATM as typically an SPV client would be validating block headers on its own and not have to reveal this information to the full node providing the TX proof. On Solana, this would require them to be capable of keeping up with and validating PoH, which is an atypically high standard for such a client.
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
I haven't been following this one. Is there a subset of stuff you guys agree on that we can get merged? |
|
This needs updated for #5885. I'll try to sync it up today. |
|
@t-nelson, can you wrap this up? |
|
Can do |
afd7dee to
f5b4350
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
This stale pull request has been automatically closed. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
This stale pull request has been automatically closed. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
f5b4350 to
828dda3
Compare
828dda3 to
5a7523b
Compare
|
Can you format to 80 char lines? |
|
Absolutely |
|
@t-nelson, waiting on action from anyone here? |
As per Discord convo with @aeyakovenko and @rob-solana