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

Feature/eip 3074 #6944

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7161102
start
ak88 Apr 9, 2024
b3c5a1e
AUTH opcode
ak88 Apr 18, 2024
8c87e72
more tests
ak88 Apr 22, 2024
e31d7e1
eip tests
ak88 Apr 22, 2024
6c1b526
more tests
ak88 Apr 23, 2024
a88a9a1
test for account access gas
ak88 Apr 23, 2024
f20dd96
Test authorized is unset if invalid sig
ak88 Apr 23, 2024
9813ba5
proper behavior for extra bytes
ak88 Apr 23, 2024
945fd55
6700 extra gas if authcall has value
ak88 Apr 23, 2024
8e45f17
Merge branch 'master' into feature/eip-3074
ak88 Apr 24, 2024
d67038c
separate method for AUTH
ak88 Apr 24, 2024
1381e54
simplify GetCallExecutionType
LukaszRozmej Apr 24, 2024
e41e2b2
Remove phantom fork timestamps
LukaszRozmej Apr 24, 2024
65f3d52
refactors
LukaszRozmej Apr 24, 2024
8820487
accountToDebit
LukaszRozmej Apr 24, 2024
eb0cfc4
whitespace
LukaszRozmej Apr 24, 2024
9321d26
refactorings
LukaszRozmej Apr 24, 2024
89f766a
small refactor
ak88 Apr 25, 2024
833f98a
Merge branch 'feature/eip-3074' of https://github.com/NethermindEth/n…
ak88 Apr 25, 2024
509e47b
more tests
ak88 Apr 25, 2024
463477b
check authorized for code
ak88 Apr 28, 2024
3b9465e
AUTHCALL gas cost tests
ak88 Apr 30, 2024
06b3f0a
OOG when gaslimit is higher than available
ak88 May 1, 2024
5fc13d7
small fix
ak88 May 1, 2024
1767023
fix
ak88 May 1, 2024
fd9b8e7
test fxes
ak88 May 1, 2024
04083ff
fix incorrect target
ak88 May 1, 2024
707364f
small naming refactor and test fix
ak88 May 1, 2024
1e4cc94
EXTCODESIZE check in AUTH instead
ak88 May 1, 2024
84d1f13
AUTH code check set failure
ak88 May 1, 2024
92f4a21
test no authorized in subcall
ak88 May 2, 2024
2528188
format whitespace
ak88 May 6, 2024
2b83051
remove test
ak88 May 6, 2024
92ea4f6
Merge branch 'master' into feature/eip-3074
ak88 May 6, 2024
669853c
invalid op test fix
ak88 May 6, 2024
94ea7a3
from review comments
ak88 May 8, 2024
ab5b9d4
gas cost fix
MarekM25 May 16, 2024
982643c
revert test changes
MarekM25 May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@
"eip4844TransitionTimestamp": "0x65F1B057",
"eip5656TransitionTimestamp": "0x65F1B057",
"eip6780TransitionTimestamp": "0x65F1B057",
//TODO correct this!
"eip3074TransitionTimestamp": "0x65F1B057",
LukaszRozmej marked this conversation as resolved.
Show resolved Hide resolved
"terminalTotalDifficulty": "C70D808A128D7380000"
},
"genesis": {
Expand Down
15 changes: 15 additions & 0 deletions src/Nethermind/Nethermind.Core/Eip3074Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

namespace Nethermind.Core;

/// <summary>
/// Represents the <see href="https://eips.ethereum.org/EIPS/eip-3074#constants">EIP-3074</see> parameters.
/// </summary>
public class Eip3074Constants
{
/// <summary>
/// Used to prevent signature collision with other signing formats
/// </summary>
public const byte AuthMagic = 0x04;
}
8 changes: 8 additions & 0 deletions src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ public interface IReleaseSpec : IEip1559Spec, IReceiptSpec
/// </summary>
bool IsEip6780Enabled { get; }

/// <summary>
/// https://eips.ethereum.org/EIPS/eip-3074
/// AUTH and AUTHCALL for EOA
/// </summary>
bool IsEip3074Enabled { get; }

/// <summary>
/// Should transactions be validated against chainId.
/// </summary>
Expand Down Expand Up @@ -361,5 +367,7 @@ public interface IReleaseSpec : IEip1559Spec, IReceiptSpec
public bool IsBeaconBlockRootAvailable => IsEip4788Enabled;
public bool MCopyIncluded => IsEip5656Enabled;
public bool BlobBaseFeeEnabled => IsEip4844Enabled;

bool AuthCallsEnabled => IsEip3074Enabled;
}
}
12 changes: 12 additions & 0 deletions src/Nethermind/Nethermind.Crypto/Ecdsa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using Nethermind.Core;
using System.Security.Cryptography;
using Nethermind.Core.Crypto;

namespace Nethermind.Crypto
Expand Down Expand Up @@ -48,6 +50,16 @@ public Signature Sign(PrivateKey privateKey, Hash256 message)
return signature;
}

public PublicKey? TryRecoverPublicKey(ReadOnlySpan<byte> r, ReadOnlySpan<byte> s, byte v, Hash256 message)
Copy link
Member

Choose a reason for hiding this comment

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

Not used?

{
if (v != 27 && v != 28)
{
return null;
}
Signature signature = new(r, s, v);
return RecoverPublicKey(signature, message);
}

public PublicKey? RecoverPublicKey(Signature signature, Hash256 message)
{
Span<byte> publicKey = stackalloc byte[65];
Expand Down