Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Ensure note_min_gas_price_target updated in a block once #725

Closed
2 tasks done
hackfisher opened this issue Jul 28, 2021 · 9 comments · Fixed by #817
Closed
2 tasks done

Ensure note_min_gas_price_target updated in a block once #725

hackfisher opened this issue Jul 28, 2021 · 9 comments · Fixed by #817
Assignees
Labels
B-Runtime [Bug] Some mistakes with the runtime logic C-EVM [Component] Something about EVM

Comments

@hackfisher
Copy link
Contributor

hackfisher commented Jul 28, 2021

  • For inherent call, the weight might need to be DispatchClass::Mandatory, refer timestamp pallet.
#[pallet::weight((
			T::WeightInfo::set(),
			DispatchClass::Mandatory
		))]
  • Inherent and Unsigned Transaction are both verified by ensure_none? Does Unsigned Transaction require extra validation for those calls use ensure_none?
@boundless-forest
Copy link
Member

Inherent and Unsigned Transaction are both verified by ensure_none?

As far as I understand it, Inherent is a special unsigned transaction. Therefore, you must ensure ensure_none().

For inherent, you can add extra InherentData validation by using check_inherent().
For general unsigned transaction, checked by validate_unsigned().

Does Unsigned Transaction require extra validation for those calls use ensure_none?

Sometimes it is necessary.

With extra validation examples:

  1. https://github.com/darwinia-network/darwinia-common/blob/master/frame/claims/src/lib.rs#L418
  2. https://github.com/darwinia-network/darwinia-common/blob/master/frame/claims/src/lib.rs#L418

No extra validation examples:

  1. https://github.com/paritytech/substrate/blob/master/frame/authorship/src/lib.rs#L220
  2. https://github.com/paritytech/substrate/blob/master/frame/timestamp/src/lib.rs#L190

@hackfisher
Copy link
Contributor Author

Just as the timestamp pallet from substrate, which validates the timestamp must be updated only once in the block.

Refer:

https://github.com/paritytech/substrate/blob/a019b577163ec354d2776178fbdb922b0e77dea9/frame/timestamp/src/lib.rs#L191

The dvm dynamic fee might be better to do the same check to avoid corner cases of including multiple such note_min_gas_price_target , one from block producer, others might from tx pool, ordered and included by block producer by accident.

fn note_min_gas_price_target(

test

@aurexav aurexav added B-Runtime [Bug] Some mistakes with the runtime logic Crab C-EVM [Component] Something about EVM labels Jul 28, 2021
@boundless-forest boundless-forest changed the title Review and check the inherents and unsigned transactions Ensure note_min_gas_price_target updated in a block once Jul 28, 2021
@boundless-forest
Copy link
Member

https://substrate.dev/docs/en/knowledgebase/runtime/fees#mandatory-dispatches

@boundless-forest boundless-forest self-assigned this Jul 28, 2021
@boundless-forest
Copy link
Member

boundless-forest commented Aug 3, 2021

@aurexav
Copy link
Member

aurexav commented Sep 13, 2021

Any update? @AsceticBear

@boundless-forest
Copy link
Member

Waiting for the next DVM update

@boundless-forest boundless-forest linked a pull request Sep 15, 2021 that will close this issue
@hackfisher
Copy link
Contributor Author

others might from tx pool, ordered and included by block producer by accident.

It is not possible to be include by block producer if it uses transaction pool

https://github.com/paritytech/substrate/blob/master/primitives/runtime/src/generic/checked_extrinsic.rs#L51-L66

Inherent does not pass through the transaction pool, so it will not be checked out of NoUnsignedValidator by validate_unsigned, but the Unsigned Extrinsic sent by users outside the block producer will be checked out of the transaction pool and will be checked out of NoUnsignedValidator
image (13)

@hackfisher
Copy link
Contributor Author

Multiple inherent inclusion is fixing by #817

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B-Runtime [Bug] Some mistakes with the runtime logic C-EVM [Component] Something about EVM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants