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

Gmg/refactor gyser rpc #174

Merged
merged 7 commits into from
Sep 1, 2023
Merged

Gmg/refactor gyser rpc #174

merged 7 commits into from
Sep 1, 2023

Conversation

godmodegalactus
Copy link
Collaborator

Refactoring out lite-rpc so that rpc services are independent and everything is streamed into rpc.

@godmodegalactus godmodegalactus merged commit 1a3322c into main Sep 1, 2023
@@ -0,0 +1,9 @@
use solana_lite_rpc_core::streams::{
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wha typo?

fn process_block(
block: SubscribeUpdateBlock,
commitment_config: CommitmentConfig,
) -> ProcessedBlock {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is ProcessedBlock correct term in the sense that it's refering to the commitment status processed. the method is producing blocks for other status too - right?

}
};
}
bail!("gyser slot stream ended");
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo

let signature = signatures[0];
let compute_units_consumed = meta.compute_units_consumed;

let message = VersionedMessage::V0(v0::Message {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you explain why we do not need to handle "Legacy"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here we create a new message from the data we get from gyser, This is also compatible with legacy transactions.

.collect(),
});

let legacy_compute_budget = message.instructions().iter().find_map(|i| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

.find (first) is IMO an anti-pattern: in case there is more than one match it picks the first (random) one. rather it should fail to point out the ambiguity

suggest to use this instead:
.at_most_one()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this case is handled by the cluster itself. If there is more than one Request Units instruction cluster will not process the transaction. If the transaction is in block we need to p[process it in any case. Having more than one request units instruction is not a real blocker.

}
let schedule = self.leader_schedule.read().await;

let schedule = if schedule.is_empty()
Copy link
Collaborator

Choose a reason for hiding this comment

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

that logic I would have not expected here. could you comment why this repair/rebuild is necessary. it should go into a ".repair_if_necessary" method IMO

} else {
schedule
};
let ls = schedule
Copy link
Collaborator

Choose a reason for hiding this comment

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

ls -> should be renamed

};
let ls = schedule
.iter()
.filter(|x| x.leader_slot >= from && x.leader_slot <= to)
Copy link
Collaborator

Choose a reason for hiding this comment

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

dumb question, but is it guaranteed that ls cover the complete range of slots?

};

log::info!(
"Idenity stakes {}, {}, {}, {}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo


for tx in block.txs {
//
data_cache.txs.update_status(
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't want to annoy but block sources might disagree about the status of its transactions: one validator might report confirmed where another one reports processed. iff that's the case the .update_status method should either

  1. refuse to overwrite
  2. apply a merge with higher-status-wins logic

@godmodegalactus godmodegalactus deleted the gmg/refactor_gyser_rpc branch January 25, 2024 15:18
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.

3 participants