Merge branch 'upstream_merge_v1.15.11' of https://github.com/maticnetwork/bor into v2.1.0-candidate

This commit is contained in:
Pratik Patil 2025-06-03 14:23:34 +05:30
commit 45ce0ee589
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
2 changed files with 10 additions and 6 deletions

View file

@ -1,5 +1,3 @@
// nolint
// Copyright 2014 The go-ethereum Authors // Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library. // This file is part of the go-ethereum library.
// //
@ -1164,19 +1162,25 @@ func (c *bls12381MapG2) Run(input []byte) ([]byte, error) {
} }
// kzgPointEvaluation implements the EIP-4844 point evaluation precompile. // kzgPointEvaluation implements the EIP-4844 point evaluation precompile.
//
//nolint:unused
type kzgPointEvaluation struct{} type kzgPointEvaluation struct{}
// RequiredGas estimates the gas required for running the point evaluation precompile. // RequiredGas estimates the gas required for running the point evaluation precompile.
//
//nolint:unused
func (b *kzgPointEvaluation) RequiredGas(input []byte) uint64 { func (b *kzgPointEvaluation) RequiredGas(input []byte) uint64 {
return params.BlobTxPointEvaluationPrecompileGas return params.BlobTxPointEvaluationPrecompileGas
} }
//nolint:unused
const ( const (
blobVerifyInputLength = 192 // Max input length for the point evaluation precompile. blobVerifyInputLength = 192 // Max input length for the point evaluation precompile.
blobCommitmentVersionKZG uint8 = 0x01 // Version byte for the point evaluation precompile. blobCommitmentVersionKZG uint8 = 0x01 // Version byte for the point evaluation precompile.
blobPrecompileReturnValue = "000000000000000000000000000000000000000000000000000000000000100073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001" blobPrecompileReturnValue = "000000000000000000000000000000000000000000000000000000000000100073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"
) )
//nolint:unused
var ( var (
errBlobVerifyInvalidInputLength = errors.New("invalid input length") errBlobVerifyInvalidInputLength = errors.New("invalid input length")
errBlobVerifyMismatchedVersion = errors.New("mismatched versioned hash") errBlobVerifyMismatchedVersion = errors.New("mismatched versioned hash")
@ -1184,6 +1188,8 @@ var (
) )
// Run executes the point evaluation precompile. // Run executes the point evaluation precompile.
//
//nolint:unused
func (b *kzgPointEvaluation) Run(input []byte) ([]byte, error) { func (b *kzgPointEvaluation) Run(input []byte) ([]byte, error) {
if len(input) != blobVerifyInputLength { if len(input) != blobVerifyInputLength {
return nil, errBlobVerifyInvalidInputLength return nil, errBlobVerifyInvalidInputLength
@ -1220,6 +1226,8 @@ func (b *kzgPointEvaluation) Run(input []byte) ([]byte, error) {
} }
// kZGToVersionedHash implements kzg_to_versioned_hash from EIP-4844 // kZGToVersionedHash implements kzg_to_versioned_hash from EIP-4844
//
//nolint:unused
func kZGToVersionedHash(kzg kzg4844.Commitment) common.Hash { func kZGToVersionedHash(kzg kzg4844.Commitment) common.Hash {
h := sha256.Sum256(kzg[:]) h := sha256.Sum256(kzg[:])
h[0] = blobCommitmentVersionKZG h[0] = blobCommitmentVersionKZG

View file

@ -331,10 +331,6 @@ func TestPrecompiledBLS12381Pairing(t *testing.T) { testJson("blsPairing", "f
func TestPrecompiledBLS12381MapG1(t *testing.T) { testJson("blsMapG1", "f0f", t) } func TestPrecompiledBLS12381MapG1(t *testing.T) { testJson("blsMapG1", "f0f", t) }
func TestPrecompiledBLS12381MapG2(t *testing.T) { testJson("blsMapG2", "f10", t) } func TestPrecompiledBLS12381MapG2(t *testing.T) { testJson("blsMapG2", "f10", t) }
func TestPrecompiledPointEvaluation(t *testing.T) { testJson("pointEvaluation", "0a", t) }
func BenchmarkPrecompiledPointEvaluation(b *testing.B) { benchJson("pointEvaluation", "0a", b) }
func BenchmarkPrecompiledBLS12381G1Add(b *testing.B) { benchJson("blsG1Add", "f0a", b) } func BenchmarkPrecompiledBLS12381G1Add(b *testing.B) { benchJson("blsG1Add", "f0a", b) }
func BenchmarkPrecompiledBLS12381G1MultiExp(b *testing.B) { benchJson("blsG1MultiExp", "f0b", b) } func BenchmarkPrecompiledBLS12381G1MultiExp(b *testing.B) { benchJson("blsG1MultiExp", "f0b", b) }
func BenchmarkPrecompiledBLS12381G2Add(b *testing.B) { benchJson("blsG2Add", "f0c", b) } func BenchmarkPrecompiledBLS12381G2Add(b *testing.B) { benchJson("blsG2Add", "f0c", b) }