Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #101 from EspressoSystems/jb/configurable-fee
Browse files Browse the repository at this point in the history
Add a configurable base fee
  • Loading branch information
jbearer authored Apr 25, 2024
2 parents 2106381 + b1244fc commit 512603a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/builder_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ pub struct BuilderState<TYPES: NodeType> {

/// number of view to buffer before garbage collect
pub buffer_view_num_count: usize,

/// constant fee that the builder will offer per byte of data sequenced
base_fee: u64,
}

/// Trait to hold the helper functions for the builder
Expand Down Expand Up @@ -686,7 +689,7 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
}
let encoded_txns: Vec<u8> = payload.encode().unwrap().to_vec();
let block_size: u64 = encoded_txns.len() as u64;
let offered_fee: u64 = 0;
let offered_fee: u64 = self.base_fee * block_size;

// get the total nodes from the builder state.
// stored while processing the DA Proposal
Expand Down Expand Up @@ -949,6 +952,7 @@ impl<TYPES: NodeType> BuilderState<TYPES> {
num_nodes: NonZeroUsize,
bootstrap_view_number: TYPES::Time,
buffer_view_num_count: usize,
base_fee: u64,
) -> Self {
BuilderState {
timestamp_to_tx: BTreeMap::new(),
Expand All @@ -970,6 +974,7 @@ impl<TYPES: NodeType> BuilderState<TYPES> {
spawned_clones_views_list: Arc::new(RwLock::new(BTreeSet::new())),
last_bootstrap_garbage_collected_decided_seen_view_num: bootstrap_view_number,
buffer_view_num_count,
base_fee,
}
}
}
3 changes: 2 additions & 1 deletion src/testing/basic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ mod tests {
res_sender,
NonZeroUsize::new(TEST_NUM_NODES_IN_VID_COMPUTATION).unwrap(),
ViewNumber::new(0),
10,
10, // buffer view count
0, // base fee
);

//builder_state.event_loop().await;
Expand Down

0 comments on commit 512603a

Please sign in to comment.