-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
8917921
to
12ff865
Compare
@@ -0,0 +1,9 @@ | |||
use solana_lite_rpc_core::streams::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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| { |
There was a problem hiding this comment.
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()?
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 {}, {}, {}, {}", |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
- refuse to overwrite
- apply a merge with higher-status-wins logic
Refactoring out lite-rpc so that rpc services are independent and everything is streamed into rpc.