feat(specs): add spec for address Appearance#456
feat(specs): add spec for address Appearance#456perama-v wants to merge 6 commits intoethereum:mainfrom
Conversation
|
I'll copy in my responses from our discord chat: tjayrush | TrueBlocks.io — Today at 5:37 PM It actually does. It has to. We use 99999 and move backwards for non-transactions appearances. Not perfect, but we didn't want to grow the data by adding another field. tjayrush | TrueBlocks.io — Today at 5:43 PM All the benefits you point to (an appearance always having both block number and transaction id, globally (at least per-chain) uniqueness, small size, etc.) is preserved with a sentinal like 99999. (Or some other sentinal known not to clash with transaction id for regular transactions.) |
|
The use of sentinel values is compelling and tentatively looks viable for client implementations.
Spec has been updated to include "miner", "uncles", "withdrawals" and "alloc" (for prefund/genesis) as valid values for extra-transaction appearances. Self-destruct included as an intra-transaction appearance (SELFDESTRUCT opcode "address" field). The rationale is that while destruction occurs at the end of the transaction, it is still activated in the EVM. |
|
A note for implementation if transactions are represented with a global counter across all blocks: Suppose each transaction is a u32, the upper bits can be used for extra-block appearances. Bits could indicate: intra-transaction, withdrawals, miner, uncles, alloc. If flags are used but the first bit is unset, then no-intra-transaction appearance occurred. This is just an example not part of the spec or implementation. Edit: alloc (genesis address recipient) is always in the first block, so a field is not likely to be required. |
I may be mis-remembering, but at one point I thought a transaction like this: (This has both the creation of and the self destruction of a contract in the same transaction.) Did something weird like send the funds to the smart contract to itself. I'm not sure this is correct, but I remember something. |
|
Yes that is a good example. The addresses involved in this transaction would both be considered to appear. The appearance is transaction 5 block 2608034. So this can safely be classified as intra-transaction. |
Adds a specification of an address "appearance".
Motivation
Appearance are a common concept used by different proposed methods (
eth_getAddressesInblock,address_getAppearances)Extraction of the definition as a separate PR simplifies those efforts.
Overview
If a transaction is an appearance for a particular address, it implies that the transaction may be "of interest" for
that address. An inventory of such transactions represents a set of transactions relevant to an address.
The concept is originally introduced by the UnchainedIndex https://github.com/TrueBlocks/trueblocks-core.