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

Control unsigned ismp with a storage item #343

Closed

Conversation

blakebyrnes
Copy link
Contributor

@blakebyrnes blakebyrnes commented Nov 14, 2024

This PR adds a storage item, genesis setting and runtime api to control the activation of unsigned transactions for the ISMP pallet.

The unsigned feature flag is removed, and the development testnet configs have the enableUnsignedTransactions flag turned on by default.

NOTE: I did not update any chain specs.

This PR adds a storage item, genesis setting and runtime api to control the activation of unsigned transactions for the ISMP pallet.

The unsigned feature flag is removed, and the development testnet configs have the enableUnsignedTransactions flag turned on by default.
@@ -32,7 +32,7 @@ To use it in your runtime, you need to implement the ismp
### Dispatchable Functions

- `handle` - Handles incoming ISMP messages.
- `handle_unsigned` Unsigned variant for handling incoming messages, enabled by `feature = ["unsigned"]`
- `handle_unsigned` Unsigned variant for handling incoming messages
Copy link
Member

@seunlanlege seunlanlege Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to also consolidate these calls, into a single call which checks for unsigned or signed depending on the storage item

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want me to do that? I can't run your test suite, so feels like I'm starting to hack at things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, depending on how much backward compatibility you want to preserve, we could optionally take out index 0 and start them handle, but if you think that will break people, we should leave handle at 1

/// Execute the provided batch of ISMP messages. This call will short-circuit and revert if
		/// any of the provided messages are invalid.
		///
		/// The dispatch origin for this call must be an unsigned one.
		///
		/// - `messages`: A set of ISMP [`Message`]s to handle or process.
		///
		/// Emits different message events based on the Message received if successful.
		#[pallet::weight(get_weight::<T>(&messages))]
		#[pallet::call_index(1)]
		#[frame_support::transactional]
		pub fn handle(origin: OriginFor<T>, messages: Vec<Message>) -> DispatchResultWithPostInfo {
			if EnableUnsigned::<T>::get() {
				ensure_none(origin)?;
			} else {
				ensure_signed(origin)?;
			}

			Self::handle_messages(messages)
		}```

@blakebyrnes
Copy link
Contributor Author

We're putting this on pause for now. Need to merge handle and handle_message, which means anywhere that is currently looking up whether handle_message is available as a call will need a storage lookup to see if the api is enabled.

@seunlanlege seunlanlege deleted the branch polytope-labs:seun/deploy-mnt November 16, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants