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

EIP-4844: Implement SignedBlobTransaction and validation #1416

Closed
jangko opened this issue Jan 11, 2023 · 0 comments · Fixed by #1440
Closed

EIP-4844: Implement SignedBlobTransaction and validation #1416

jangko opened this issue Jan 11, 2023 · 0 comments · Fixed by #1440

Comments

@jangko
Copy link
Contributor

jangko commented Jan 11, 2023

Besides add new fields to Transaction type, accompanying ssz encode and decode must be implemented.
They should be implemented in nim-eth.

then additional validation must be added:
tx.payload.len <= MAX_CALLDATA_SIZE = 2 ** 24
tx.accessList.len <= MAX_ACCESS_LIST_SIZE = 2 ** 24
tx.accessList[n].storageKeys.len <= MAX_ACCESS_LIST_STORAGE_KEYS = 2 ** 24
tx.blobVersionedHashes.len <= MAX_VERSIONED_HASHES_LIST_SIZE = 2 ** 24

The signature is verified and tx.origin is calculated as follows:

def unsigned_tx_hash(tx: SignedBlobTransaction) -> Bytes32:
    # The pre-image is prefixed with the transaction-type to avoid hash collisions with other tx hashers and types
    return keccak256(BLOB_TX_TYPE + ssz.serialize(tx.message))

def get_origin(tx: SignedBlobTransaction) -> Address:
    sig = tx.signature
    # v = int(y_parity) + 27, same as EIP-1559
    return ecrecover(unsigned_tx_hash(tx), int(sig.y_parity)+27, sig.r, sig.s)

The hash of a signed blob transaction should be computed as:

def signed_tx_hash(tx: SignedBlobTransaction) -> Bytes32:
    return keccak256(BLOB_TX_TYPE + ssz.serialize(tx))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant