Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8541d7c
Burn https://github.com/paritytech/substrate/pull/13829
vstakhov Apr 18, 2023
e7d63ad
Update lock file
vstakhov Apr 18, 2023
f325571
Revert "Revert "Update orchestra to the recent version (#6854)" (#6916)"
vstakhov Apr 18, 2023
df78b30
Update lock file
vstakhov Apr 18, 2023
ba0535e
Fix another merge damage
vstakhov Apr 18, 2023
a502239
Try async-channel
vstakhov Apr 21, 2023
07e48ce
Reset substrate branch
vstakhov Apr 21, 2023
8432cee
Merge branch 'master' into vstakhov-burn-sp-13829
vstakhov Apr 21, 2023
06f8c1c
Update lock
vstakhov Apr 21, 2023
af2da86
Fix tests
vstakhov Apr 21, 2023
55cf9ca
Another test update
vstakhov Apr 21, 2023
5eb24c6
Replace `RollingSessionWindow` with `RuntimeInfo` - initial commit
tdimitrov Apr 13, 2023
b0da049
Fix tests in import
tdimitrov Apr 20, 2023
93e6863
Fix the rest of the tests
tdimitrov Apr 20, 2023
a7b74cc
Remove dead code
tdimitrov Apr 20, 2023
0f84b42
Fix todos
tdimitrov Apr 21, 2023
0e486d4
Simplify session caching
tdimitrov Apr 21, 2023
f6a9d98
Comments for `SessionInfoProvider`
tdimitrov Apr 21, 2023
2918b42
Separate `SessionInfoProvider` from `State`
tdimitrov Apr 21, 2023
837f952
`cache_session_info_for_head` becomes freestanding function
tdimitrov Apr 21, 2023
6f609f3
Remove unneeded `mut` usage
tdimitrov Apr 21, 2023
88cd475
Try unbounded
vstakhov Apr 21, 2023
82a0ebc
fn session_info -> fn get_session_info() to avoid name clashes. The f…
tdimitrov Apr 24, 2023
dca7287
Fix SessionInfo retrieval
tdimitrov Apr 24, 2023
360b96d
Code cleanup
tdimitrov Apr 24, 2023
f08f06f
Fix stalling dispute coordinator.
Apr 24, 2023
9d3ef66
Initialization.
Apr 24, 2023
89d17ea
Merge remote-tracking branch 'origin/tsv-rolling-session-approval-vot…
vstakhov Apr 24, 2023
2e23f67
Merge remote-tracking branch 'origin/rk-chain-import-backlog' into vs…
vstakhov Apr 24, 2023
c59d7da
Rewrite lock
vstakhov Apr 24, 2023
166d4b2
Adjust channels
vstakhov Apr 25, 2023
28975c1
[ci] Update buildah command and version (#7128)
alvicsam Apr 24, 2023
61f4bb8
Try to disable approval votes fetching
vstakhov Apr 26, 2023
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
Prev Previous commit
Next Next commit
Code cleanup
  • Loading branch information
tdimitrov committed Apr 24, 2023
commit 360b96d67f425fb0d0ae937268fdfa370d4ddb2a
32 changes: 13 additions & 19 deletions node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,15 @@ impl State {
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
// We can't borrow the session here. Only get copies of what's needed.
let (no_show_slots, needed_approvals) = match get_session_info(
let session_info = match get_session_info(
session_info_provider,
sender,
block_entry.parent_hash(),
block_entry.session(),
)
.await
{
Some(s) => (s.no_show_slots, s.needed_approvals),
Some(s) => s,
None => {
gum::warn!(
target: LOG_TARGET,
Expand All @@ -700,8 +699,10 @@ impl State {

let tranche_now = self.clock.tranche_now(self.slot_duration_millis, block_entry.slot());
let block_tick = slot_number_to_tick(self.slot_duration_millis, block_entry.slot());
let no_show_duration =
slot_number_to_tick(self.slot_duration_millis, Slot::from(u64::from(no_show_slots)));
let no_show_duration = slot_number_to_tick(
self.slot_duration_millis,
Slot::from(u64::from(session_info.no_show_slots)),
);

if let Some(approval_entry) = candidate_entry.approval_entry(&block_hash) {
let required_tranches = approval_checking::tranches_to_approve(
Expand All @@ -710,7 +711,7 @@ impl State {
tranche_now,
block_tick,
no_show_duration,
needed_approvals as _,
session_info.needed_approvals as _,
);

let status = ApprovalStatus { required_tranches, block_tick, tranche_now };
Expand Down Expand Up @@ -771,7 +772,6 @@ where

// `None` on start-up. Gets initialized/updated on leaf update
let mut session_info_provider: Option<SessionInfoProvider> = None;

let mut wakeups = Wakeups::default();
let mut currently_checking_set = CurrentlyCheckingSet::default();
let mut approvals_cache = lru::LruCache::new(APPROVAL_CACHE_SIZE);
Expand Down Expand Up @@ -1849,11 +1849,10 @@ where
)),
};

let config = &criteria::Config::from(session_info);
let res = state.assignment_criteria.check_assignment_cert(
claimed_core_index,
assignment.validator,
config,
&criteria::Config::from(session_info),
block_entry.relay_vrf_story(),
&assignment.cert,
approval_entry.backing_group(),
Expand Down Expand Up @@ -2066,9 +2065,6 @@ where
Ok((actions, t))
}

// TODO?
// fn get_session_info(..) {}

#[derive(Debug)]
enum ApprovalStateTransition {
RemoteApproval(ValidatorIndex),
Expand Down Expand Up @@ -2301,8 +2297,6 @@ async fn process_wakeup<Context>(
_ => return Ok(Vec::new()),
};

let slot_duration_millis = state.slot_duration_millis;
let tranche_now = state.clock.tranche_now(slot_duration_millis, block_entry.slot());
let session_info = match get_session_info(
session_info_provider,
ctx.sender(),
Expand All @@ -2324,12 +2318,12 @@ async fn process_wakeup<Context>(
},
};

let block_tick = slot_number_to_tick(slot_duration_millis, block_entry.slot());
let block_tick = slot_number_to_tick(state.slot_duration_millis, block_entry.slot());
let no_show_duration = slot_number_to_tick(
slot_duration_millis,
state.slot_duration_millis,
Slot::from(u64::from(session_info.no_show_slots)),
);

let tranche_now = state.clock.tranche_now(state.slot_duration_millis, block_entry.slot());
span.add_uint_tag("tranche", tranche_now as u64);
gum::trace!(
target: LOG_TARGET,
Expand Down Expand Up @@ -2738,7 +2732,7 @@ async fn issue_approval<Context>(
};

let validator_pubkey = match session_info.validators.get(validator_index) {
Some(p) => p.clone(), // todo: remove this
Some(p) => p,
None => {
gum::warn!(
target: LOG_TARGET,
Expand Down Expand Up @@ -2884,7 +2878,7 @@ where
target: LOG_TARGET,
session = session_index,
?relay_parent,
"Can't get SessionInfo"
"Can't obtain SessionInfo"
);
None
},
Expand Down