Skip to content

Conversation

@smiasojed
Copy link
Contributor

@smiasojed smiasojed commented Oct 27, 2025

EVM Runtime Code Upload for Foundry Integration
This feature enables direct upload of EVM runtime bytecode (deployed contract code without constructor) to the pallet-revive, supporting Foundry's code migration functionality between REVM and pallet-revive execution environments.

@smiasojed smiasojed added the T7-smart_contracts This PR/Issue is related to smart contracts. label Oct 27, 2025
@smiasojed
Copy link
Contributor Author

/cmd prdoc --audience node_dev --bump minor

@smiasojed smiasojed marked this pull request as ready for review October 28, 2025 13:32

/// Type of EVM bytecode to extract from Solidity compiler output.
#[derive(Clone, Copy)]
enum BytecodeType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe EvmByteCodeType ?

Comment on lines 2100 to 2111
pub fn try_upload_evm_runtime_code(
origin: H160,
code: Vec<u8>,
storage_deposit_limit: BalanceOf<T>,
exec_config: &ExecConfig,
) -> Result<(ContractBlob<T>, BalanceOf<T>), DispatchError> {
let origin = T::AddressMapper::to_account_id(&origin);
let mut module = ContractBlob::from_evm_runtime_code(code, origin)?;
let deposit = module.store_code(exec_config, None)?;
ensure!(storage_deposit_limit >= deposit, <Error<T>>::StorageDepositLimitExhausted);
Ok((module, deposit))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't the exisiting try_upload_pvm_code be renamed try_upload_code and accept both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here origin is H160 instead of AccountId, but we can use AccountId in both cases and have one method if you want

@pgherveou
Copy link
Contributor

@smiasojed how do you make use of this, because the try_upload_code is not pub and you haven't touched the logic of the upload_code extrinsic

@smiasojed
Copy link
Contributor Author

@smiasojed how do you make use of this, because the try_upload_code is not pub and you haven't touched the logic of the upload_code extrinsic

I accidentally removed the pub. Thanks

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/18935455766
Failed job name: test-linux-stable

@smiasojed smiasojed added this pull request to the merge queue Nov 3, 2025
Merged via the queue into master with commit 9eff394 Nov 3, 2025
237 checks passed
@smiasojed smiasojed deleted the sm/upload-evm-code branch November 3, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T7-smart_contracts This PR/Issue is related to smart contracts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants