Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Add default implementation #155

Merged
merged 1 commit into from
Jul 1, 2022
Merged

Conversation

boundless-forest
Copy link
Member

@boundless-forest boundless-forest commented Jul 1, 2022

To make the runtime config for parachain easier. type CallValidator = Everything;

@boundless-forest boundless-forest linked an issue Jul 1, 2022 that may be closed by this pull request
@AurevoirXavier
Copy link
Member

AurevoirXavier commented Jul 1, 2022

Recommend to implement for (). There is another Everything in Substrate with different meaning. Avoid using the same name.

@@ -177,3 +180,15 @@ pub trait CallValidate<AccountId, Origin, Call> {
call: &Call,
) -> Result<(), TransactionValidityError>;
}

/// CallValidate's default implementation, no additional validation
pub enum Everything {}
Copy link
Member

Choose a reason for hiding this comment

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

Why enum?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just follow the substrate style:

pub enum Everything {}
impl<T> Contains<T> for Everything {
	fn contains(_: &T) -> bool {
		true
	}
}

and https://www.reddit.com/r/rust/comments/91mgqk/empty_enum_vs_empry_struct/. Enum makes sense here, we don't need to instance this type in runtime.

@boundless-forest
Copy link
Member Author

boundless-forest commented Jul 1, 2022

Recommend to implement for (). There is another Everything in Substrate with different meaning. Avoid using the same name.

It tooks me more time to choose the name between () and Everything than editing the code. Everything means allowing all calls to pass, and () seems like no validation at all. So, maybe Everything is better in my view.

@hackfisher
Copy link
Contributor

Everything LGTM if it is from different namespace, more readable than ()

@hackfisher hackfisher merged commit a7bf82f into darwinia-v0.12.3 Jul 1, 2022
@hackfisher hackfisher deleted the bear-add-default branch July 1, 2022 10:21
boundless-forest added a commit that referenced this pull request Jul 4, 2022
boundless-forest added a commit that referenced this pull request Jul 4, 2022
jiguantong added a commit that referenced this pull request Jul 4, 2022
jiguantong pushed a commit that referenced this pull request Jul 4, 2022
hackfisher pushed a commit that referenced this pull request Jul 4, 2022
jiguantong pushed a commit that referenced this pull request Sep 29, 2022
wuminzhe pushed a commit that referenced this pull request Sep 30, 2022
* Update market after order is created or comfirmed (#94)

* Update order capacity

* FIX CI

* Update comment

* Redesign fee market payment (#169)

* Add basic solution

* Refactor Slash Report

* Refactor Slash Report 2

* Add other changes

* Add tests

* Self review

* Rename to `message_and_confirm_reward`

* Rename to `previous_relayers`

* Rename to AssignedRelayer

* Add more comments

* Add more comments

* Add new reward implementation

* Rename and clean the code, needs more test

* Add more docs here

* Prepare for tests

* Fix broken tests

* Refactor

* Rename

* Remove RewardBook

* Self review

* Save one storage

* Try fix ci

* Handle Zero `CollateralPerOrder` (#176)

* Companion 189 for darwinia-parachain (#194)

* Update fee-market terminology (#192) (#199)

* Support pangolin <> pangolin parachain alpha bridge (#190)

* Cherry-pick #201 to `darwinia-parachain` (#203)

* Del useless related to fee calculation (#201)

* Delete estimate_delivery_transaction

* Delete transaction_payment

* Delete MessageTransaction

* Code clean

* Fix compile

* Anchor polkadot-v0.9.27

* remove unused import

* Fix test problem (#172)

* fix ci

* Add necessary reward event (#89)

* Refactor the total reward cal

* Code Clean

* Fix test

* Add OrderCreated event

* Self review

* Update comment

* Update OrderCreate event to include relayers

* Fix review

* Enhance dispatch module (#121)

* rm shift session manager pallet and clean useless imports (#128)

* `Pre-dispatch` validate for main branch (#130)

* Adjust the traits

* Try fix compile

* Fix tests

* Code clean

* Avoid duplicate evm transact fees (#136)

* cherry pick #137 (#140)

* cherry pick #137

* pick #141

Co-authored-by: bear <boundless.forest@outlook.com>

* Drop error in `pre_dispatch` (#152) (#153)

* Migrate to new s2s bridge (#149)

* Add client-darwinia/client-crab/client-crab-parachain

* Update CI

* rever substrate commit

* fix compile

* remove transactional

* Fix

* Bump finality-grandpa to v0.16.0

* fix wrong import

* make change follow paritytech/substrate#11415

* Add runtime-common to workspace and try fix test

* Make changes follow paritytech/substrate#10242

* Code clean

* More ci check

* Remove integrity

Co-authored-by: bear <boundless.forest@outlook.com>

* Companion for #155 (#157)

* Update market after order is created or comfirmed (#94)

* Update order capacity

* FIX CI

* Update comment

* Redesign fee market payment (#169)

* Add basic solution

* Refactor Slash Report

* Refactor Slash Report 2

* Add other changes

* Add tests

* Self review

* Rename to `message_and_confirm_reward`

* Rename to `previous_relayers`

* Rename to AssignedRelayer

* Add more comments

* Add more comments

* Add new reward implementation

* Rename and clean the code, needs more test

* Add more docs here

* Prepare for tests

* Fix broken tests

* Refactor

* Rename

* Remove RewardBook

* Self review

* Save one storage

* Try fix ci

* Handle Zero `CollateralPerOrder` (#176)

* Update Fee market docs (#178)

* Update doc

* Update example

* Move to `dev-dependencies` (#182)

* Sync part.1 (#184)

* Remove fee relates (#186)

* Sync missing changes from different branches (#191)

* Support pangolin <> pangolin parachain alpha bridge (#190)

* Integrate `fee-market` to `FromThisChainMessageVerifier` (#189)

* Run ignored crate

* Fix tests

* Add features

* Fix compile

* Update fee-market terminology (#192)

* Del useless related to fee calculation (#201)

* Delete estimate_delivery_transaction

* Delete transaction_payment

* Delete MessageTransaction

* Code clean

* master > polkadot-v0.9.27

* roll back bp-parachain

Co-authored-by: bear <boundless.forest@outlook.com>
Co-authored-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Aki Wu <aki.wu@itering.com>
Co-authored-by: HackFisher <denny.wang@itering.io>
Co-authored-by: HackFisher <hackfisher@gmail.com>
Co-authored-by: fewensa <37804932+fewensa@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done/No Companion
Development

Successfully merging this pull request may close these issues.

Add default implementation for CallValidate type
3 participants