ethereum.forks.bpo5.vm.precompiled_contracts.identityethereum.forks.amsterdam.vm.precompiled_contracts.identity

Ethereum Virtual Machine (EVM) IDENTITY PRECOMPILED CONTRACT.

.. contents:: Table of Contents :backlinks: none :local:

Introduction

Implementation of the IDENTITY precompiled contract.

identity

Writes the message data to output.

Parameters

evm : The current EVM frame.

def identity(​evm: Evm​) -> None:
24
    <snip>
32
    data = evm.message.data
33
    data = evm.call_data
34
35
    # GAS
36
    word_count = ceil32(ulen(data)) // Uint(32)
37
    charge_gas(
38
        evm,
38
        GasCosts.PRECOMPILE_IDENTITY_BASE
39
        + GasCosts.PRECOMPILE_IDENTITY_PER_WORD * word_count,
39
        ExecutionGas(
40
            GasCosts.PRECOMPILE_IDENTITY_BASE
41
            + GasCosts.PRECOMPILE_IDENTITY_PER_WORD * word_count
42
        ),
43
    )
44
45
    # OPERATION
46
    evm.output = data