Identity precompile — address 0x04. Returns its input bytes unchanged.
Gas schedule (Yellow Paper §E.2)
| Component | Cost |
|---|---|
| Base | 15 |
| Per word | 3 (one word = 32 bytes, rounded up) |
An empty input costs the 15-gas base with no word component.
Summary
Functions
Executes the identity precompile.
Functions
@spec execute(binary(), non_neg_integer()) :: {:ok, binary(), non_neg_integer()} | {:error, :out_of_gas}
Executes the identity precompile.
Returns the input bytes unchanged after verifying that the caller supplied
enough gas. Word count is ceil(byte_size(input) / 32).
Examples
iex> EEVM.Precompiles.Identity.execute(<<>>, 1_000)
{:ok, <<>>, 15}
iex> EEVM.Precompiles.Identity.execute(<<"hello">>, 1_000)
{:ok, <<"hello">>, 18}
iex> EEVM.Precompiles.Identity.execute(<<1::256>>, 5)
{:error, :out_of_gas}