I want to implement the FindAuthor trait to tell my pallet_evm how to find the author of a block. I know how to do it with Aura(FindAuthor is implemented in frontier-node-template). Im implementing an NPoS EVM compatible chain.

Will this work? Considering i'm using the Hash Truncated Account Mapping method to map Eth H160 addresses to Substrate AccoundId32 addresses. type AddressMapping = HashedAddressMapping<BlakeTwo256>;

Will this work with Babe?

pub struct FindAuthorTruncated<F>(PhantomData<F>);
impl<F: FindAuthor<u32>> FindAuthor<H160> for FindAuthorTruncated<F> {
    fn find_author<'a, I>(digests: I) -> Option<H160>
        I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
        if let Some(author_index) = F::find_author(digests) {
            let authority_id = Babe::authorities()[author_index as usize].clone().0;
            return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.