Skip to content

Commit 73d9dca

Browse files
committed
update and proagate ssz signature scheme as well as authroization list
1 parent eb9ef75 commit 73d9dca

File tree

13 files changed

+479
-398
lines changed

13 files changed

+479
-398
lines changed

packages/block/src/from-beacon-payload.ts

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ export type BeaconAccessTupleV1 = {
4545
storage_keys: PrefixedHexString[] // Data 32 bytes MAX_ACCESS_LIST_STORAGE_KEYS array
4646
}
4747

48+
export type BeaconAuthorizationPayloadV1 = {
49+
magic: PrefixedHexString
50+
chain_id: PrefixedHexString
51+
address: PrefixedHexString
52+
nonce: PrefixedHexString
53+
}
54+
55+
export type BeaconExecutionSignatureV1 = {
56+
secp256k1: PrefixedHexString | null // DATA 65 bytes or null
57+
}
58+
59+
export type BeaconAuthorizationV1 = {
60+
payload: BeaconAuthorizationPayloadV1
61+
signature: BeaconExecutionSignatureV1
62+
}
63+
4864
export type BeaconTransactionPayloadV1 = {
4965
type: PrefixedHexString | null // Quantity, 1 byte
5066
chain_id: PrefixedHexString | null // Quantity 8 bytes
@@ -57,16 +73,12 @@ export type BeaconTransactionPayloadV1 = {
5773
access_list: BeaconAccessTupleV1[] | null
5874
max_priority_fees_per_gas: BeaconFeesPerGasV1 | null
5975
blob_versioned_hashes: PrefixedHexString[] | null // DATA 32 bytes array
60-
}
61-
62-
export type BeaconTransactionSignatureV1 = {
63-
from: PrefixedHexString | null // DATA 20 bytes
64-
ecdsa_signature: PrefixedHexString | null // DATA 65 bytes or null
76+
authorization_list: BeaconAuthorizationV1[] | null
6577
}
6678

6779
type BeaconTransactionV1 = {
6880
payload: BeaconTransactionPayloadV1
69-
signature: BeaconTransactionSignatureV1
81+
signature: BeaconExecutionSignatureV1
7082
}
7183

7284
// Payload json that one gets using the beacon apis
@@ -181,10 +193,22 @@ export function executionPayloadFromBeaconPayload(payload: BeaconPayloadJSON): E
181193
}) ?? null,
182194
maxPriorityFeesPerGas: btxv1.payload.max_priority_fees_per_gas,
183195
blobVersionedHashes: btxv1.payload.blob_versioned_hashes,
196+
authorizationList:
197+
btxv1.payload.authorization_list?.map((bal: BeaconAuthorizationV1) => {
198+
const { payload, signature } = bal
199+
return {
200+
payload: {
201+
magic: payload.magic,
202+
chainId: payload.chain_id,
203+
address: payload.address,
204+
nonce: payload.nonce,
205+
},
206+
signature,
207+
}
208+
}) ?? null,
184209
},
185210
signature: {
186-
from: btxv1.signature.from,
187-
ecdsaSignature: btxv1.signature.ecdsa_signature,
211+
secp256k1: btxv1.signature.secp256k1,
188212
},
189213
} as ssz.TransactionV1
190214
})

0 commit comments

Comments
 (0)