Skip to content

Commit 976e05f

Browse files
committed
feat: export P256Verify precompile
1 parent e4220c7 commit 976e05f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

core/vm/contracts.libevm.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ import (
3131
"github.com/ava-labs/libevm/params"
3232
)
3333

34+
// P256Verify is a [PrecompiledContract] implementation of P-256 (secp256r1)
35+
// ECDSA verification, as defined by [EIP-7951].
36+
//
37+
// [EIP-7951]: https://eips.ethereum.org/EIPS/eip-7951
38+
type P256Verify struct {
39+
p256Verify
40+
}
41+
3442
// ActivePrecompiles returns the precompiles enabled with the current configuration.
3543
func ActivePrecompiles(rules params.Rules) []common.Address {
3644
orig := activePrecompiles(rules) // original, upstream implementation
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2025 the libevm authors.
2+
//
3+
// The libevm additions to go-ethereum are free software: you can redistribute
4+
// them and/or modify them under the terms of the GNU Lesser General Public License
5+
// as published by the Free Software Foundation, either version 3 of the License,
6+
// or (at your option) any later version.
7+
//
8+
// The libevm additions are distributed in the hope that they will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
11+
// General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU Lesser General Public License
14+
// along with the go-ethereum library. If not, see
15+
// <http://www.gnu.org/licenses/>.
16+
17+
package vm
18+
19+
import (
20+
"testing"
21+
22+
"github.com/ava-labs/libevm/common"
23+
)
24+
25+
func TestExportedP256Verify(t *testing.T) {
26+
addr := common.Address{'p', '2', '5', '6', 'l', 'i', 'b', 'e', 'v', 'm'}
27+
allPrecompiles[addr] = &P256Verify{}
28+
t.Cleanup(func() {
29+
delete(allPrecompiles, addr)
30+
})
31+
32+
testJson("p256verify", addr.Hex(), t)
33+
}

0 commit comments

Comments
 (0)