Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-7708: Provide more details and add fee payments #9003

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions EIPS/eip-7708.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,42 @@ Logs are often used to track when balance changes of assets on Ethereum. Logs wo

## Specification

### Parameters
### ETH transfer logs

* `MAGIC`: `TBD`
A log, identical to a LOG3, is issued for:

### Functionality
- Any transaction (including zero-value-transferring), before any other logs created by EVM execution
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rationale being that something still happened on the wallet that may be of interest to the user. This is only on the outermost call.

- Any nonzero-value `CALL`, at the time that the value transfer executes
- Any nonzero-value-transferring `SELFDESTRUCT`, at the time that the value transfer executes

Whenever (i) a nonzero-value `CALL`, (ii) a nonzero-value-transferring `SELFDESTRUCT`, or (iii) a nonzero-value-transferring transaction takes place, issue a log, identical to a LOG3, with three topics: (i) `MAGIC`, (ii) the sender address, (iii) the recipient address. The log data is a big-endian 32-byte encoding of the transfer value.
| Field | Value |
| - | - |
| `address` | `0xfffffffffffffffffffffffffffffffffffffffe` ([`SYSTEM_ADDRESS`](./eip-4788.md)) |
| `topics[0]` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` (`keccak256('Transfer(address,address,uint256)')`) |
| `topics[1]` | `from` address (zero prefixed to fill uint256) |
| `topics[2]` | `to` address (zero prefixed to fill uint256) |
| `data` | `amount` in Wei (big endian uint256) |

The `LOG` of a value-transferring transaction should be placed before any logs created by EVM execution. The other two `LOG`s are placed at the time that the value transfer executes.
### Fee payment logs

A log, identical to a LOG2, is issued for every transaction and appended after all other logs created by EVM execution. The fee amount incorporates the total fee charged during transaction execution, including the base fee, the priority fee, and potential blob fees.

| Field | Value |
| - | - |
| `address` | `0xfffffffffffffffffffffffffffffffffffffffe` ([`SYSTEM_ADDRESS`](./eip-4788.md)) |
| `topics[0]` | `0x7bd3aa7d673767f759ebf216e7f6c12844986c661ae6e0f1d988cf7eb7394d1d` (`keccak256('Fee(address,uint256)')`) |
| `topics[1]` | `from` address (zero prefixed to fill uint256) |
| `data` | `amount` in Wei (big endian uint256) |

## Rationale

This is the simplest possible implementation that ensures that all ETH transfers are implemented in some kind of record that can be easily accessed through making RPC calls into a node, or through asking for a Merkle branch that is hashed into the block root. The log type is compatible with the ERC-20 token standard, but does not introduce any overly-specific ERC-20 features (eg. ABI encodings) into the specification.

### Open questions

1. Should withdrawals also trigger a log? If so, what should the sender address be specified as?
2. Should fee payments trigger a log? It would ensure "completeness", in the sense that you can compute the exact current balance table by watching logs, but it would greatly increase the number of logs, perhaps to an unacceptably high amount.
1. Magic value used for `address` and `topics[0]`?
2. Should fee payments trigger a log? It would ensure "completeness", in the sense that you can compute the exact current balance table by watching logs, but it would greatly increase the number of logs, perhaps to an unacceptably high amount. The extra disk space required for two extra logs per transaction could be covered by removing logs bloom filters with [EIP-7668](./eip-7668.md).
3. Should withdrawals also trigger a log? They are not associated with transactions.

## Backwards Compatibility

Expand Down
Loading