Skip to content

Commit d11df9c

Browse files
committed
Auth list in RPC
1 parent fc45531 commit d11df9c

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

src/Nethermind/Nethermind.Core/Transaction.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class Transaction
4646
public bool SupportsAccessList => Type >= TxType.AccessList && Type != TxType.DepositTx;
4747
public bool Supports1559 => Type >= TxType.EIP1559 && Type != TxType.DepositTx;
4848
public bool SupportsBlobs => Type == TxType.Blob && Type != TxType.DepositTx;
49+
public bool SupportsAuthorizationList => Type == TxType.SetCode && Type != TxType.DepositTx;
4950
public long GasLimit { get; set; }
5051
public Address? To { get; set; }
5152
public UInt256 Value { get; set; }
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
2+
// SPDX-License-Identifier: LGPL-3.0-only
3+
4+
using Nethermind.Core;
5+
using Nethermind.Core.Eip2930;
6+
using Nethermind.Evm.Tracing.GethStyle.Custom.JavaScript;
7+
using Nethermind.Int256;
8+
using System.Collections.Generic;
9+
using System.Linq;
10+
using System.Text.Json.Serialization;
11+
12+
namespace Nethermind.Facade.Eth
13+
{
14+
public struct AuthorizationTupleForRpc
15+
{
16+
[JsonConstructor]
17+
public AuthorizationTupleForRpc()
18+
{
19+
}
20+
public AuthorizationTupleForRpc(UInt256 chainId, ulong nonce, Address address, UInt256? yParity, UInt256? s, UInt256? r)
21+
{
22+
ChainId = chainId;
23+
Nonce = nonce;
24+
Address = address;
25+
YParity = yParity;
26+
S = s;
27+
R = r;
28+
}
29+
30+
public UInt256 ChainId { get; set; }
31+
public ulong Nonce { get; set; }
32+
public Address Address { get; set; }
33+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
34+
public UInt256? YParity { get; set; }
35+
public UInt256? S { get; set; }
36+
public UInt256? R { get; set; }
37+
38+
public static IEnumerable<AuthorizationTupleForRpc> FromAuthorizationList(AuthorizationTuple[] authorizationList) =>
39+
authorizationList.Select(tuple => new AuthorizationTupleForRpc(tuple.ChainId,
40+
tuple.Nonce,
41+
tuple.CodeAddress,
42+
tuple.AuthoritySignature.RecoveryId,
43+
new UInt256(tuple.AuthoritySignature.S),
44+
new UInt256(tuple.AuthoritySignature.R)));
45+
}
46+
}

src/Nethermind/Nethermind.Facade/Eth/TransactionForRpc.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ public TransactionForRpc(Hash256? blockHash, long? blockNumber, int? txIndex, Tr
6161
{
6262
AccessList = null;
6363
}
64+
if (transaction.SupportsAuthorizationList)
65+
{
66+
AuthorizationList = transaction.AuthorizationList is null ? Array.Empty<AuthorizationTupleForRpc>() : AuthorizationTupleForRpc.FromAuthorizationList(transaction.AuthorizationList);
67+
}
68+
else
69+
{
70+
AuthorizationList = null;
71+
}
6472
MaxFeePerBlobGas = transaction.MaxFeePerBlobGas;
6573
BlobVersionedHashes = transaction.BlobVersionedHashes;
6674

@@ -126,6 +134,7 @@ public TransactionForRpc() { }
126134
public TxType Type { get; set; }
127135

128136
public IEnumerable<AccessListItemForRpc>? AccessList { get; set; }
137+
public IEnumerable<AuthorizationTupleForRpc>? AuthorizationList{ get; set; }
129138

130139
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
131140
public UInt256? MaxFeePerBlobGas { get; set; } // eip4844

0 commit comments

Comments
 (0)