geyser: fix overflow for small slot number (#171)
This commit is contained in:
parent
f2cfba9073
commit
1481ec9ac3
|
@ -14,6 +14,8 @@ The minor version will be incremented upon a breaking change and the patch versi
|
|||
|
||||
### Fixes
|
||||
|
||||
geyser: fix overflow for small slot number ([#171](https://github.com/rpcpool/yellowstone-grpc/pull/171)).
|
||||
|
||||
### Breaking
|
||||
|
||||
## 2023-08-10
|
||||
|
|
|
@ -1874,15 +1874,6 @@ version = "0.8.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.2.1"
|
||||
|
@ -3467,20 +3458,6 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.29.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9557d0845b86eea8182f7b10dff120214fb6cd9fd937b6f4917714e546a38695"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"ntapi",
|
||||
"once_cell",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.6.0"
|
||||
|
@ -3929,7 +3906,6 @@ dependencies = [
|
|||
"anyhow",
|
||||
"rustc_version",
|
||||
"rustversion",
|
||||
"sysinfo",
|
||||
"time 0.3.22",
|
||||
]
|
||||
|
||||
|
|
|
@ -40,4 +40,4 @@ yellowstone-grpc-proto = { path = "../yellowstone-grpc-proto" }
|
|||
anyhow = "1.0.62"
|
||||
cargo-lock = "9.0.0"
|
||||
git-version = "0.3.5"
|
||||
vergen = { version = "8.2.1", features = ["build", "cargo", "git", "gitcl", "rustc", "si"] }
|
||||
vergen = { version = "8.2.1", features = ["build", "rustc"] }
|
||||
|
|
|
@ -2,11 +2,7 @@ use {cargo_lock::Lockfile, std::collections::HashSet};
|
|||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let mut envs = vergen::EmitBuilder::builder();
|
||||
envs.all_build()
|
||||
.all_cargo()
|
||||
.all_git()
|
||||
.all_rustc()
|
||||
.all_sysinfo();
|
||||
envs.all_build().all_rustc();
|
||||
envs.emit()?;
|
||||
|
||||
// vergen git version does not looks cool
|
||||
|
|
|
@ -509,13 +509,17 @@ impl BlockMetaStorage {
|
|||
}
|
||||
|
||||
if msg.status == CommitmentLevel::Finalized {
|
||||
let keep_slot = msg.slot - KEEP_SLOTS;
|
||||
storage.blocks.retain(|slot, _block| *slot >= keep_slot);
|
||||
if let Some(keep_slot) = msg.slot.checked_sub(KEEP_SLOTS) {
|
||||
storage.blocks.retain(|slot, _block| *slot >= keep_slot);
|
||||
}
|
||||
|
||||
let keep_slot = msg.slot - MAX_RECENT_BLOCKHASHES as u64 - 32;
|
||||
storage
|
||||
.blockhashes
|
||||
.retain(|_blockhash, status| status.slot >= keep_slot);
|
||||
if let Some(keep_slot) =
|
||||
msg.slot.checked_sub(MAX_RECENT_BLOCKHASHES as u64 + 32)
|
||||
{
|
||||
storage
|
||||
.blockhashes
|
||||
.retain(|_blockhash, status| status.slot >= keep_slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::BlockMeta(msg) => {
|
||||
|
@ -775,10 +779,10 @@ impl GrpcService {
|
|||
match block_fail_action {
|
||||
ConfigBlockFailAction::Log => {
|
||||
INVALID_FULL_BLOCKS.inc();
|
||||
error!("unexpected message order for slot {}", $message.get_slot());
|
||||
error!("unexpected message ({}) order for slot {}", $message.kind(), $message.get_slot());
|
||||
}
|
||||
ConfigBlockFailAction::Panic => {
|
||||
panic!("unexpected message order for slot {}", $message.get_slot());
|
||||
panic!("unexpected message ({}) order for slot {}", $message.kind(), $message.get_slot());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue