Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion api.go → common/api.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"context"
Expand Down
6 changes: 3 additions & 3 deletions blacklist.go → common/blacklist.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"encoding/binary"
Expand Down Expand Up @@ -66,11 +66,11 @@ func (bl *Blacklist) String() string {
"Blacklist(nodeCount=%d, SuspectedNodes=[%s], updates=[%s])",
bl.NodeCount,
strings.Join(sn, ","),
blacklistUpdatesAsString(bl.Updates), // helper receives array
BlacklistUpdatesAsString(bl.Updates), // helper receives array
)
}

func blacklistUpdatesAsString(updates []BlacklistUpdate) string {
func BlacklistUpdatesAsString(updates []BlacklistUpdate) string {
out := make([]string, len(updates))
for i, u := range updates {
out[i] = u.String()
Expand Down
2 changes: 1 addition & 1 deletion blacklist_test.go → common/blacklist_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"crypto/rand"
Expand Down
2 changes: 1 addition & 1 deletion encoding.go → common/encoding.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion encoding_test.go → common/encoding_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"crypto/rand"
Expand Down
2 changes: 1 addition & 1 deletion global.go → common/global.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"bytes"
Expand Down
5 changes: 3 additions & 2 deletions global_test.go → common/global_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/require"
)

func TestNodeIDs(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion metadata.go → common/metadata.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion metadata_test.go → common/metadata_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"crypto/rand"
Expand Down
6 changes: 1 addition & 5 deletions msg.go → common/msg.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"bytes"
Expand Down Expand Up @@ -357,10 +357,6 @@ type VerifiedFinalizedBlock struct {
Finalization Finalization
}

type verifiableMessage interface {
Verify() error
}

type BlockDigestRequest struct {
Seq uint64
Digest Digest
Expand Down
52 changes: 26 additions & 26 deletions msg_test.go → common/msg_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package simplex_test
package common_test

import (
"testing"

"github.com/ava-labs/simplex"
"github.com/ava-labs/simplex/common"
"github.com/ava-labs/simplex/testutil"

"github.com/stretchr/testify/require"
Expand All @@ -12,18 +12,18 @@ import (
func TestQuorumRoundMalformed(t *testing.T) {
tests := []struct {
name string
qr simplex.QuorumRound
qr common.QuorumRound
expectedErr bool
}{
{
name: "empty notarization",
qr: simplex.QuorumRound{
EmptyNotarization: &simplex.EmptyNotarization{},
qr: common.QuorumRound{
EmptyNotarization: &common.EmptyNotarization{},
},
expectedErr: false,
}, {
name: "all nil",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
EmptyNotarization: nil,
Block: nil,
Notarization: nil,
Expand All @@ -32,71 +32,71 @@ func TestQuorumRoundMalformed(t *testing.T) {
expectedErr: true,
}, {
name: "block and notarization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
Notarization: &simplex.Notarization{},
Notarization: &common.Notarization{},
},
expectedErr: false,
}, {
name: "block and finalization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
Finalization: &simplex.Finalization{},
Finalization: &common.Finalization{},
},
expectedErr: false,
}, {
name: "block and empty notarization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
EmptyNotarization: &simplex.EmptyNotarization{},
EmptyNotarization: &common.EmptyNotarization{},
},
expectedErr: true,
},
{
name: "block and notarization and finalization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
Notarization: &simplex.Notarization{},
Finalization: &simplex.Finalization{},
Notarization: &common.Notarization{},
Finalization: &common.Finalization{},
},
expectedErr: false,
},
{
name: "notarization and no block",
qr: simplex.QuorumRound{
Notarization: &simplex.Notarization{},
qr: common.QuorumRound{
Notarization: &common.Notarization{},
},
expectedErr: true,
},
{
name: "finalization and no block",
qr: simplex.QuorumRound{
Finalization: &simplex.Finalization{},
qr: common.QuorumRound{
Finalization: &common.Finalization{},
},
expectedErr: true,
},
{
name: "just block",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
},
expectedErr: true,
},
{
name: "block and notarization and empty notarization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
Notarization: &simplex.Notarization{},
EmptyNotarization: &simplex.EmptyNotarization{},
Notarization: &common.Notarization{},
EmptyNotarization: &common.EmptyNotarization{},
},
expectedErr: false,
},
{
name: "block and finalization and empty notarization",
qr: simplex.QuorumRound{
qr: common.QuorumRound{
Block: &testutil.TestBlock{},
Finalization: &simplex.Finalization{},
EmptyNotarization: &simplex.EmptyNotarization{},
Finalization: &common.Finalization{},
EmptyNotarization: &common.EmptyNotarization{},
},
expectedErr: false,
},
Expand Down
2 changes: 1 addition & 1 deletion notarization.go → common/notarization.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package simplex
package common

import (
"bytes"
Expand Down
Loading
Loading