Skip to content
Snippets Groups Projects
  • Cyrill Leutwiler's avatar
    [pallet-revive] rework balance transfers (#6187) · d69a80e6
    Cyrill Leutwiler authored
    
    This PR removes the `transfer` syscall and changes balance transfers to
    make the existential deposit (ED) fully transparent for contracts.
    
    The `transfer` API is removed since there is no corresponding EVM opcode
    and transferring via a call introduces barely any overhead.
    
    We make the ED transparent to contracts by transferring the ED from the
    call origin to nonexistent accounts. Without this change, transfers to
    nonexistant accounts will transfer the supplied value minus the ED from
    the contracts viewpoint, and consequentially fail if the supplied value
    lies below the ED. Changing this behavior removes the need for contract
    code to handle this rather annoying corner case and aligns better with
    the EVM. The EVM charges a similar deposit from the gas meter, so
    transferring the ED from the call origin is practically the same as the
    call origin pays for gas.
    
    ---------
    
    Signed-off-by: default avatarxermicus <cyrill@parity.io>
    Signed-off-by: default avatarCyrill Leutwiler <bigcyrill@hotmail.com>
    Co-authored-by: command-bot <>
    Co-authored-by: default avatarGitHub Action <action@github.com>
    Co-authored-by: default avatarPG Herveou <pgherveou@gmail.com>
    Unverified
    d69a80e6
Code owners
Assign users and groups as approvers for specific file changes. Learn more.