Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Allow waking the same message between waits #3475

Merged
merged 61 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
27c5e26
Remove field
mqxf Nov 7, 2023
7678468
Updated gsdk
mqxf Nov 7, 2023
99535d6
Replace Vec with Map
mqxf Nov 10, 2023
bea16af
Fmt
mqxf Nov 10, 2023
b53960f
Started making migrations
mqxf Nov 27, 2023
e4088a1
Added migrations
mqxf Nov 28, 2023
bb66f9f
Cargo fmt
mqxf Nov 28, 2023
0c621bc
Added pre and post checks for migrations
mqxf Nov 28, 2023
09d6ad3
Fixed import errors
mqxf Nov 28, 2023
aed712e
Cargo fmt
mqxf Nov 28, 2023
31bd346
Added DispatchStash migration
mqxf Nov 28, 2023
df85ef7
Removed reply_sent from ContextStore
mqxf Nov 28, 2023
f68e6f0
Updated version numbers
mqxf Nov 28, 2023
319c16f
Rename module
mqxf Nov 28, 2023
2c38d38
Requested changes
mqxf Dec 4, 2023
ecb080e
Added migrations to runtime and improved code
mqxf Dec 18, 2023
462a6d8
Trigger CI
mqxf Dec 18, 2023
13c801f
Replaced Into with From
mqxf Dec 18, 2023
d266683
Merge branch 'master' into ms/issue-2763
mqxf Dec 25, 2023
86d9aa8
I forgot to add a !
mqxf Dec 25, 2023
786e884
Merge branch 'master' into ms/issue-2763
mqxf Dec 25, 2023
2ed8f4a
Merge branch 'master' into ms/issue-2763
mqxf Dec 27, 2023
31b2e0e
Changed StoredDispatch in DispatchStash to StoredDelayedDispatch
mqxf Dec 27, 2023
c9d8128
Merge branch 'ms/issue-2763' of https://github.com/gear-tech/gear int…
mqxf Dec 27, 2023
a0b3c54
Fmt
mqxf Dec 27, 2023
3293ca4
Merge branch 'master' into ms/issue-2763
mqxf Dec 27, 2023
4a4e4c9
generate gsdk meta
mqxf Dec 27, 2023
2b8ad40
Merge branch 'ms/issue-2763' of https://github.com/gear-tech/gear int…
mqxf Dec 27, 2023
4c17364
Merge branch 'master' into ms/issue-2763
mqxf Jan 3, 2024
b958b6b
Merge branch 'master' into ms/issue-2763
mqxf Jan 9, 2024
9d1c184
Update T::BlockNumber -> BlockNumberFor<T>
mqxf Jan 9, 2024
8869613
.
mqxf Jan 9, 2024
c23c966
..
mqxf Jan 9, 2024
7d166c0
Add import
mqxf Jan 9, 2024
26b7d8f
Fmt
mqxf Jan 9, 2024
0bffdcf
Fix clippy errors
mqxf Jan 9, 2024
4503287
Fmt
mqxf Jan 9, 2024
cabd2d0
Merge branch 'master' into ms/issue-2763
mqxf Jan 17, 2024
a9af635
Fixed conflict issue
mqxf Jan 17, 2024
ed71c60
Merge branch 'master' into ms/issue-2763
mqxf Jan 18, 2024
6754fa4
Random tests
mqxf Jan 18, 2024
cd1b04b
Fix CI
mqxf Jan 18, 2024
1c61e11
Merge branch 'master' into ms/issue-2763
mqxf Jan 18, 2024
ae93137
Merge branch 'master' into ms/issue-2763
mqxf Jan 19, 2024
2d2ed03
Merge branch 'master' into ms/issue-2763
mqxf Jan 23, 2024
ed3290b
Merge branch 'master' into ms/issue-2763
mqxf Jan 26, 2024
bb52627
Update pallets/gear-messenger/src/migrations.rs
mqxf Feb 4, 2024
408797a
Update pallets/gear-messenger/src/migrations.rs
mqxf Feb 4, 2024
220a277
Update pallets/gear-messenger/src/migrations.rs
mqxf Feb 4, 2024
dc8edb8
Merge branch 'master' into ms/issue-2763
mqxf Feb 7, 2024
63713ec
Update core/src/message/context.rs
mqxf Feb 7, 2024
ebbe027
Update runtime/vara/src/migrations.rs
mqxf Feb 7, 2024
e99f5c0
Update core/src/message/stored.rs
mqxf Feb 7, 2024
a8d95f1
Fixed changes
mqxf Feb 7, 2024
3c74f5a
Added weights
mqxf Feb 8, 2024
f4e3f34
Merge branch 'master' into ms/issue-2763
mqxf Feb 8, 2024
a85dfe8
Merge branch 'master' into ms/issue-2763
mqxf Feb 16, 2024
2b3c166
Panic in pre upgrade
mqxf Feb 16, 2024
3e809b6
Add explanation to `StoredDelayedDispatch`
ark0f Feb 19, 2024
1cde774
Use deconstruction in for-loops
ark0f Feb 19, 2024
64b8506
Merge branch 'master' into ms/issue-2763
mqxf Feb 24, 2024
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
2 changes: 1 addition & 1 deletion core/src/message/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub struct ContextStore {
}

impl ContextStore {
// TODO: Remove, only used in migrations (#issue)
// TODO: Remove, only used in migrations (#issue 3721)
/// Create a new context store with the provided parameters.
pub fn new(
mqxf marked this conversation as resolved.
Show resolved Hide resolved
outgoing: BTreeMap<u32, Option<Payload>>,
Expand Down
1 change: 0 additions & 1 deletion core/src/message/stored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ impl StoredDelayedDispatch {
Self { kind, message }
}


/// Decompose StoredDelayedDispatch for it's components: DispatchKind, StoredMessage.
pub fn into_parts(self) -> (DispatchKind, StoredMessage) {
self.into()
Expand Down
16 changes: 10 additions & 6 deletions pallets/gear-messenger/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV3<T> {
DispatchStash::<T>::translate(
mqxf marked this conversation as resolved.
Show resolved Hide resolved
|_, store: (v2::StoredDispatch, Interval<BlockNumberFor<T>>)| {
if store.0.context.is_some() {
mqxf marked this conversation as resolved.
Show resolved Hide resolved
log::error!("Previous context on StoredDispatch in DispatchStash should always be None, but was {:?}", store.0.context);
log::error!("Previous context on StoredDispatch in DispatchStash should always be None, but was Some for message id {:?}", store.0.message.id());
}
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
Some((store.0.into(), store.1))
Expand All @@ -87,7 +87,13 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV3<T> {
fn pre_upgrade() -> Result<Vec<u8>, DispatchError> {
let mut count = v2::Waitlist::<T>::iter().count();
count += v2::Dispatches::<T>::iter().count();
count += v2::DispatchStash::<T>::iter().count();
count += v2::DispatchStash::<T>::iter().inspect(
|store| {
if store.1.0.context.is_some() {
log::error!("Previous context on StoredDispatch in DispatchStash should always be None, but was Some for message id {:?}", store.1.0.message.id());
ark0f marked this conversation as resolved.
Show resolved Hide resolved
}
},
).count();

Ok((count as u64).encode())
}
Expand Down Expand Up @@ -257,6 +263,7 @@ mod tests {
};
use gear_core_errors::{ReplyCode, SignalCode, SuccessReplyReason};
use rand::random;
use sp_runtime::traits::Zero;

fn random_payload() -> Payload {
Payload::try_from(up_to(8 * 1024, random::<u8>).collect::<Vec<_>>())
Expand Down Expand Up @@ -396,10 +403,7 @@ mod tests {
.collect::<Vec<_>>();

for (msg_id, dispatch, interval) in dispatch_stash.clone() {
v2::DispatchStash::<Test>::insert(
dispatch.0,
(dispatch.1.clone(), dispatch.2.clone()),
);
v2::DispatchStash::<Test>::insert(msg_id, (dispatch.clone(), interval.clone()));
}

let state = MigrateToV3::<Test>::pre_upgrade().unwrap();
Expand Down
Loading