This commit is contained in:
Cassandra Heart 2024-02-19 21:59:38 -06:00 committed by GitHub
parent c96a3b7538
commit f8726882de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 24 deletions

View File

@ -678,24 +678,6 @@ func (p *PebbleClockStore) fillAggregateProofs(
frame.Filter, frame.Filter,
commit, commit,
frame.FrameNumber, frame.FrameNumber,
func(typeUrl string, data [][]byte) ([]byte, error) {
if typeUrl == protobufs.IntrinsicExecutionOutputType {
o := &protobufs.IntrinsicExecutionOutput{}
copiedLeft := make([]byte, len(data[0]))
copiedRight := make([]byte, len(data[1]))
copy(copiedLeft, data[0])
copy(copiedRight, data[1])
o.Address = copiedLeft[:32]
o.Output = copiedLeft[32:]
o.Proof = copiedRight
return proto.Marshal(o)
}
copied := make([]byte, len(data[0]))
copy(copied, data[0])
return copied, nil
},
) )
if err != nil { if err != nil {
return err return err

View File

@ -7,6 +7,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/crypto/sha3" "golang.org/x/crypto/sha3"
"google.golang.org/protobuf/proto"
"source.quilibrium.com/quilibrium/monorepo/node/protobufs" "source.quilibrium.com/quilibrium/monorepo/node/protobufs"
) )
@ -89,7 +90,6 @@ func internalGetAggregateProof(
filter []byte, filter []byte,
commitment []byte, commitment []byte,
frameNumber uint64, frameNumber uint64,
inclusionReassembler func(typeUrl string, data [][]byte) ([]byte, error),
) (*protobufs.InclusionAggregateProof, error) { ) (*protobufs.InclusionAggregateProof, error) {
value, closer, err := db.Get(dataProofMetadataKey(filter, commitment)) value, closer, err := db.Get(dataProofMetadataKey(filter, commitment))
if err != nil { if err != nil {
@ -169,9 +169,24 @@ func internalGetAggregateProof(
} }
} }
inclusionCommitment.Data, err = inclusionReassembler(string(url), chunks) if string(url) == protobufs.IntrinsicExecutionOutputType {
if err != nil { o := &protobufs.IntrinsicExecutionOutput{}
return nil, errors.Wrap(err, "get aggregate proof") copiedLeft := make([]byte, len(chunks[0]))
copiedRight := make([]byte, len(chunks[1]))
copy(copiedLeft, chunks[0])
copy(copiedRight, chunks[1])
o.Address = copiedLeft[:32]
o.Output = copiedLeft[32:]
o.Proof = copiedRight
inclusionCommitment.Data, err = proto.Marshal(o)
if err != nil {
return nil, errors.Wrap(err, "get aggregate proof")
}
} else {
copied := make([]byte, len(chunks[0]))
copy(copied, chunks[0])
inclusionCommitment.Data = copied
} }
aggregate.InclusionCommitments = append( aggregate.InclusionCommitments = append(
@ -192,14 +207,12 @@ func (p *PebbleDataProofStore) GetAggregateProof(
filter []byte, filter []byte,
commitment []byte, commitment []byte,
frameNumber uint64, frameNumber uint64,
inclusionReassembler func(typeUrl string, data [][]byte) ([]byte, error),
) (*protobufs.InclusionAggregateProof, error) { ) (*protobufs.InclusionAggregateProof, error) {
return internalGetAggregateProof( return internalGetAggregateProof(
p.db, p.db,
filter, filter,
commitment, commitment,
frameNumber, frameNumber,
inclusionReassembler,
) )
} }