Skip to content

Conversation

OlivierBBB
Copy link
Collaborator

No description provided.

@OlivierBBB OlivierBBB self-assigned this Jun 18, 2025
@OlivierBBB OlivierBBB added documentation Improvements or additions to documentation hardfork prague EIP's for the Pectra hardfork London to Prague London to Pectra labels Jun 18, 2025

- new transaction type `TYPE_4` flag
- new `IS_ACCOUNT_DELEGATION` phase
- new `ACCOUNT_DELEGATION_DATA` perspective, with columns named `deleg/XXX`
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure a delegation perspective is the best. It could be better to use the TMP colun in Computation perspective (as we do for DATA & Access List phase).


NOTE. The above requires the `TXN_DATA -> RLP_TXN` lookup to also provide `txn/SENDER_ADDRESS`.

## `RLP_TXN -> HUB` lookup
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need the reverse lookup as well ?

|-------------------------------------|-----------------------------------|
| source column | target column |
|-------------------------------------|-----------------------------------|
| 1 | hub.TX_DLGT |
Copy link
Contributor

Choose a reason for hiding this comment

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

as a source we could : should use IS_TYPE_4 column

|-------------------------------------|-----------------------------------|
| 1 | hub.TX_DLGT |
| rlp_txn.USER_TRANSACTION_NUMBER | hub.USER_TRANSACTION_NUMBER |
| rlp_txn.deleg/DELEGATION_INDEX | hub.acc/DELEGATION_INDEX | // is there a better way than introducing such a column ?
Copy link
Contributor

Choose a reason for hiding this comment

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

again, not sure about the beenfit of a delegate perspective ... I think it would be easier with the use of auxiliary columns in the COMP persp (as for ACCESS_LIST)

- even the "sender self delegation" rows
- every row triggers the lookup to `TRM` and to `RLP_ADDR`
- TRM: for obvious reasons (initial prc recognition)
- RLP_ADDR: in order that we may use this module to compute the `CODE_HASH_NEW`
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get this point, can you explain it please ?

Copy link
Collaborator Author

@OlivierBBB OlivierBBB Jun 19, 2025

Choose a reason for hiding this comment

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

We will need to compute the code hash of an account after delegation. If my memory is correct this is the hash of the concatenation 0xef0000 + delegation_address. What I propose is that this "byte code" not exist in the ROM module but instead only in the account perspective. But we need a way to hash it so I'm suggesting we use the rlp address module to do that since that module already has to do some hashing.

Typically have each and every account delegation be dealt with in a constant size block à la

```
ACCOUNT_DELEGATION_BLOCK ≡ {
Copy link
Contributor

Choose a reason for hiding this comment

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

reminder: the RLP_TXN should be responsible to provide the prover the selector columns for the keccak:
"The signature_y_parity, signature_r, signature_s elements of this transaction represent a secp256k1 signature over keccak256(SET_CODE_TX_TYPE || TransactionPayload)"

| EXTCODECOPY | YES | The simplest solution is likely to have two memory operations |
| | | |
| | | 1. write to a fresh new context with ID = HUB_STAMP the code |
| | | . which is simply 0x ef 00 00 <delegated_address> which occu- |
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: it's 0xEF0100

| | | 3. we do a `ramToRam` operation from the context with equal |
| | | . SRC_ID ≡ HUB_STAMP |
| | | . TGT_ID ≡ CONTEXT_NUMBER |
| | | . SRC_OFFSET = <magical_offset> |
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the magical offset ?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, I see with your diagramm below. It's because you MSTORE it instead of RAM_TO_RAM_SANS_PADDING to the virtual context. Why not simplify it with two ramToRam and no source/tgt offset ? It may be less efficient in MMU/MMIO, but easier to understand what we're doing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would also be acceptable. I suggested the above so that we may do it in a single MMU operation and without any byte decompositions in the MMIO.

Copy link
Collaborator Author

@OlivierBBB OlivierBBB Jun 19, 2025

Choose a reason for hiding this comment

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

The MODEXP pre-compile does something similar: when you copy over the results you start at offset zero, but the return data starts at offset 512 - mbs. It's the same idea here

| | | recipient (that is, μ_s[0].trim()) and delegatee warming |
| | | |
| | | We will also have to modify how we set the scenario, in parti- |
| | | cular how we recognize EOA's and SMC's. |
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if it would make sense to have new "delegated" scenarii

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what I'm trying to avoid actually.


We will need to send stuff to some hasher. It's easiest to do this for every `TX_DLGT` row. There are various options for where to do this.
One _could_ insert MISC rows between every account row. I don't like this.
One _could_ use the lookup to RLP_ADDR which we will also trigger, send the DELEGATION_ADDRESS, too, and also request the hashing of the 'code', that is the
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the RLP_ADDR option too

Copy link
Contributor

Choose a reason for hiding this comment

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

an other option is to delegate to RLP_TXN and add the CODE_HASH_NEW in the lookup. But I find it weird tbh. I prefer the direct RLP_ADDR way of doing


Likely a change: we may ask this module, which already hashes stuff, to hash for us the "code" of a delegated account, i.e. the 23 byte string

`0x ef 00 00 <delegated_address>`
Copy link
Contributor

Choose a reason for hiding this comment

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

0x ef 01 00 instead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation hardfork prague EIP's for the Pectra hardfork London to Prague London to Pectra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants