Skip to content

Commit

Permalink
Send balance when contract doesn't exist (paritytech#5664)
Browse files Browse the repository at this point in the history
Fixes paritytech#5577 

I decided to bubble up the error from where we actually try to load the
contract info. This helps to make sure that we don't miss some entry
point by accident. The draw back is that we have to live with some
additional `.expect`.

@pgherveou With this logic the proxy and its runtime part should be
completely unaware whether something is a contract call or a balance
transfer. They should just route everything into pallet_revive.

---------

Co-authored-by: Cyrill Leutwiler <cyrill@parity.io>
  • Loading branch information
athei and xermicus committed Sep 11, 2024
1 parent f0e420a commit ea5fb02
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 118 deletions.
11 changes: 11 additions & 0 deletions prdoc/pr_5664.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Calling an address without associated code is a balance transfer

doc:
- audience: Runtime Dev
description: |
This makes pallet_revive behave like EVM where a balance transfer
is just a call to a plain wallet.

crates:
- name: pallet-revive
bump: patch
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub extern "C" fn call() {
input!(
100,
callee_addr: &[u8; 20],
value: &[u8; 32],
input: [u8],
);

Expand All @@ -44,7 +45,7 @@ pub extern "C" fn call() {
0u64, // How much ref_time to devote for the execution. 0 = all.
0u64, // How much proof_size to devote for the execution. 0 = all.
None, // No deposit limit.
&u256_bytes(100u64), // Value transferred to the contract.
value, // Value transferred to the contract.
input,
None,
) {
Expand Down
Loading

0 comments on commit ea5fb02

Please sign in to comment.