Skip to content

Commit 08e5bc0

Browse files
authored
feat: signature (transaction) types (#15)
* chore: add mainnet sig types * chore: add optimism and arbitrum sig types * feat: show signature types * fix: permalinks
1 parent c724f59 commit 08e5bc0

File tree

12 files changed

+346
-39
lines changed

12 files changed

+346
-39
lines changed

src/chains/arbitrum/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { arbitrum as arbitrumMetadata } from '@wagmi/chains';
22
import { Chain } from '@/chains';
3+
import { sortedArrayByField } from '@/lib/utils';
4+
import { signatureTypes } from './signatureTypes';
35
import { precompiles } from './vm/precompiles';
46

57
export const arbitrum: Chain = {
68
metadata: arbitrumMetadata,
79
precompiles,
10+
signatureTypes: sortedArrayByField(signatureTypes, 'prefixByte'),
811
};

src/chains/arbitrum/signatureTypes.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { SignatureType } from '@/chains';
2+
import { signatureTypes as mainnetSignatureTypes } from '@/chains/mainnet/signatureTypes';
3+
4+
const txTypeDocs = 'https://developer.arbitrum.io/arbos/geth#transaction-types';
5+
6+
const arbitrumDepositTx: SignatureType = {
7+
prefixByte: 0x64,
8+
description:
9+
"Represents a user deposit from L1 to L2. This increases the user's balance by the amount deposited on L1.",
10+
signedData: ['keccak256(0x64 || rlp([chainId, l1RequestId, from, to, value]))'],
11+
signs: 'transaction',
12+
references: [
13+
txTypeDocs,
14+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L48',
15+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L371-L377',
16+
],
17+
};
18+
19+
const arbitrumUnsignedTx: SignatureType = {
20+
prefixByte: 0x65,
21+
description:
22+
"A message from a user on L1 to a contract on L2 that uses the bridge for authentication instead of requiring the user's signature.",
23+
signedData: [
24+
'keccak256(0x65 || rlp([chainId, from, nonce, maxFeePerGas, gasLimit, to, value, data]))',
25+
],
26+
signs: 'transaction',
27+
references: [
28+
txTypeDocs,
29+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L49',
30+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L48-L58',
31+
],
32+
};
33+
34+
const arbitrumContractTx: SignatureType = {
35+
prefixByte: 0x66,
36+
description:
37+
"Similar to an `ArbitrumUnsignedTx` but intended for smart contracts. Uses the bridge's unique, sequential nonce rather than requiring the caller specify their own.",
38+
signedData: [
39+
'keccak256(0x66 || rlp([chainId, requestId, from, maxFeePerGas, gasLimit, to, value, data]))',
40+
],
41+
signs: 'transaction',
42+
references: [
43+
txTypeDocs,
44+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L50',
45+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L116-L126',
46+
],
47+
};
48+
49+
const arbitrumSubmitRetryableTx: SignatureType = {
50+
prefixByte: 0x69,
51+
description: 'A retryable submission and may schedule an ArbitrumRetryTx if provided enough gas.',
52+
signedData: [
53+
'keccak256(0x69 || rlp([chainId, requestId, from, l1BaseFee, depositValue, maxFeePerGas, gasLimit, retryTo, retryValue, beneficiary, maxSubmissionFee, feeRefundAddress, retryData]))',
54+
],
55+
signs: 'transaction',
56+
references: [
57+
txTypeDocs,
58+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L52',
59+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L258-L273',
60+
],
61+
};
62+
63+
const arbitrumRetryTx: SignatureType = {
64+
prefixByte: 0x68,
65+
description:
66+
'Transactions scheduled by calls to the redeem precompile method and via retryable auto-redemption.',
67+
signedData: [
68+
'keccak256(0x68 || rlp([chainId, nonce, from, maxFeePerGas, gasLimit, to, value, data, ticketId, refundTo, maxRefund, submissionFeeRefund]))',
69+
],
70+
signs: 'transaction',
71+
references: [
72+
txTypeDocs,
73+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L51',
74+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L180-L194',
75+
],
76+
};
77+
78+
const arbitrumInternalTx: SignatureType = {
79+
prefixByte: 0x6a,
80+
description: 'ArbOS-created transaction to update state between user-generated transactions.',
81+
signedData: ['keccak256(0x6a || rlp([chainId, data]))'],
82+
signs: 'transaction',
83+
references: [
84+
txTypeDocs,
85+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/transaction.go#L53',
86+
'https://github.com/OffchainLabs/go-ethereum/blob/dcd0ff9ad8b4c84a9456c6b37f9047233adf7181/core/types/arb_types.go#L424-L427',
87+
],
88+
};
89+
90+
const arbitrumLegacyTx: SignatureType = {
91+
prefixByte: 0x78,
92+
description: 'A legacy transaction',
93+
signedData: mainnetSignatureTypes[0x00].signedData,
94+
signs: 'transaction',
95+
references: [
96+
'https://github.com/OffchainLabs/go-ethereum/blob/a2132df21812259f604855f8ae399745fa9b6de6/core/types/transaction.go#L54',
97+
...mainnetSignatureTypes[0x00].references,
98+
],
99+
};
100+
101+
export const signatureTypes = {
102+
...mainnetSignatureTypes,
103+
...{ [arbitrumDepositTx.prefixByte]: arbitrumDepositTx },
104+
...{ [arbitrumUnsignedTx.prefixByte]: arbitrumUnsignedTx },
105+
...{ [arbitrumContractTx.prefixByte]: arbitrumContractTx },
106+
...{ [arbitrumSubmitRetryableTx.prefixByte]: arbitrumSubmitRetryableTx },
107+
...{ [arbitrumRetryTx.prefixByte]: arbitrumRetryTx },
108+
...{ [arbitrumInternalTx.prefixByte]: arbitrumInternalTx },
109+
...{ [arbitrumLegacyTx.prefixByte]: arbitrumLegacyTx },
110+
};

src/chains/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { arbitrum } from '@/chains/arbitrum';
22
import { mainnet } from '@/chains/mainnet';
33
import { optimism } from '@/chains/optimism';
44

5-
export type { Chain, Precompile, Predeploy } from '@/chains/types';
5+
export type { Chain, Precompile, Predeploy, SignatureType } from '@/chains/types';
66
export const chains = { arbitrum, mainnet, optimism };

src/chains/mainnet/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { mainnet as mainnetMetadata } from '@wagmi/chains';
22
import { Chain } from '@/chains';
3+
import { sortedArrayByField } from '@/lib/utils';
4+
import { signatureTypes } from './signatureTypes';
35
import { precompiles } from './vm/precompiles';
46

57
export const mainnet: Chain = {
68
metadata: mainnetMetadata,
79
precompiles,
10+
signatureTypes: sortedArrayByField(signatureTypes, 'prefixByte'),
811
};

src/chains/mainnet/signatureTypes.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { SignatureType } from '@/chains';
2+
3+
const eip2718 = 'https://eips.ethereum.org/EIPS/eip-2718';
4+
const sigTypes =
5+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/lists/signature-types/README.md';
6+
7+
// Some signature prefix bytes are invalid because they collide with the initial byte of valid RLP
8+
// encoded transactions. The range of invalid prefix bytes is 0xc0-0xff, which is a length of 64.
9+
const invalidSigTypes: SignatureType[] = [...Array(64).keys()].map((i) => ({
10+
prefixByte: i + 0xc0,
11+
description: 'Invalid; collides with the initial byte of valid RLP encoded transactions',
12+
signedData: undefined,
13+
signs: undefined,
14+
references: [sigTypes],
15+
}));
16+
17+
export const validSigTypes: SignatureType[] = [
18+
{
19+
prefixByte: 0x0,
20+
description: 'Legacy (untyped) transaction',
21+
signedData: [
22+
'keccak256(rlp([nonce, gasPrice, gasLimit, to, value, data]))',
23+
'keccak256(rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]))',
24+
],
25+
signs: 'transaction',
26+
references: ['https://eips.ethereum.org/EIPS/eip-155', eip2718, sigTypes],
27+
notes: [
28+
"When signing over chain ID, the signature's v-value is computed as `{0,1} + chainId * 2 + 35`, where 0 and 1 are signature's y-parity.",
29+
],
30+
},
31+
{
32+
prefixByte: 0x1,
33+
description: 'EIP-2930 Access list transaction',
34+
signedData: [
35+
'keccak256(0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList]))',
36+
],
37+
signs: 'transaction',
38+
references: ['https://eips.ethereum.org/EIPS/eip-2930', eip2718, sigTypes],
39+
},
40+
{
41+
prefixByte: 0x2,
42+
description: 'EIP-1559 transaction',
43+
signedData: [
44+
'keccak256(0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList]))',
45+
],
46+
signs: 'transaction',
47+
references: ['https://eips.ethereum.org/EIPS/eip-1559', eip2718, sigTypes],
48+
},
49+
{
50+
prefixByte: 0x3,
51+
description: 'Unused, but tentatively reserved for EIP-3074',
52+
signedData: ['keccak256(0x03 || chainId || paddedInvokerAddress || commit)'],
53+
signs: 'transaction',
54+
references: ['https://eips.ethereum.org/EIPS/eip-3074', eip2718, sigTypes],
55+
},
56+
{
57+
prefixByte: 0x19,
58+
description:
59+
'Used for signatures of data payloads to prevent collisions between data signatures and transaction signatures',
60+
signedData: ['keccak256(0x19 || 1-byte-version || versionSpecificData || dataToSign)'],
61+
signs: 'data',
62+
references: ['https://eips.ethereum.org/EIPS/eip-191', sigTypes],
63+
},
64+
...invalidSigTypes,
65+
];
66+
67+
const allSigTypes = [...validSigTypes, ...invalidSigTypes];
68+
69+
// Reshape into a map where the key is the prefix byte.
70+
export const signatureTypes: Record<number, SignatureType> = allSigTypes.reduce((acc, sigType) => {
71+
acc[sigType.prefixByte] = sigType;
72+
return acc;
73+
}, {} as Record<number, SignatureType>);

src/chains/mainnet/vm/precompiles.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export const precompiles: Precompile[] = [
4141
},
4242
],
4343
references: [
44-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/ecrecover.py',
45-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/gas.py#L50',
46-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L30',
44+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/ecrecover.py',
45+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/gas.py#L50',
46+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L30',
4747
],
4848
notes: [
4949
"If an address cannot be recovered, or not enough gas was given, then there is no return data. Note that the return data is the address that issued the signature but it won't verify the signature.",
@@ -71,9 +71,9 @@ export const precompiles: Precompile[] = [
7171
},
7272
],
7373
references: [
74-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/sha256.py',
75-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/gas.py#L51',
76-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L31',
74+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/sha256.py',
75+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/gas.py#L51',
76+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L31',
7777
],
7878
notes: ['If not enough gas was given, then there is no return data.'],
7979
},
@@ -99,9 +99,9 @@ export const precompiles: Precompile[] = [
9999
},
100100
],
101101
references: [
102-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/ripemd160.py',
103-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/gas.py#L53',
104-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L32',
102+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/ripemd160.py',
103+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/gas.py#L53',
104+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L32',
105105
],
106106
notes: ['If not enough gas was given, then there is no return data.'],
107107
},
@@ -127,9 +127,9 @@ export const precompiles: Precompile[] = [
127127
},
128128
],
129129
references: [
130-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/identity.py',
131-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/gas.py#L55',
132-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L33',
130+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/identity.py',
131+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/gas.py#L55',
132+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L33',
133133
],
134134
notes: [
135135
'If not enough gas was given, then there is no return data.',
@@ -188,9 +188,9 @@ export const precompiles: Precompile[] = [
188188
},
189189
],
190190
references: [
191-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/modexp.py',
192-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/modexp.py#L167',
193-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L34',
191+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/modexp.py',
192+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/modexp.py#L167',
193+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L34',
194194
],
195195
notes: ['If not enough gas was given, then there is no return data.'],
196196
},
@@ -240,9 +240,9 @@ export const precompiles: Precompile[] = [
240240
},
241241
],
242242
references: [
243-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L33',
244-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L45',
245-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L35',
243+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L33',
244+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L45',
245+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L35',
246246
],
247247
notes: [
248248
'If the input is not valid, or if not enough gas was given, then there is no return data.',
@@ -290,9 +290,9 @@ export const precompiles: Precompile[] = [
290290
},
291291
],
292292
references: [
293-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L72',
294-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L84',
295-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L36',
293+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L72',
294+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L84',
295+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L36',
296296
],
297297
notes: [
298298
'If the input is not valid, or if not enough gas was given, then there is no return data.',
@@ -354,9 +354,9 @@ export const precompiles: Precompile[] = [
354354
},
355355
],
356356
references: [
357-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L107',
358-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L119',
359-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L37',
357+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L107',
358+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/alt_bn128.py#L119',
359+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L37',
360360
],
361361
notes: [
362362
'The input must always be a multiple of 6 32-byte values. 0 inputs is valid and returns 1.',
@@ -414,9 +414,9 @@ export const precompiles: Precompile[] = [
414414
'Of the input does not allow to compute a valid result, all the gas sent is consumed.',
415415
],
416416
references: [
417-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/blake2f.py',
418-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/gas.py#L59',
419-
'https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L38',
417+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/blake2f.py',
418+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/gas.py#L59',
419+
'https://github.com/ethereum/execution-specs/blob/6f8614566e7117afa327ad054c3f4bfe19694d73/src/ethereum/shanghai/vm/precompiled_contracts/__init__.py#L38',
420420
],
421421
},
422422
];

src/chains/optimism/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { optimism as optimismMetadata } from '@wagmi/chains';
22
import { Chain } from '@/chains';
3+
import { sortedArrayByField } from '@/lib/utils';
4+
import { signatureTypes } from './signatureTypes';
35
import { precompiles } from './vm/precompiles';
46

57
export const optimism: Chain = {
68
metadata: optimismMetadata,
79
precompiles,
10+
signatureTypes: sortedArrayByField(signatureTypes, 'prefixByte'),
811
};

src/chains/optimism/signatureTypes.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { SignatureType } from '@/chains';
2+
import { signatureTypes as mainnetSignatureTypes } from '@/chains/mainnet/signatureTypes';
3+
4+
const depositTx: SignatureType = {
5+
prefixByte: 0x7e,
6+
description: 'An L2 transaction that was derived from L1 and included in a L2 block',
7+
signedData: [
8+
'keccak256(0x7E || rlp([sourceHash, from, to, mint, value, gas, isSystemTx, data]))',
9+
],
10+
signs: 'transaction',
11+
references: [
12+
'https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md#the-deposited-transaction-type',
13+
'https://github.com/ethereum-optimism/optimism/blob/develop/specs/glossary.md#deposited-transaction',
14+
],
15+
notes: [
16+
`There are two kinds of deposited transactions:
17+
- [L1 attributes deposited transaction][l1-attr-deposit], which submits the L1 block's attributes to the [L1 Attributes Predeployed Contract][l1-attr-predeploy].
18+
- [User-deposited transactions][user-deposited], which are transactions derived from an L1 call to the [deposit contract][deposit-contract].`,
19+
],
20+
};
21+
22+
export const signatureTypes = {
23+
...mainnetSignatureTypes,
24+
...{ [depositTx.prefixByte]: depositTx },
25+
};

0 commit comments

Comments
 (0)