fix: 🔧 replace pallet_author_inherent with Babe find_author impl (#11)

The pallet_author_inherent was used for finding the author of the
current block, used in pallet_evm, among others, but it was tightly
coupled to the Nimbus protocol. Luckily, Babe also provides a
find_author that we can use for the same purpose.
This commit is contained in:
Gonza Montiel 2025-03-25 11:36:53 +01:00 committed by GitHub
parent 55a1ef26b7
commit 18aa57757a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2 additions and 59 deletions

40
operator/Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "Inflector"
@ -1599,7 +1599,6 @@ dependencies = [
"frame-try-runtime",
"hex",
"hex-literal 0.3.4",
"pallet-author-inherent",
"pallet-babe",
"pallet-balances",
"pallet-beefy",
@ -5306,24 +5305,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "nimbus-primitives"
version = "0.9.0"
source = "git+https://github.com/Moonsong-Labs/moonkit?rev=002c1a5ae3ce82e1136d5321bff124ab93ed050f#002c1a5ae3ce82e1136d5321bff124ab93ed050f"
dependencies = [
"async-trait",
"frame-benchmarking",
"frame-support",
"frame-system",
"parity-scale-codec",
"scale-info",
"sp-api",
"sp-application-crypto",
"sp-inherents",
"sp-runtime",
"sp-std",
]
[[package]]
name = "nix"
version = "0.26.4"
@ -5645,25 +5626,6 @@ dependencies = [
"sp-runtime",
]
[[package]]
name = "pallet-author-inherent"
version = "0.9.0"
source = "git+https://github.com/Moonsong-Labs/moonkit?rev=002c1a5ae3ce82e1136d5321bff124ab93ed050f#002c1a5ae3ce82e1136d5321bff124ab93ed050f"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"nimbus-primitives",
"parity-scale-codec",
"scale-info",
"sp-api",
"sp-application-crypto",
"sp-inherents",
"sp-runtime",
"sp-std",
]
[[package]]
name = "pallet-authority-discovery"
version = "38.0.0"

View file

@ -113,9 +113,6 @@ pallet-mmr = { git = "https://github.com/paritytech/polkadot-sdk", branch = "sta
snowbridge-beacon-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
snowbridge-pallet-ethereum-client = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
# Moonkit
pallet-author-inherent = { git = "https://github.com/Moonsong-Labs/moonkit", rev = "002c1a5ae3ce82e1136d5321bff124ab93ed050f", default-features = false }
# Frontier (wasm)
fp-account = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2409", default-features = false }
pallet-ethereum = { git = "https://github.com/polkadot-evm/frontier/", branch = "stable2409", default-features = false }

View file

@ -22,7 +22,6 @@ frame-system.workspace = true
frame-try-runtime = { optional = true, workspace = true }
frame-executive.workspace = true
frame-metadata-hash-extension.workspace = true
pallet-author-inherent.workspace = true
hex-literal.workspace = true
pallet-babe.workspace = true
pallet-balances.workspace = true
@ -99,7 +98,6 @@ std = [
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-author-inherent/std",
"pallet-validator-set/std",
"polkadot-primitives/std",
@ -150,7 +148,6 @@ runtime-benchmarks = [
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-evm/runtime-benchmarks",
"pallet-author-inherent/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
]

View file

@ -23,7 +23,6 @@
//
// For more information, please refer to <http://unlicense.org>
use crate::AuthorInherent;
use crate::EvmChainId;
use crate::Timestamp;
use crate::{Historical, SessionKeys, ValidatorSet};
@ -310,15 +309,6 @@ impl pallet_mmr::Config for Runtime {
// Frontier
// TODO: configure pallet author-inherent correctly
impl pallet_author_inherent::Config for Runtime {
type SlotBeacon = ();
type AccountLookup = ();
type CanAuthor = ();
type AuthorId = AccountId;
type WeightInfo = ();
}
parameter_types! {
pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes;
}
@ -356,7 +346,7 @@ impl FindAuthor<H160> for FindAuthorAdapter {
where
I: 'a + IntoIterator<Item = (sp_runtime::ConsensusEngineId, &'a [u8])>,
{
if let Some(author) = AuthorInherent::find_author(digests) {
if let Some(author) = Babe::find_author(digests) {
return Some(H160::from_slice(&author.encode()[0..20]));
}
None

View file

@ -247,9 +247,6 @@ mod runtime {
#[runtime::pallet_index(13)]
pub type EthereumBeaconClient = snowbridge_pallet_ethereum_client;
#[runtime::pallet_index(20)]
pub type AuthorInherent = pallet_author_inherent;
#[runtime::pallet_index(31)]
pub type Ethereum = pallet_ethereum;