Skip to content

runtime: new vote cache types [wip] #5968

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

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

ibhatt-jumptrading
Copy link
Contributor

No description provided.

};
typedef struct fd_vote_state_ele fd_vote_state_ele_t;

#define POOL_NAME fd_vote_state_pool
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in the header

#define POOL_NEXT next_
#include "../../util/tmpl/fd_pool.c"

#define MAP_NAME fd_vote_state_map
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in the header

#define MAP_NEXT next_
#include "../../util/tmpl/fd_map_chain.c"

struct fd_vote_states {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in header

vote states uses to manage the vote states. */

fd_vote_state_ele_t *
fd_vote_states_get_pool( fd_vote_states_t const * vote_states );
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in header?

fd_vote_states_get_pool( fd_vote_states_t const * vote_states ) {
FD_SCRATCH_ALLOC_INIT( l, vote_states );
FD_SCRATCH_ALLOC_APPEND( l, fd_vote_states_align(), sizeof(fd_vote_states_t) );
uchar * pool = FD_SCRATCH_ALLOC_APPEND( l, fd_vote_states_align(), fd_vote_states_footprint( vote_states->max_vote_accounts ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't do this, save pointer or offset when you new the structure

vote_states->magic = FD_VOTE_STATES_MAGIC;
vote_states->max_vote_accounts = max_vote_accounts;

if( FD_UNLIKELY( !fd_vote_state_pool_new( pool_mem, max_vote_accounts ) ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not like this, do

vote_states->pool = fd_vote_state_pool_join( fd_vote_state_pool_new( .. ) );
FD_TEST( vote_states->pool );

Base automatically changed from ibhatt/cleanup_rewards_calc to main August 8, 2025 15:18
#define MAP_KEY_T fd_pubkey_t
#define MAP_ELE_T fd_vote_state_ele_t
#define MAP_KEY vote_account
#define MAP_KEY_EQ(k0,k1) (!(memcmp( &(k0)->key,&(k1)->key,sizeof(fd_pubkey_t) )))
Copy link
Contributor

Choose a reason for hiding this comment

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

fd_pubkey_eq

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

Successfully merging this pull request may close these issues.

2 participants