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

Generate Warp Signatures #1818

Merged
merged 37 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
joshua-kim committed Dec 2, 2024
commit fc3724460b8b3b8ffd7281cf00dad8b44f4d48f0
10 changes: 0 additions & 10 deletions x/dsmr/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var (
ErrInvalidBlockHeight = errors.New("invalid block height")
ErrInvalidBlockTimestamp = errors.New("invalid block timestamp")
ErrInvalidWarpSignature = errors.New("invalid warp signature")
ErrDuplicateChunkCert = errors.New("duplicate chunk cert")
)

type Validator struct {
Expand Down Expand Up @@ -281,15 +280,6 @@ func (n *Node[T]) Verify(ctx context.Context, parent Block, block Block) error {
}

for _, chunkCert := range block.ChunkCerts {
_, ok, err := n.storage.GetChunkBytes(chunkCert.Expiry, chunkCert.ChunkID)
if err != nil && !errors.Is(err, database.ErrNotFound) {
return fmt.Errorf("failed to get chunk: %w", err)
}

if ok {
return fmt.Errorf("%w: %s", ErrDuplicateChunkCert, chunkCert.ChunkID)
}

if err := chunkCert.Verify(
joshua-kim marked this conversation as resolved.
Show resolved Hide resolved
ctx,
n.networkID,
Expand Down
12 changes: 0 additions & 12 deletions x/dsmr/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,18 +1188,6 @@ func Test_Verify_BadBlock(t *testing.T) {
},
wantErr: ErrInvalidBlockTimestamp,
},
{
name: "duplicate chunk cert",
blk: func(_ ChunkCertificate, parent Block) Block {
return Block{
ParentID: parent.GetID(),
Height: parent.Height + 1,
Timestamp: parent.Timestamp + 1,
ChunkCerts: parent.ChunkCerts,
}
},
wantErr: ErrDuplicateChunkCert,
},
{
name: "nil chunk certs",
blk: func(_ ChunkCertificate, parent Block) Block {
Expand Down
2 changes: 1 addition & 1 deletion x/dsmr/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (s *ChunkStorage[T]) GatherChunkCerts() []*ChunkCertificate {

chunkCerts := make([]*ChunkCertificate, 0, len(s.chunkMap))
for _, chunk := range s.chunkMap {
if chunk.Cert == nil {
if chunk.Cert == nil || chunk.Available {
continue
}
chunkCerts = append(chunkCerts, chunk.Cert)
Expand Down
Loading