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

added fields AnnouncementSigner and CommunityRules to CommunityMetadata #336

Merged
merged 19 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from 18 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
12 changes: 6 additions & 6 deletions ceremonies/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ mod v0 {
pub mod v1 {
use super::*;

pub struct Migration<T>(sp_std::marker::PhantomData<T>);
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);

impl<T: Config + frame_system::Config> OnRuntimeUpgrade for Migration<T> {
impl<T: Config + frame_system::Config> OnRuntimeUpgrade for MigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
assert_eq!(StorageVersion::get::<Pallet<T>>(), 0, "can only upgrade from version 0");
Expand Down Expand Up @@ -123,9 +123,9 @@ mod test {
v0::AttestationRegistry::<TestRuntime>::insert((cids[1], 2), 3, attestations_2.clone());

// Migrate.
let state = v1::Migration::<TestRuntime>::pre_upgrade().unwrap();
let _weight = v1::Migration::<TestRuntime>::on_runtime_upgrade();
v1::Migration::<TestRuntime>::post_upgrade(state).unwrap();
let state = v1::MigrateToV1::<TestRuntime>::pre_upgrade().unwrap();
let _weight = v1::MigrateToV1::<TestRuntime>::on_runtime_upgrade();
v1::MigrateToV1::<TestRuntime>::post_upgrade(state).unwrap();

// Check that all values got migrated.

Expand Down Expand Up @@ -201,7 +201,7 @@ mod test {
attestations,
);
// Migrate.
let state = v1::Migration::<TestRuntime>::pre_upgrade();
let state = v1::MigrateToV1::<TestRuntime>::pre_upgrade();
assert_err!(state, "too many attestations");
});
}
Expand Down
4 changes: 3 additions & 1 deletion communities/rpc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// along with Encointer. If not, see <http://www.gnu.org/licenses/>.

use super::*;
use encointer_primitives::common::{FromStr, PalletString};
use sp_core::offchain::storage::InMemOffchainStorage;

#[test]
Expand All @@ -24,7 +25,8 @@ fn caching_works() {
let communities: CommunitiesRpc<_, (), _> =
CommunitiesRpc::new(Arc::new(client), storage, true);

let cid_names = vec![CidName::new(Default::default(), "hello world".into())];
let cid_names =
vec![CidName::new(Default::default(), PalletString::from_str("hello world").unwrap())];

assert!(communities.cache_dirty());
communities.set_storage(CIDS_KEY, &cid_names);
Expand Down
2 changes: 1 addition & 1 deletion communities/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;

const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(PhantomData<T>);
Expand Down
Loading
Loading