mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
crypto: add support for blobs in eth_fillTransaction (#28839)
This commit is contained in:
parent
fabfcc7f6c
commit
727855752c
1 changed files with 39 additions and 0 deletions
|
|
@ -21,21 +21,60 @@ import (
|
|||
"embed"
|
||||
"errors"
|
||||
"hash"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
|
||||
)
|
||||
|
||||
//go:embed trusted_setup.json
|
||||
var content embed.FS
|
||||
|
||||
var (
|
||||
blobT = reflect.TypeOf(Blob{})
|
||||
commitmentT = reflect.TypeOf(Commitment{})
|
||||
proofT = reflect.TypeOf(Proof{})
|
||||
)
|
||||
|
||||
// Blob represents a 4844 data blob.
|
||||
type Blob [131072]byte
|
||||
|
||||
// UnmarshalJSON parses a blob in hex syntax.
|
||||
func (b *Blob) UnmarshalJSON(input []byte) error {
|
||||
return hexutil.UnmarshalFixedJSON(blobT, input, b[:])
|
||||
}
|
||||
|
||||
// MarshalText returns the hex representation of b.
|
||||
func (b Blob) MarshalText() ([]byte, error) {
|
||||
return hexutil.Bytes(b[:]).MarshalText()
|
||||
}
|
||||
|
||||
// Commitment is a serialized commitment to a polynomial.
|
||||
type Commitment [48]byte
|
||||
|
||||
// UnmarshalJSON parses a commitment in hex syntax.
|
||||
func (c *Commitment) UnmarshalJSON(input []byte) error {
|
||||
return hexutil.UnmarshalFixedJSON(commitmentT, input, c[:])
|
||||
}
|
||||
|
||||
// MarshalText returns the hex representation of c.
|
||||
func (c Commitment) MarshalText() ([]byte, error) {
|
||||
return hexutil.Bytes(c[:]).MarshalText()
|
||||
}
|
||||
|
||||
// Proof is a serialized commitment to the quotient polynomial.
|
||||
type Proof [48]byte
|
||||
|
||||
// UnmarshalJSON parses a proof in hex syntax.
|
||||
func (p *Proof) UnmarshalJSON(input []byte) error {
|
||||
return hexutil.UnmarshalFixedJSON(proofT, input, p[:])
|
||||
}
|
||||
|
||||
// MarshalText returns the hex representation of p.
|
||||
func (p Proof) MarshalText() ([]byte, error) {
|
||||
return hexutil.Bytes(p[:]).MarshalText()
|
||||
}
|
||||
|
||||
// Point is a BLS field element.
|
||||
type Point [32]byte
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue