Skip to content
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

add bank hash to frozen slot update #3881

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

diman-io
Copy link

@diman-io diman-io commented Dec 3, 2024

Problem

There is no easy way to get bank hashes as fast as possible

Summary of Changes

Added bank hash for frozen slot update

Copy link

mergify bot commented Dec 3, 2024

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/web3.js (example)

Thank you for keeping the RPC clients in sync with the server API @diman-io.

buffalojoec
buffalojoec previously approved these changes Dec 4, 2024
Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

This lgtm. The bank is expected to be frozen at this point, so we know we'll get a valid hash from the hash() method.

@smcio
Copy link

smcio commented Dec 4, 2024

Cool, we (Overclock) need this as well for the mithril project. Since the current RPC interface does not expose bankhashes, we've been using our own getBankHash method that we hacked into a test validator, so we'd love to see these changes land sooner rather than later. Thanks for this PR @diman-io.

@diman-io diman-io requested a review from buffalojoec December 12, 2024 10:11
@diman-io
Copy link
Author

diman-io commented Dec 12, 2024

Just a kind reminder
I don’t have the merge button

@steviez
Copy link

steviez commented Dec 20, 2024

I'm only just glancing at this PR, but is this change safe to make ? Assuming this lands in v2.2, what if a client running v2.2 (expecting new field) is subscribed to an RPC node running v2.1 (not supplying new field)

@steviez
Copy link

steviez commented Jan 3, 2025

There is no easy way to get bank hashes as fast as possible

Hi @diman-io - I'm also curious what the use-case is for this; can you elaborate ? Ie, what do you need the bank hashes for ?

@buffalojoec
Copy link

I'm only just glancing at this PR, but is this change safe to make ? Assuming this lands in v2.2, what if a client running v2.2 (expecting new field) is subscribed to an RPC node running v2.1 (not supplying new field)

Yes you're right, a client subscribed to the wrong RPC API version would break. I figured clients should use an API version compatible with the server they're subscribed to, but we definitely shouldn't break the API on a minor bump.

I guess that leaves two options:

  • Make the field an Option and let serde handle it.
  • Add a new method and deprecate the old one.

Wdyt?

@diman-io
Copy link
Author

diman-io commented Jan 4, 2025

@steviez

what do you need the bank hashes for ?

for a validator sidecar to filter transactions (I use my own, but the same can be done on jito relayer / anza vortexor / etc )

@diman-io
Copy link
Author

diman-io commented Jan 4, 2025

Actually, I did some research after the initial question. However, I still haven’t come to any straightforward solution.

I would prefer the new method option with parameters. It provides scalability, and transaction statistics can be included there as well (not as an excluded option, which can be handled with the option option):

Frozen {
        slot: Slot,
        timestamp: u64,
        stats: SlotTransactionStats,
        hash: String,
    },

@steviez
Copy link

steviez commented Jan 6, 2025

for a validator sidecar to filter transactions (I use my own, but the same can be done on jito relayer / anza vortexor / etc )

How does the bank hash come into play for filtering transactions ?

  • For "user" transactions, a recent blockhash is included which is hashed into the bank hash, but not recoverable. So, I'm not seeing why bank hash is needed ?
  • For votes, votes include the bank hash so I guess having bank hashes would allow you to compare what you've computed against what incoming votes have ?

@smcio
Copy link

smcio commented Jan 7, 2025

There is no easy way to get bank hashes as fast as possible

Hi @diman-io - I'm also curious what the use-case is for this; can you elaborate ? Ie, what do you need the bank hashes for ?

I'd just like to add that we also need bank hashes for mithril, which is a project funded by a Solana Foundation grant, so we (Overclock) support the usefulness of these changes and/or any other RPC method that lets you retrieve bankhashes.

@steviez
Copy link

steviez commented Jan 7, 2025

I'd just like to add that we also need bank hashes for mithril

I have some ideas but can you confirm what your desired use-case / workflow is for wanting bank hashes ?

@diman-io
Copy link
Author

diman-io commented Jan 8, 2025

fixed while hanging my head in shame...

Of course, I meant the last blockhash. Now I’m extracting them from the sysvar

@steviez
Copy link

steviez commented Jan 8, 2025

fixed while hanging my head in shame...

Of course, I meant the last blockhash. Now I’m extracting them from the sysvar

No worries! And I guess you can't use blockSubscribe since it does not support processed which is roughly equivalent to getting an update for "bank frozen":
https://solana.com/docs/rpc/websocket/blocksubscribe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants