I am in the process of working with a precompiled contract I created in my Frontier EVM.
I encounter issues when attempting to call this precompiled contract from another contract. While direct calls to the precompiled contract function as expected, any attempt to interact via a separate contract results in failure.
I received advice suggesting that the solution to this issue is to deploy some bytecode at the address where the precompiled contract is located. The actual content of this bytecode is apparently inconsequential, as it will never be executed. Its main function is to convince the EVM that it's interacting with a valid contract.
I found a potential solution in the Moonbeam GitHub repository: moonbeam/node/service/src/chain_spec/moonbase.rs
However, I am still unsure about the specifics of this process. My main questions are:
- How can I inject the code of an already created precompiled contract? I presume this would involve directly writing to the storage of the pallet, correct?
- How can I inject the code during a runtime upgrade that contains a new precompiled contract?