Skip to content
Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
74f4ac6
shelf stacking disabled. pass existing tests
cyberphysic4l Mar 3, 2025
da35bfe
test_compute_tx_start_at_cost for shelf-stacking
cyberphysic4l Mar 4, 2025
066f197
extend all unit tests to cover shelf stacking
cyberphysic4l Mar 4, 2025
da17bdf
activate new sequencer in protocol config
cyberphysic4l Mar 4, 2025
2f3643f
update congestion control tests to use new sequencer
cyberphysic4l Mar 4, 2025
b537fd1
improve commenting and renaming
cyberphysic4l Mar 6, 2025
bb1e1ef
Review suggestions from Can
cyberphysic4l Mar 11, 2025
437c724
debug message for cancelled transaction with no congested object
cyberphysic4l Mar 12, 2025
500ed29
only enable feature on devnet
cyberphysic4l Mar 13, 2025
6970015
clippy lints
cyberphysic4l Mar 14, 2025
3aab8e8
Add description for new parameter in certificate results
cuileri Mar 17, 2025
3342a74
refactor: define ExecutionTime and rename start/end cost to start/end…
roman1e2f5p8s Apr 9, 2025
1ecc07b
refactor: reanme and improve ExecutionSlot methods
roman1e2f5p8s Apr 9, 2025
879bc4f
refactor: introduce StartTime type alias and restructure sequencing/c…
roman1e2f5p8s Apr 9, 2025
3d42b6d
test: add basic ExecutionSlot tests
roman1e2f5p8s Apr 10, 2025
03f874b
chore: rename min_free_execution_slot to assign_min_free_execution_slot
roman1e2f5p8s Apr 10, 2025
0847891
refactor: define MAX_EXECUTION_TIME const and remove StartTime
roman1e2f5p8s Apr 10, 2025
2073bf5
chore: add max_duration_non_scheduled_slot function
roman1e2f5p8s Apr 10, 2025
f67fb3d
return all shared objects for deferred transactions
cyberphysic4l Apr 14, 2025
1455bd8
rename ConsensusCertificateResult::IotaTransaction
cyberphysic4l Apr 14, 2025
d0c20af
remove references to "cost" where possible
cyberphysic4l Apr 14, 2025
6962dc9
re-add assertion that congested objects must not be empty
cyberphysic4l Apr 14, 2025
8d2a4e7
generate protocol config snapshots
cyberphysic4l Apr 16, 2025
70bf00f
fix: fmt
cyberphysic4l Apr 16, 2025
6878ac0
update object cost tests
cyberphysic4l Apr 17, 2025
94742cb
update authority and congestion control tests
cyberphysic4l Apr 17, 2025
e6fb170
update openrpc spec
cyberphysic4l Apr 17, 2025
71475e1
feat: add compute_suggested_gas_price placeholder
roman1e2f5p8s Apr 17, 2025
943cbb2
update protocol version history comment
cyberphysic4l Apr 17, 2025
e004435
fix typo
cyberphysic4l Apr 22, 2025
e9c53a1
Merge branch 'develop' into protocol-research/sequencer2
cyberphysic4l Apr 22, 2025
c1d1ee8
Merge branch 'protocol-research/sequencer2' into protocol-research/fe…
roman1e2f5p8s Apr 28, 2025
3e87c81
use proper struct names in comments
cyberphysic4l Apr 28, 2025
2d5e44a
chore: add temporary test for debugging
roman1e2f5p8s Apr 28, 2025
ee423b9
round of reviews
cyberphysic4l Apr 30, 2025
73a6c92
fix some tests
cyberphysic4l Apr 30, 2025
b17cd5e
Merge branch 'develop' into protocol-research/sequencer2
cyberphysic4l Apr 30, 2025
0912d4f
chore: improve temporary my_test
roman1e2f5p8s May 1, 2025
6d91e89
fix some tests
cyberphysic4l May 1, 2025
9278c50
clippy lints
cyberphysic4l May 1, 2025
70d330e
require execution slots to have strictly positive duration
cyberphysic4l May 1, 2025
ec2c342
fix typo
cyberphysic4l May 1, 2025
995e83c
clippy lint
cyberphysic4l May 1, 2025
5c0fb09
Merge branch 'protocol-research/sequencer2' into protocol-research/fe…
roman1e2f5p8s May 2, 2025
091d48f
chore: update temporary test
roman1e2f5p8s May 2, 2025
5952193
fix binary search
cyberphysic4l May 2, 2025
aacbe57
Merge branch 'protocol-research/sequencer2' into protocol-research/fe…
roman1e2f5p8s May 2, 2025
3895df0
modify contains() tests according to changes
cyberphysic4l May 2, 2025
b255e28
remove unnecessary collects and comment
cyberphysic4l May 2, 2025
51728ce
Merge branch 'protocol-research/sequencer2' into protocol-research/fe…
roman1e2f5p8s May 5, 2025
ec38817
feat: calculate suggetsed gas price as lowest executed + 1
roman1e2f5p8s May 5, 2025
706560b
chore: add gas price to build_transaction test function, minor renamings
roman1e2f5p8s May 6, 2025
473ca5f
chore: improve test_compute_suggested_gas_price
roman1e2f5p8s May 6, 2025
2fe8870
chore: add test_congested_objects_version_assignments
roman1e2f5p8s May 6, 2025
b7b8d1e
Merge branch 'develop' into protocol-research/feat/calculate-suggeste…
roman1e2f5p8s May 21, 2025
c353343
chore: fix rust fmt
roman1e2f5p8s May 21, 2025
882f28c
feat: bootstrap ring-buffer-based suggested gas price calculator
roman1e2f5p8s May 22, 2025
00bf5e0
feat: improve calculator, remove stuff from the tracker
roman1e2f5p8s May 26, 2025
e752863
fix: remove the calculator from authority
roman1e2f5p8s May 26, 2025
baf7e43
refactor: remove the calculator, add congestiojn info types
roman1e2f5p8s May 27, 2025
2d72d6a
feat: add process_consensus_certificate to update congestion info per…
roman1e2f5p8s May 27, 2025
e9dec1b
feat: add mutex of multi-commit congestion data to epoch store
roman1e2f5p8s May 27, 2025
f8e4071
feat: add ring buffer to multi-commit congestion info
roman1e2f5p8s May 28, 2025
6db4ef1
test: add test_multi_commit_congestion_info_updates
roman1e2f5p8s May 28, 2025
4a5d04e
feat: introduce new SuggestedGasPriceCalculator component
roman1e2f5p8s May 28, 2025
87e0e13
fix: store congestion info only for scheduled txs
roman1e2f5p8s May 28, 2025
9d24407
Merge branch 'develop' into protocol-research/feat/calculate-suggeste…
roman1e2f5p8s Jun 11, 2025
062ca33
refactor: remove multi commit congestion info, adjust calculator to s…
roman1e2f5p8s Jun 12, 2025
205ee38
Merge branch 'develop' into protocol-research/feat/calculate-suggeste…
roman1e2f5p8s Jun 16, 2025
c29d2a8
refactor: keep all stuff in suggested_gas_price_calculator module
roman1e2f5p8s Jun 16, 2025
c3dfc43
chore: hold rgp and max exec duration in the calculator
roman1e2f5p8s Jun 16, 2025
38f3564
chore: start implementing the calculations
roman1e2f5p8s Jun 16, 2025
acb15ad
Merge branch 'develop' into protocol-research/feat/calculate-suggeste…
roman1e2f5p8s Jun 17, 2025
b64f26b
feat: impl calculations for one commit
roman1e2f5p8s Jun 18, 2025
98b1ad5
test: add test_update_congestion_info
roman1e2f5p8s Jun 18, 2025
7ce46d9
chore: remove test_ prefix
roman1e2f5p8s Jun 18, 2025
f038652
chore: remove test_ prefix in shared_object_congestion_tracker tests
roman1e2f5p8s Jun 18, 2025
412b0cf
feat: add calculate_suggested_gas_price tests
roman1e2f5p8s Jun 18, 2025
7ef7ef6
feat: disable the calculator for old sequencer
roman1e2f5p8s Jun 18, 2025
bbc0ae5
chore: amend calculate_suggested_gas_price tests
roman1e2f5p8s Jun 18, 2025
df70e12
todo: investigate read operations
roman1e2f5p8s Jun 18, 2025
985d663
Merge branch 'develop' into protocol-research/feat/calculate-suggeste…
roman1e2f5p8s Jun 18, 2025
dc473bf
fix: update congestion info only for mutable objects
roman1e2f5p8s Jun 19, 2025
c6f9d86
chore: sequencer's try_schedule does not need mut ref
roman1e2f5p8s Jun 19, 2025
58fa63d
Merge branch 'protocol-research/feat/gas-price-feedback' into protoco…
roman1e2f5p8s Jun 19, 2025
5db4a93
chore: use max gas price from protocol config
roman1e2f5p8s Jun 19, 2025
f788096
Merge branch 'protocol-research/feat/gas-price-feedback' into protoco…
roman1e2f5p8s Jun 19, 2025
4cb7b12
fix: suggestt rgp if max execution duration is none
roman1e2f5p8s Jun 19, 2025
ee365c2
feat: suggest reference gas price for old sequencer
roman1e2f5p8s Jun 23, 2025
9d3450b
test: make update_congestion_info_test to use all calculator's parame…
roman1e2f5p8s Jun 23, 2025
8e3d01a
test: improve calculate_suggested_gas_price_test to incl ref type
roman1e2f5p8s Jun 23, 2025
307f21f
test: add temporary test to illustrate inaccurate calculations
roman1e2f5p8s Jun 24, 2025
30c178f
test: use start time of transactions
roman1e2f5p8s Jun 25, 2025
1ea2edd
feat: implement accurate calculations for new sequencer
roman1e2f5p8s Jun 25, 2025
a9f5c27
test: write complete extensive tests
roman1e2f5p8s Jun 26, 2025
5c5625e
chore: remove todo
roman1e2f5p8s Jun 26, 2025
8d08f1e
Merge branch 'protocol-research/feat/gas-price-feedback' into protoco…
roman1e2f5p8s Jun 26, 2025
2e96f30
chore: add _test suffix to sequencer tests
roman1e2f5p8s Jun 26, 2025
8132f8c
fix: add license
roman1e2f5p8s Jun 27, 2025
d2f1b3b
fix: typos, remove weird file
roman1e2f5p8s Jun 27, 2025
6607167
fix: shared_object_congestion_tracker test
roman1e2f5p8s Jun 27, 2025
7d1a175
chore: fmt in shared_object_congestion_tracker tests
roman1e2f5p8s Jun 27, 2025
8ccf1e1
fix: congestion_control_tests::test_congestion_control_execution_canc…
roman1e2f5p8s Jun 27, 2025
075b4ba
fix: iota-core authority::authority_tests
roman1e2f5p8s Jun 27, 2025
7b81651
feat: add is_start_time_ordering_descending flag
roman1e2f5p8s Jul 1, 2025
6614507
chore: rename passing to clearing gas price
roman1e2f5p8s Jul 1, 2025
24a6fad
feat: simplify calculations if all objects have descendng start time …
roman1e2f5p8s Jul 1, 2025
381dab8
chore: rename start order from desc to asc, minor changes in except m…
roman1e2f5p8s Jul 1, 2025
951e7cf
fix: typo
roman1e2f5p8s Jul 1, 2025
c12ff08
feat: simplify calculations, fix update_congestion_info test
roman1e2f5p8s Jul 14, 2025
1cae460
fix: calculate_suggested_gas_price test for simplified calculations
roman1e2f5p8s Jul 14, 2025
620376f
chore: add test_ prefix back to object_cost_tests
roman1e2f5p8s Jul 15, 2025
c7dd255
chore: rename execution_slot_tests
roman1e2f5p8s Jul 15, 2025
5e3256f
chore: add start time and use duration test illustrations
roman1e2f5p8s Jul 15, 2025
a6fc05c
Merge branch 'protocol-research/feat/gas-price-feedback' into protoco…
roman1e2f5p8s Jul 17, 2025
ffbf175
fix: plug-in calculated suggested gas price instaed of rgp
roman1e2f5p8s Jul 17, 2025
f65bd3a
chore: add calculator description, make test code shorter
roman1e2f5p8s Jul 18, 2025
452b978
chore: revert test_ prefix in sequencer tests
roman1e2f5p8s Jul 21, 2025
e5500cd
fix: do not use par iter in calculator
roman1e2f5p8s Jul 21, 2025
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
1 change: 1 addition & 0 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ pub mod authority_store_types;
pub mod epoch_start_configuration;
pub mod shared_object_congestion_tracker;
pub mod shared_object_version_manager;
pub mod suggested_gas_price_calculator;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_authority_builder;
pub mod transaction_deferral;
Expand Down
67 changes: 49 additions & 18 deletions crates/iota-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ use crate::{
shared_object_version_manager::{
AssignedTxAndVersions, ConsensusSharedObjVerAssignment, SharedObjVerManager,
},
suggested_gas_price_calculator::SuggestedGasPriceCalculator,
},
checkpoints::{
BuilderCheckpointSummary, CheckpointHeight, CheckpointServiceNotify, EpochStats,
Expand Down Expand Up @@ -157,7 +158,7 @@ type JwkAggregator = GenericMultiStakeAggregator<(JwkId, JWK), true>;
/// Represents a scheduling result: a transaction can be either scheduled
/// for execution, or deferred for some reason. Scheduling result is
/// returned by the `try_schedule` method of `AuthorityPerEpochStore`.
enum SchedulingResult {
pub(crate) enum SchedulingResult {
/// Scheduling result indicating that a transaction is scheduled to be
/// executed at start time
Schedule(/* start_time */ ExecutionTime),
Expand Down Expand Up @@ -3120,6 +3121,23 @@ impl AuthorityPerEpochStore {
}
);

let mut suggested_gas_price_calculator = SuggestedGasPriceCalculator::new(
self.get_max_execution_duration_per_commit(),
self.reference_gas_price(),
self.protocol_config().max_gas_price(),
);

fail_point_arg!(
"initial_suggested_gas_price_calculator",
|calculator: SuggestedGasPriceCalculator| {
info!(
"Initialize suggested_gas_price_calculator to {:?}",
calculator
);
suggested_gas_price_calculator = calculator;
}
);

let mut randomness_state_updated = false;
for tx in transactions {
let key = tx.0.transaction.key();
Expand All @@ -3141,6 +3159,7 @@ impl AuthorityPerEpochStore {
dkg_failed,
randomness_round.is_some(),
congestion_tracker,
&mut suggested_gas_price_calculator,
authority_metrics,
)
.await?
Expand Down Expand Up @@ -3397,6 +3416,7 @@ impl AuthorityPerEpochStore {
dkg_failed: bool,
generating_randomness: bool,
shared_object_congestion_tracker: &mut SharedObjectCongestionTracker,
suggested_gas_price_calculator: &mut SuggestedGasPriceCalculator,
authority_metrics: &Arc<AuthorityMetrics>,
) -> IotaResult<ConsensusCertificateResult> {
let _scope = monitored_scope("HandleConsensusTransaction");
Expand Down Expand Up @@ -3433,7 +3453,8 @@ impl AuthorityPerEpochStore {
// certificate here it means authority is byzantine and sent certificate after
// EndOfPublish (or we have some bug in ConsensusAdapter)
warn!(
"[Byzantine authority] Authority {:?} sent a new, previously unseen certificate {:?} after it sent EndOfPublish message to consensus",
"[Byzantine authority] Authority {:?} sent a new, previously unseen
certificate {:?} after it sent EndOfPublish message to consensus",
certificate_author.concise(),
certificate.digest()
);
Expand Down Expand Up @@ -3470,6 +3491,8 @@ impl AuthorityPerEpochStore {
previously_deferred_tx_digests,
shared_object_congestion_tracker,
);
let estimated_execution_duration =
shared_object_congestion_tracker.get_estimated_execution_duration(&certificate);

match scheduling_result {
SchedulingResult::Defer(deferral_key, deferral_reason) => {
Expand All @@ -3496,24 +3519,21 @@ impl AuthorityPerEpochStore {
ConsensusCertificateResult::Deferred(deferral_key)
} else {
// Cancel the transaction that has been deferred for too long.

let suggested_gas_price = shared_object_congestion_tracker
.compute_suggested_gas_price(&certificate)
.expect(
"cancelled transaction must have at least one shared \
object and calculated suggested gas price",
);

debug!(
"Cancelling consensus certificate for transaction {:?} with \
deferral key {deferral_key:?} due to congestion on \
objects {congested_objects:?}: actual gas price: \
{}, suggested gas price: \
{suggested_gas_price}",
"Cancelling consensus certificate for transaction {:?} \
with deferral key {deferral_key:?} due to congestion \
on objects {congested_objects:?}",
certificate.digest(),
certificate.transaction_data().gas_price(),
);

// Calculate suggested gas price for the cancelled
// certificate.
let suggested_gas_price = suggested_gas_price_calculator
.calculate_suggested_gas_price(
&certificate,
estimated_execution_duration,
);

ConsensusCertificateResult::Cancelled((
certificate,
CancelConsensusCertificateReason::CongestionOnObjects {
Expand All @@ -3524,24 +3544,35 @@ impl AuthorityPerEpochStore {
}
}
};
return Ok(deferral_result);

Ok(deferral_result)
}
SchedulingResult::Schedule(start_time) => {
if dkg_failed && certificate.transaction_data().uses_randomness() {
debug!(
"Canceling randomness-using certificate for transaction {:?} because DKG failed",
certificate.digest(),
);

return Ok(ConsensusCertificateResult::Cancelled((
certificate,
CancelConsensusCertificateReason::DkgFailed,
)));
}

// This certificate will be scheduled. Update object execution slots.
// This certificate will be scheduled. If it contains shared object(s),
// we have to update the following:
// - shared object execution slots (for congestion tracker);
// - shared object congestion info (for suggested gas price calculator).
if certificate.contains_shared_object() {
shared_object_congestion_tracker
.bump_object_execution_slots(&certificate, start_time);

suggested_gas_price_calculator.update_congestion_info(
&certificate,
start_time,
estimated_execution_duration,
);
}

Ok(ConsensusCertificateResult::Scheduled {
Expand Down
Loading
Loading