Skip to content

[Anvil] Impersonation #242

@alindima

Description

@alindima

Configured via CLI or impersonation RPCs: anvil_impersonateAccount, anvil_stopImpersonatingAccount, anvil_autoImpersonateAccount, eth_sendUnsignedTransaction.

We need to handle this in two places: during txpool validation (with the validate_transaction runtime API) and during runtime execution of the transaction. Txpool ends up calling a runtime API (validate_transaction) and into the Checkable trait implementation of the UncheckedExtrinsic. The Checkable implementation of UnsignedExtrinsic ends up calling a hostcall to verify the signature, in sp_io::crypto: https://github.com/paritytech/polkadot-sdk/blob/e117602f60bf3a0debe6843c94278275e3912a40/substrate/primitives/io/src/lib.rs#L885

We need to add a magic signature, which ends up bypassing the signature checks.
There are two options:

  • We can impl a new Checkable type. This would mean modifying the runtime. Not ideal because long term we want to have this work with arbitrary runtimes (even forked)
  • We could override the hostcall that performs the signature checks. Not sure how easy this is, but would enable us to not modify the runtime.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions