Skip to content

SIMD-0109: Add a tipping mechanism to send SOL to the current leader#109

Closed
buffalu wants to merge 6 commits into
solana-foundation:mainfrom
buffalu:lb/simd_0108
Closed

SIMD-0109: Add a tipping mechanism to send SOL to the current leader#109
buffalu wants to merge 6 commits into
solana-foundation:mainfrom
buffalu:lb/simd_0108

Conversation

@buffalu
Copy link
Copy Markdown
Contributor

@buffalu buffalu commented Jan 18, 2024

Transactions prioritized out of band can't dynamically tip SOL to the leader in protocol.

This SIMD addresses that by setting some context on why this is helpful and solves it with the addition of a Native Program, the Tip Program.

@buffalu buffalu changed the title SIMD-0108: Add a built-in tipping mechanism where transactions can send SOL to the current leader SIMD-0109: Add a built-in tipping mechanism where transactions can send SOL to the current leader Jan 18, 2024
@aeyakovenko
Copy link
Copy Markdown

Why not any asset?

I think this can be accomplished by just formalizing a public key with a known private key that all the leaders can use to sweep arbitrary tips

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

Why not any asset?

I think this can be accomplished by just formalizing a public key with a known private key that all the leaders can use to sweep arbitrary tips

at first glance this would single threads the runtime.

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

Why not any asset?
I think this can be accomplished by just formalizing a public key with a known private key that all the leaders can use to sweep arbitrary tips

at first glance this would single threads the runtime.

it would be interesting to think if there's a way to do this with many tokens w/o single threading the runtime though... could you just do an on-chain swap + tip in SOL?

@t-nelson
Copy link
Copy Markdown
Contributor

yes it would either force serial execution or require on-demand accounts loading (which people think they want, but they don't). lamports are the only thing that we can unilaterally credit

@t-nelson
Copy link
Copy Markdown
Contributor

i don't think this actually needs any new program, just a syscall to credit the leader and a new system program instruction that wraps it for convenience (tx introspection, really). syscall accumulates lamports in the tx context. end of batch tx context accumulators are collated into an atomic in the bank. end of slot, pay out to leader collector address, same as tx fees.


if we really need the ability to specify a custom collector address, imo that's a separate simd and extends the vote account

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

end of slot, pay out to leader collector address, same as tx fees.

what are you imagining the leader collector address is w/o the custom collector address? the identity/authorized voter?

@t-nelson
Copy link
Copy Markdown
Contributor

what are you imagining the leader collector address is w/o the custom collector address? the identity/authorized voter?

active authorized voter, just like today (which is the identity if the operator is mildly competent)

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

what are you imagining the leader collector address is w/o the custom collector address? the identity/authorized voter?

active authorized voter, just like today (which is the identity if the operator is mildly competent)

ack on two SIMDs. that's fine with me. will look closer at your suggested method of using syscall but at first glance seems reasonable

@buffalu buffalu changed the title SIMD-0109: Add a built-in tipping mechanism where transactions can send SOL to the current leader SIMD-0109: Add a tipping mechanism to send SOL to the current leader Jan 19, 2024
@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

notes from discord i need to add:

alternatives considered:

@SOELTH
Copy link
Copy Markdown

SOELTH commented Jan 19, 2024

Thanks for the proposal good sir 🚀

Main two pain points for me are:

  • I don't think the validator should have a singular tip receiver. This forces sequential execution of otherwise independent txs and will undoubtedly cause a lot of write lock contention. We definitely want a way to allow searchers to tip the validator in parallel. I don't necessarily love the idea of creating a bunch of new accounts either. Allocating/loading unique accounts repeatedly is also expensive. I'll think about this problem more and follow up.

  • The rust syntax 💀

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Jan 19, 2024

Thanks for the proposal good sir 🚀

Main two pain points for me are:

  • I don't think the validator should have a singular tip receiver. This forces sequential execution of otherwise independent txs and will undoubtedly cause a lot of write lock contention. We definitely want a way to allow searchers to tip the validator in parallel. I don't necessarily love the idea of creating a bunch of new accounts either. Allocating/loading unique accounts repeatedly is also expensive. I'll think about this problem more and follow up.
  • The rust syntax 💀

agree on all the points above. hoping with this syscall and/or credit-only account that accumulates into AtomicU64 can help remove the sequential execution piece!

@SOELTH
Copy link
Copy Markdown

SOELTH commented Jan 19, 2024

Thanks for the proposal good sir 🚀
Main two pain points for me are:

  • I don't think the validator should have a singular tip receiver. This forces sequential execution of otherwise independent txs and will undoubtedly cause a lot of write lock contention. We definitely want a way to allow searchers to tip the validator in parallel. I don't necessarily love the idea of creating a bunch of new accounts either. Allocating/loading unique accounts repeatedly is also expensive. I'll think about this problem more and follow up.
  • The rust syntax 💀

agree on all the points above. hoping with this syscall and/or credit-only account that accumulates into AtomicU64 can help remove the sequential execution piece!

Can you elaborate on the idea of the AtomicU64? I don't even think this has to be strictly "atomic", perse. Since state is only hashed at the end of each block, I assume this is an account where a valid tx can declare an "add" or a "sub" to this account and the balances are totaled at the end of the block when state is hashed?

Follow up: I don't like the name "Atomic", but I agree that each individual executor thread can just track the balances and we can add them mux-style at the end of the block before state is hashed.

So from a protocol level we can give searchers/validators the ability to declare their intention to tip/withdraw SOL from the account by the end of the block in which it's included. Reads of the account could return total value from the previous block.

### Tip Program

I suggest a tip program as a Solana Native Program with the following
instructions and state. The TipConfigurationState can either be stored in a
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

either stored in votestate: where is the other location?


Without the epoch rollover constraint on the tip receiver,
validators would be able to sandwich transactions that contain large tips,
potentially stealing or misappropriating tips.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

could you provide a simple example?

@lheeger-jump
Copy link
Copy Markdown
Contributor

Why not add a new Sysvar which any lamports are sweeped to the leader?

@buffalu
Copy link
Copy Markdown
Contributor Author

buffalu commented Feb 5, 2024

Why not add a new Sysvar which any lamports are sweeped to the leader?

that works for me and is what @t-nelson suggested here.

for someone working on firedancer, does that seem like a reasonable approach to you? if so, will rewrite the proposal with that in mind!

@t-nelson
Copy link
Copy Markdown
Contributor

t-nelson commented May 21, 2024

superseded as per #109 (comment)

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants