-
Notifications
You must be signed in to change notification settings - Fork 106
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
[AHM] referenda pallet #558
[AHM] referenda pallet #558
Conversation
pallets/ah-migrator/src/referenda.rs
Outdated
|
||
let referendum = if let ReferendumInfo::Ongoing(mut status) = referendum { | ||
// TODO: map call and update preimage | ||
// TODO: if mapping fails cancel referendum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we have to set alarms in the scheduler? The scheduler normally checks if it went into "passing" or something.
Could be that it is not needed for big OpenGov refs since people vote on them often and that also sets the alarm. But it would probably cleaner to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I keep it in mind. Not sure yet how we solve it, but for sure make sure it works correctly
i | ||
} else { | ||
defensive!("Call encoded length is too large for inline encoding"); | ||
// TODO: if we have such a case we would need to dispatch two call on behalf of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now they actually all fit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean all ongoing referenda reference calls that - after translation - dont have more than 128 bytes? Huh, did not expect that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, never panics here
#[derive( | ||
Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, scale_info::TypeInfo, MaxEncodedLen, | ||
)] | ||
pub enum VersionedLocatableAccount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on this RFC - paritytech/polkadot-sdk#4715
I would prefer these types to be located in the same repo as the runtimes itself. Bu that would mean we need to copy past them for westend, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ggwpez what you think? should I move it to sdk?
/// The `RuntimeOrigin` is a type argument that needs to be mapped to AH `RuntimeOrigin`. | ||
/// Inline `proposal`s and the ones stored by `Preimage` pallet should also be mapped to get the | ||
/// final local `pallet_referenda::ReferendumInfoFor::<T, ()>`. | ||
pub type RcReferendumInfoOf<T, I> = ReferendumInfo< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub type RcReferendumInfoOf<T, I> = ReferendumInfo< | |
// From https://github.com/polkadot-fellows/runtimes/blob/a560cf00324a8520cab2b1a9c5e4a36efea9dae9/pallets/ah-migrator/src/referenda.rs#L30-L39 | |
pub type RcReferendumInfoOf<T, I> = ReferendumInfo< |
I think its good to have the location as link here so we can easily compare with the original and check if something changed later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the link to the same type? the closes type is ReferendumInfoOf<T, I>
in referenda pallet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ oh, yea thats what i meant
e | ||
} else { | ||
log::warn!("Failed to fetch preimage for referendum {}", id); | ||
cancel_referendum(id, status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: we have to cancel here because we cannot translate the preimage, right? So even though ongoing referenda without preimage are normally perfectly fine, in this case they are not because we can ensure that they are translated correctly?
Need to write this into some doc that people still try to post their preimages before the migration starts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right if we cannot fetch and translate we cannot even keep the same hash, because it has not meaning on new chain.
i | ||
} else { | ||
defensive!("Call encoded length is too large for inline encoding"); | ||
// TODO: if we have such a case we would need to dispatch two call on behalf of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean all ongoing referenda reference calls that - after translation - dont have more than 128 bytes? Huh, did not expect that.
defensive!("Call encoded length is too large for inline encoding"); | ||
// TODO: if we have such a case we would need to dispatch two call on behalf of | ||
// the original preimage submitter to release the funds for the new preimage | ||
// deposit and dispatch the call to note a new preimage. or we provide a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As intermediate solution we could also just request the hash of the translated call, then we dont have to cancel the referenda and also dont have to make calls on behalf of the preimage submitter. The fellowship could then as cleanup step after the migration submit the translated preimage.
I think that should be good for now to not make it too complicated.
Otherwise we can probably also mess with the storage of the preimage pallet to overwrite the preimage with the new content and keep the deposit active.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wont cancel them because they do not fit into inline. Just now no cases and I wanna move forward for now.
But right now, we can use Preimage::note, but that would request that preimage and for the referendums that wont pass we will have to cleanup/unrequest them. totally fine, but I leave it as is for now.
system-parachains/asset-hubs/asset-hub-polkadot/src/governance/mod.rs
Outdated
Show resolved
Hide resolved
system-parachains/asset-hubs/asset-hub-polkadot/src/governance/origins.rs
Show resolved
Hide resolved
|
||
//! Track configurations for governance. | ||
|
||
// TODO: RC_DAYS, RC_MINUTES should be RC_RC_DAYS, RC_MINUTES, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay you marked it here 👍
system-parachains/asset-hubs/asset-hub-polkadot/src/governance/tracks.rs
Show resolved
Hide resolved
|
||
/// Relay Chain Utility Call obtained from cargo expand. | ||
/// | ||
/// The variants that are not generally used in Governance are not included. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to pay attention that this does not change in the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. we probably need to give some heads up to devs and ask them to let us know if they introducing any changes to migrating pallets
system-parachains/asset-hubs/asset-hub-polkadot/src/migration.rs
Outdated
Show resolved
Hide resolved
system-parachains/asset-hubs/asset-hub-polkadot/src/migration.rs
Outdated
Show resolved
Hide resolved
return Err(a) | ||
}, | ||
}; | ||
Self::map(rc_call).map_err(|_| a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what calls are in the referenda pallet that we do not translate? Should also be in the user impact section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not yet. my plan still to have everything translated. I think I will know later if we have anything we cannot translate
}, | ||
RcRuntimeCall::Treasury(inner_call) => { | ||
let call = | ||
inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry what is this doing? Why do we not have to call map
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we know that RC inner call layout is basically the same with AH inner call, it encodes to the same sequence of bytes, and instead of manually mapping it, we can just encode RC treasury call and decode it to AH treasury call (true for all treasury calls for example except treasury spend call for which we have an arm above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, since this pallet's calls do not have anything to translate in them 👍
|
||
/// Pay on the local chain with `fungibles` implementation if the beneficiary and the asset are both | ||
/// local. | ||
pub struct LocalPay<F, A, C>(core::marker::PhantomData<(F, A, C)>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub struct LocalPay<F, A, C>(core::marker::PhantomData<(F, A, C)>); | |
// From https://github.com/polkadot-fellows/runtimes/blob/a560cf00324a8520cab2b1a9c5e4a36efea9dae9/system-parachains/common/src/pay.rs#L42-L114 | |
pub struct LocalPay<F, A, C>(core::marker::PhantomData<(F, A, C)>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new type (=
Cargo.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you add the new crate to the members as well?
…harem-ahm-referenda
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
ah, I have two very different branches, local and remote |
…rem-ahm-referenda
Oh damn, i wrote you that i rebased your branch 🙃 you can also force push and rebase again otherwise |
I think solved. Can you check my replies and lets merge it |
Yes. my fault. I also accepted your code proposals from review after merging dev branch locally and introducing inner referenda stage (= |
3dbad2b
into
polkadot-fellows:dev-asset-hub-migration
meant to be merged into
dev-asset-hub-migration
branchreferenda pallet migration