Skip to content

Commit

Permalink
validator-rewarder: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnfoo committed Dec 19, 2024
1 parent 32aa708 commit dd916e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
7 changes: 5 additions & 2 deletions nym-validator-rewarder/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use nym_config::{
DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILENAME, DEFAULT_DATA_DIR, NYM_DIR,
};
use nym_validator_client::nyxd::{AccountId, Coin};
use nyxd_scraper::PruningOptions;
use nyxd_scraper::{PruningOptions, StartingBlockOpts};
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use std::io;
Expand Down Expand Up @@ -129,7 +129,10 @@ impl Config {
database_path: self.storage_paths.nyxd_scraper.clone(),
pruning_options: self.nyxd_scraper.pruning,
store_precommits: self.nyxd_scraper.store_precommits,
start_block_height: None,
start_block: StartingBlockOpts {
start_block_height: None,
use_best_effort_start_height: true,
},
}
}

Expand Down
16 changes: 10 additions & 6 deletions nym-validator-rewarder/src/rewarder/block_signing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl EpochSigning {
trace!("attempting to get pre-commit for {address} at height {height}");
if let Some(precommit) = self
.nyxd_scraper
.storage
.storage()
.get_precommit(address, height)
.await?
{
Expand Down Expand Up @@ -102,15 +102,19 @@ impl EpochSigning {
current_epoch.end_rfc3339()
);

let validators = self.nyxd_scraper.storage.get_all_known_validators().await?;
let validators = self
.nyxd_scraper
.storage()
.get_all_known_validators()
.await?;
debug!("retrieved {} known validators", validators.len());

let epoch_start = current_epoch.start_time;
let epoch_end = current_epoch.end_time;

let Some(first_block) = self
.nyxd_scraper
.storage
.storage()
.get_first_block_height_after(epoch_start)
.await?
else {
Expand All @@ -121,7 +125,7 @@ impl EpochSigning {

let Some(last_block) = self
.nyxd_scraper
.storage
.storage()
.get_last_block_height_before(epoch_end)
.await?
else {
Expand Down Expand Up @@ -168,15 +172,15 @@ impl EpochSigning {

let signed = self
.nyxd_scraper
.storage
.storage()
.get_signed_between_times(&validator.consensus_address, epoch_start, epoch_end)
.await?;
signed_in_epoch.insert(validator, RawValidatorResult::new(signed, vp, whitelisted));
}

let total = self
.nyxd_scraper
.storage
.storage()
.get_blocks_between(epoch_start, epoch_end)
.await?;

Expand Down
4 changes: 2 additions & 2 deletions nym-validator-rewarder/src/rewarder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl Rewarder {
if let Some(epoch_signing) = &self.epoch_signing {
if epoch_signing
.nyxd_scraper
.storage
.storage()
.get_first_block_height_after(epoch_start)
.await?
.is_none()
Expand All @@ -451,7 +451,7 @@ impl Rewarder {

if epoch_signing
.nyxd_scraper
.storage
.storage()
.get_last_block_height_before(epoch_end)
.await?
.is_none()
Expand Down

0 comments on commit dd916e5

Please sign in to comment.