-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement DAA score timestamp estimation (#268)
* Add GetDaaEstimateTimestamp RPC API Basic implementation, just return the value back. Commit is focused on adding the API rather than functionality. * Implement DAA score timestamp estimation Input = array of daa_scores Output = array of timestamps, index matched with input * Use info for daa TS estimate as opposed to println * Factor in BPS in the last header estimation * - use compact headers - acquire prune lock - use tighter indexing logic - ensure sink is included * eof new line * add todos * - bug fix: use f64, otherwise the fraction is always zero - avoid assuming that timestamps are strictly monotonic * renames * translate score -> miliisecs directly using target time per block * note * Add last data point from jupyter notebook It's the same daa_score as checkpoint genesis, but timestamp is different to improve accuracy for queries right before and right after this daa_score * use an array to avoid prealloc inaccuracies --------- Co-authored-by: Michael Sutton <[email protected]>
- Loading branch information
1 parent
f674ad5
commit f536fe7
Showing
22 changed files
with
298 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::sync::Arc; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::header::Header; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct DaaScoreTimestamp { | ||
pub daa_score: u64, | ||
pub timestamp: u64, | ||
} | ||
|
||
impl From<Header> for DaaScoreTimestamp { | ||
fn from(header: Header) -> DaaScoreTimestamp { | ||
DaaScoreTimestamp { daa_score: header.daa_score, timestamp: header.timestamp } | ||
} | ||
} | ||
|
||
impl From<Arc<Header>> for DaaScoreTimestamp { | ||
fn from(header: Arc<Header>) -> DaaScoreTimestamp { | ||
DaaScoreTimestamp { daa_score: header.daa_score, timestamp: header.timestamp } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.