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

Add a configurable base fee #101

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading