Skip to content

Commit

Permalink
add parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
modship committed Jan 6, 2025
1 parent 90a84b7 commit 37ac28a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
4 changes: 3 additions & 1 deletion massa-execution-worker/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2196,13 +2196,15 @@ impl ExecutionState {
addr: &Address,
prefix: &[u8],
) -> (Option<BTreeSet<Vec<u8>>>, Option<BTreeSet<Vec<u8>>>) {
// TODO

// here, get the final keys from the final ledger, and make a copy of it for the candidate list
// let final_keys = final_state.read().ledger.get_datastore_keys(addr);
let final_keys = self
.final_state
.read()
.get_ledger()
.get_datastore_keys(addr, prefix);
.get_datastore_keys(addr, prefix, None, None);

let mut candidate_keys = final_keys.clone();

Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/speculative_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl SpeculativeLedger {
.final_state
.read()
.get_ledger()
.get_datastore_keys(addr, prefix);
.get_datastore_keys(addr, prefix, None, None);

// here, traverse the history from oldest to newest with added_changes at the end, applying additions and deletions
let active_history = self.active_history.read();
Expand Down
8 changes: 7 additions & 1 deletion massa-ledger-exports/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ pub trait LedgerController: Send + Sync {
///
/// # Returns
/// A `BTreeSet` of the datastore keys
fn get_datastore_keys(&self, addr: &Address, prefix: &[u8]) -> Option<BTreeSet<Vec<u8>>>;
fn get_datastore_keys<'a>(
&self,
addr: &Address,
prefix: &[u8],
offset: Option<&'a [u8]>,
limit: Option<u32>,
) -> Option<BTreeSet<Vec<u8>>>;

/// Reset the ledger
///
Expand Down
11 changes: 9 additions & 2 deletions massa-ledger-worker/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ impl LedgerController for FinalLedger {
///
/// # Returns
/// A `BTreeSet` of the datastore keys
fn get_datastore_keys(&self, addr: &Address, prefix: &[u8]) -> Option<BTreeSet<Vec<u8>>> {
self.sorted_ledger.get_datastore_keys(addr, prefix)
fn get_datastore_keys(
&self,
addr: &Address,
prefix: &[u8],
offset: Option<&[u8]>,
limit: Option<u32>,
) -> Option<BTreeSet<Vec<u8>>> {
self.sorted_ledger
.get_datastore_keys(addr, prefix, offset, limit)
}

/// Reset the disk ledger.
Expand Down
9 changes: 8 additions & 1 deletion massa-ledger-worker/src/ledger_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,14 @@ impl LedgerDB {
///
/// # Returns
/// A `BTreeSet` of the datastore keys
pub fn get_datastore_keys(&self, addr: &Address, prefix: &[u8]) -> Option<BTreeSet<Vec<u8>>> {
pub fn get_datastore_keys(
&self,
addr: &Address,
prefix: &[u8],
offset: Option<&[u8]>,
limit: Option<u32>,
) -> Option<BTreeSet<Vec<u8>>> {
// TODO
let db = self.db.read();

// check if address exists, return None if it does not
Expand Down

0 comments on commit 37ac28a

Please sign in to comment.