From b375357413ab260426c4ebba5a74713eae993dca Mon Sep 17 00:00:00 2001
From: Jono Wenger <jono@elixxir.io>
Date: Mon, 17 Oct 2022 10:49:40 -0700
Subject: [PATCH] Fix tests

---
 channels/eventModel.go         | 142 ++++++++++++++++---------------
 channels/eventModel_test.go    | 151 +++++++++++++++++----------------
 channels/joinedChannel_test.go |  50 +++++------
 3 files changed, 171 insertions(+), 172 deletions(-)

diff --git a/channels/eventModel.go b/channels/eventModel.go
index d94133577..05e31b536 100644
--- a/channels/eventModel.go
+++ b/channels/eventModel.go
@@ -36,7 +36,7 @@ const (
 	Failed
 )
 
-var AdminFakePubkey = ed25519.PublicKey{}
+var AdminFakePubKey = ed25519.PublicKey{}
 
 // EventModel is an interface which an external party which uses the channels
 // system passed an object which adheres to in order to get events on the
@@ -52,20 +52,20 @@ type EventModel interface {
 	// channel. It may be called multiple times on the same message. It is
 	// incumbent on the user of the API to filter such called by message ID.
 	//
-	// the api needs to return a uuid of the message which it may be
-	// referenced at a later time
+	// The API needs to return a UUID of the message that can be referenced at a
+	// later time.
 	//
-	// messageID, timestamp, and round are all nillable and may be updated
-	// based upon the UUID at a later date. A time of time.Time{} will be
-	// passed for a nilled timestamp.
+	// messageID, timestamp, and round are all nillable and may be updated based
+	// upon the UUID at a later date. A time of time.Time{} will be passed for a
+	// nilled timestamp.
 	//
-	// Nickname may be empty, in which case the UI is expected to display
-	// the codename
+	// Nickname may be empty, in which case the UI is expected to display the
+	// codename.
 	//
-	// Message type is included in the call, it will always be Text (1)
-	// for this call, but it may be required in downstream databases
+	// Message type is included in the call; it will always be Text (1) for this
+	// call, but it may be required in downstream databases.
 	ReceiveMessage(channelID *id.ID, messageID cryptoChannel.MessageID,
-		nickname, text string, pubkey ed25519.PublicKey, codeset uint8,
+		nickname, text string, pubKey ed25519.PublicKey, codeset uint8,
 		timestamp time.Time, lease time.Duration, round rounds.Round,
 		mType MessageType, status SentStatus) uint64
 
@@ -73,60 +73,60 @@ type EventModel interface {
 	// a given channel. It may be called multiple times on the same message. It
 	// is incumbent on the user of the API to filter such called by message ID.
 	//
-	// Messages may arrive our of order, so a reply in theory can arrive before
-	// the initial message. As a result, it may be important to buffer replies.
+	// Messages may arrive our of order, so a reply, in theory, can arrive
+	// before the initial message. As a result, it may be important to buffer
+	// replies.
 	//
-	// the api needs to return a uuid of the message which it may be
-	// referenced at a later time
+	// The API needs to return a UUID of the message that can be referenced at a
+	// later time.
 	//
-	// messageID, timestamp, and round are all nillable and may be updated
-	// based upon the UUID at a later date. A time of time.Time{} will be
-	// passed for a nilled timestamp.
+	// messageID, timestamp, and round are all nillable and may be updated based
+	// upon the UUID at a later date. A time of time.Time{} will be passed for a
+	// nilled timestamp.
 	//
-	// Nickname may be empty, in which case the UI is expected to display
-	// the codename
+	// Nickname may be empty, in which case the UI is expected to display the
+	// codename.
 	//
-	// Message type is included in the call, it will always be Text (1) for
-	// this call, but it may be required in downstream databases
+	// Message type is included in the call; it will always be Text (1) for this
+	// call, but it may be required in downstream databases.
 	ReceiveReply(channelID *id.ID, messageID cryptoChannel.MessageID,
 		reactionTo cryptoChannel.MessageID, nickname, text string,
-		pubkey ed25519.PublicKey, codeset uint8, timestamp time.Time,
+		pubKey ed25519.PublicKey, codeset uint8, timestamp time.Time,
 		lease time.Duration, round rounds.Round, mType MessageType,
 		status SentStatus) uint64
 
-	// ReceiveReaction is called whenever a reaction to a message is received
-	// on a given channel. It may be called multiple times on the same reaction.
-	// It is incumbent on the user of the API to filter such called by message
-	// ID.
+	// ReceiveReaction is called whenever a reaction to a message is received on
+	// a given channel. It may be called multiple times on the same reaction. It
+	// is incumbent on the user of the API to filter such called by message ID.
 	//
-	// Messages may arrive our of order, so a reply in theory can arrive before
-	// the initial message. As a result, it may be important to buffer
-	// reactions.
+	// Messages may arrive our of order, so a reply, in theory, can arrive
+	// before the initial message. As a result, it may be important to buffer
+	// replies.
 	//
-	// the api needs to return a uuid of the message which it may be
-	// referenced at a later time
+	// The API needs to return a UUID of the message that can be referenced at a
+	// later time.
 	//
-	// messageID, timestamp, and round are all nillable and may be updated
-	// based upon the UUID at a later date. A time of time.Time{} will be
-	// passed for a nilled timestamp.
+	// messageID, timestamp, and round are all nillable and may be updated based
+	// upon the UUID at a later date. A time of time.Time{} will be passed for a
+	// nilled timestamp.
 	//
-	// Nickname may be empty, in which case the UI is expected to display
-	// the codename
+	// Nickname may be empty, in which case the UI is expected to display the
+	// codename.
 	//
-	// Message type is included in the call, it will always be Reaction (3) for
-	// this call, but it may be required in downstream databases
+	// Message type is included in the call; it will always be Text (1) for this
+	// call, but it may be required in downstream databases.
 	ReceiveReaction(channelID *id.ID, messageID cryptoChannel.MessageID,
 		reactionTo cryptoChannel.MessageID, nickname, reaction string,
-		ipubkey ed25519.PublicKey, codeset uint8, timestamp time.Time,
+		pubKey ed25519.PublicKey, codeset uint8, timestamp time.Time,
 		lease time.Duration, round rounds.Round, mType MessageType,
 		status SentStatus) uint64
 
 	// UpdateSentStatus is called whenever the sent status of a message has
 	// changed.
 	//
-	// messageID, timestamp, and round are all nillable and may be updated
-	// based upon the UUID at a later date. A time of time.Time{} will be
-	// passed for a nilled timestamp. If a nil value is passed, make no update
+	// messageID, timestamp, and round are all nillable and may be updated based
+	// upon the UUID at a later date. A time of time.Time{} will be passed for a
+	// nilled timestamp. If a nil value is passed, make no update.
 	UpdateSentStatus(uuid uint64, messageID cryptoChannel.MessageID,
 		timestamp time.Time, round rounds.Round, status SentStatus)
 
@@ -139,13 +139,15 @@ type EventModel interface {
 
 // MessageTypeReceiveMessage defines handlers for messages of various message
 // types. Default ones for Text, Reaction, and AdminText.
-// A unique uuid must be returned by which the message can be referenced later
-// via UpdateSentStatus
+//
+// A unique UUID must be returned by which the message can be referenced later
+// via [EventModel.UpdateSentStatus].
+//
 // It must return a unique UUID for the message by which it can be referenced
-// later
+// later.
 type MessageTypeReceiveMessage func(channelID *id.ID,
 	messageID cryptoChannel.MessageID, messageType MessageType,
-	nickname string, content []byte, pubkey ed25519.PublicKey, codeset uint8,
+	nickname string, content []byte, pubKey ed25519.PublicKey, codeset uint8,
 	timestamp time.Time, lease time.Duration, round rounds.Round,
 	status SentStatus) uint64
 
@@ -208,8 +210,8 @@ type triggerEventFunc func(chID *id.ID, umi *userMessageInternal, ts time.Time,
 // reception on a message received from a user (symmetric encryption).
 //
 // It will call the appropriate MessageTypeHandler assuming one exists.
-func (e *events) triggerEvent(chID *id.ID, umi *userMessageInternal, ts time.Time,
-	receptionID receptionID.EphemeralIdentity, round rounds.Round,
+func (e *events) triggerEvent(chID *id.ID, umi *userMessageInternal,
+	ts time.Time, _ receptionID.EphemeralIdentity, round rounds.Round,
 	status SentStatus) (uint64, error) {
 	um := umi.GetUserMessage()
 	cm := umi.GetChannelMessage()
@@ -245,8 +247,8 @@ type triggerAdminEventFunc func(chID *id.ID, cm *ChannelMessage, ts time.Time,
 // It will call the appropriate MessageTypeHandler assuming one exists.
 func (e *events) triggerAdminEvent(chID *id.ID, cm *ChannelMessage,
 	ts time.Time, messageID cryptoChannel.MessageID,
-	receptionID receptionID.EphemeralIdentity, round rounds.Round,
-	status SentStatus) (uint64, error) {
+	_ receptionID.EphemeralIdentity, round rounds.Round, status SentStatus) (
+	uint64, error) {
 	messageType := MessageType(cm.PayloadType)
 
 	// check if the type is already registered
@@ -264,7 +266,7 @@ func (e *events) triggerAdminEvent(chID *id.ID, cm *ChannelMessage,
 
 	// Call the listener. This is already in an instanced event, no new thread needed.
 	uuid := listener(chID, messageID, messageType, AdminUsername, cm.Payload,
-		AdminFakePubkey, 0, ts,
+		AdminFakePubKey, 0, ts,
 		time.Duration(cm.Lease), round, status)
 	return uuid, nil
 }
@@ -277,7 +279,7 @@ func (e *events) triggerAdminEvent(chID *id.ID, cm *ChannelMessage,
 // write to the log.
 func (e *events) receiveTextMessage(channelID *id.ID,
 	messageID cryptoChannel.MessageID, messageType MessageType,
-	nickname string, content []byte, pubkey ed25519.PublicKey, codeset uint8,
+	nickname string, content []byte, pubKey ed25519.PublicKey, codeset uint8,
 	timestamp time.Time, lease time.Duration, round rounds.Round,
 	status SentStatus) uint64 {
 	txt := &CMIXChannelText{}
@@ -285,7 +287,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
 	if err := proto.Unmarshal(content, txt); err != nil {
 		jww.ERROR.Printf("Failed to text unmarshal message %s from %x on "+
 			"channel %s, type %s, ts: %s, lease: %s, round: %d: %+v",
-			messageID, pubkey, channelID, messageType, timestamp, lease,
+			messageID, pubKey, channelID, messageType, timestamp, lease,
 			round.ID, err)
 		return 0
 	}
@@ -296,20 +298,20 @@ func (e *events) receiveTextMessage(channelID *id.ID,
 			var replyTo cryptoChannel.MessageID
 			copy(replyTo[:], txt.ReplyMessageID)
 			return e.model.ReceiveReply(channelID, messageID, replyTo,
-				nickname, txt.Text, pubkey, codeset, timestamp, lease, round, Text, status)
+				nickname, txt.Text, pubKey, codeset, timestamp, lease, round, Text, status)
 
 		} else {
-			jww.ERROR.Printf("Failed process reply to for message %s from %s on "+
-				"channel %s, type %s, ts: %s, lease: %s, round: %d, returning "+
-				"without reply",
-				messageID, pubkey, codeset, channelID, messageType, timestamp, lease,
-				round.ID)
+			jww.ERROR.Printf("Failed process reply to for message %s from "+
+				"public key %v (codeset %d) on channel %s, type %s, ts: %s, "+
+				"lease: %s, round: %d, returning without reply",
+				messageID, pubKey, codeset, channelID, messageType, timestamp,
+				lease, round.ID)
 			// Still process the message, but drop the reply because it is
 			// malformed
 		}
 	}
 
-	return e.model.ReceiveMessage(channelID, messageID, nickname, txt.Text, pubkey, codeset,
+	return e.model.ReceiveMessage(channelID, messageID, nickname, txt.Text, pubKey, codeset,
 		timestamp, lease, round, Text, status)
 }
 
@@ -322,14 +324,14 @@ func (e *events) receiveTextMessage(channelID *id.ID,
 // reaction is dropped.
 func (e *events) receiveReaction(channelID *id.ID,
 	messageID cryptoChannel.MessageID, messageType MessageType,
-	nickname string, content []byte, pubkey ed25519.PublicKey, codeset uint8,
+	nickname string, content []byte, pubKey ed25519.PublicKey, codeset uint8,
 	timestamp time.Time, lease time.Duration, round rounds.Round,
 	status SentStatus) uint64 {
 	react := &CMIXChannelReaction{}
 	if err := proto.Unmarshal(content, react); err != nil {
 		jww.ERROR.Printf("Failed to text unmarshal message %s from %x on "+
 			"channel %s, type %s, ts: %s, lease: %s, round: %d: %+v",
-			messageID, pubkey, channelID, messageType, timestamp, lease,
+			messageID, pubKey, channelID, messageType, timestamp, lease,
 			round.ID, err)
 		return 0
 	}
@@ -339,7 +341,7 @@ func (e *events) receiveReaction(channelID *id.ID,
 		jww.ERROR.Printf("Failed process reaction %s from %x on channel "+
 			"%s, type %s, ts: %s, lease: %s, round: %d, due to malformed "+
 			"reaction (%s), ignoring reaction",
-			messageID, pubkey, channelID, messageType, timestamp, lease,
+			messageID, pubKey, channelID, messageType, timestamp, lease,
 			round.ID, err)
 		return 0
 	}
@@ -348,13 +350,13 @@ func (e *events) receiveReaction(channelID *id.ID,
 		var reactTo cryptoChannel.MessageID
 		copy(reactTo[:], react.ReactionMessageID)
 		return e.model.ReceiveReaction(channelID, messageID, reactTo, nickname,
-			react.Reaction, pubkey, codeset, timestamp, lease, round, Reaction, status)
+			react.Reaction, pubKey, codeset, timestamp, lease, round, Reaction, status)
 	} else {
-		jww.ERROR.Printf("Failed process reaction %s from %s on channel "+
-			"%s, type %s, ts: %s, lease: %s, round: %d, reacting to "+
-			"invalid message, ignoring reaction",
-			messageID, pubkey, codeset, channelID, messageType, timestamp, lease,
-			round.ID)
+		jww.ERROR.Printf("Failed process reaction %s from public key %v "+
+			"(codeset %d) on channel %s, type %s, ts: %s, lease: %s, "+
+			"round: %d, reacting to invalid message, ignoring reaction",
+			messageID, pubKey, codeset, channelID, messageType, timestamp,
+			lease, round.ID)
 	}
 	return 0
 }
diff --git a/channels/eventModel_test.go b/channels/eventModel_test.go
index 89f30f3ef..4edf780c4 100644
--- a/channels/eventModel_test.go
+++ b/channels/eventModel_test.go
@@ -9,6 +9,7 @@ package channels
 
 import (
 	"bytes"
+	"crypto/ed25519"
 	"fmt"
 	"github.com/golang/protobuf/proto"
 	"gitlab.com/elixxir/client/cmix/identity/receptionID"
@@ -47,18 +48,12 @@ func (m *MockEvent) getUUID() uint64 {
 	return old
 }
 
-func (m *MockEvent) UpdateSentStatus(uuid uint64, messageID cryptoChannel.MessageID,
-	timestamp time.Time, round rounds.Round, status SentStatus) {
-	//TODO implement me
-	panic("implement me")
-}
-
-func (*MockEvent) JoinChannel(channel *cryptoBroadcast.Channel) {}
-func (*MockEvent) LeaveChannel(channelID *id.ID)                {}
-func (m *MockEvent) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.MessageID,
-	nickname, text string, identity cryptoChannel.Identity,
-	timestamp time.Time, lease time.Duration, round rounds.Round,
-	mType MessageType, status SentStatus) uint64 {
+func (*MockEvent) JoinChannel(*cryptoBroadcast.Channel) {}
+func (*MockEvent) LeaveChannel(*id.ID)                  {}
+func (m *MockEvent) ReceiveMessage(channelID *id.ID,
+	messageID cryptoChannel.MessageID, nickname, text string,
+	_ ed25519.PublicKey, _ uint8, timestamp time.Time, lease time.Duration,
+	round rounds.Round, _ MessageType, _ SentStatus) uint64 {
 	m.eventReceive = eventReceive{
 		channelID:  channelID,
 		messageID:  messageID,
@@ -71,10 +66,10 @@ func (m *MockEvent) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.Mes
 	}
 	return m.getUUID()
 }
-func (m *MockEvent) ReceiveReply(channelID *id.ID, messageID cryptoChannel.MessageID,
-	reactionTo cryptoChannel.MessageID, nickname, text string,
-	identity cryptoChannel.Identity, timestamp time.Time,
-	lease time.Duration, round rounds.Round, mType MessageType, status SentStatus) uint64 {
+func (m *MockEvent) ReceiveReply(channelID *id.ID,
+	messageID cryptoChannel.MessageID, reactionTo cryptoChannel.MessageID,
+	nickname, text string, _ ed25519.PublicKey, _ uint8, timestamp time.Time,
+	lease time.Duration, round rounds.Round, _ MessageType, _ SentStatus) uint64 {
 	fmt.Println(reactionTo)
 	m.eventReceive = eventReceive{
 		channelID:  channelID,
@@ -88,10 +83,10 @@ func (m *MockEvent) ReceiveReply(channelID *id.ID, messageID cryptoChannel.Messa
 	}
 	return m.getUUID()
 }
-func (m *MockEvent) ReceiveReaction(channelID *id.ID, messageID cryptoChannel.MessageID,
-	reactionTo cryptoChannel.MessageID, nickname, reaction string,
-	identity cryptoChannel.Identity, timestamp time.Time,
-	lease time.Duration, round rounds.Round, mType MessageType, status SentStatus) uint64 {
+func (m *MockEvent) ReceiveReaction(channelID *id.ID,
+	messageID cryptoChannel.MessageID, reactionTo cryptoChannel.MessageID,
+	nickname, reaction string, _ ed25519.PublicKey, _ uint8, timestamp time.Time,
+	lease time.Duration, round rounds.Round, _ MessageType, _ SentStatus) uint64 {
 	m.eventReceive = eventReceive{
 		channelID:  channelID,
 		messageID:  messageID,
@@ -105,6 +100,12 @@ func (m *MockEvent) ReceiveReaction(channelID *id.ID, messageID cryptoChannel.Me
 	return m.getUUID()
 }
 
+func (m *MockEvent) UpdateSentStatus(uint64, cryptoChannel.MessageID,
+	time.Time, rounds.Round, SentStatus) {
+	// TODO implement me
+	panic("implement me")
+}
+
 func Test_initEvents(t *testing.T) {
 
 	me := &MockEvent{}
@@ -125,8 +126,8 @@ func Test_initEvents(t *testing.T) {
 	if len(e.registered) != 3 {
 		t.Errorf("The correct number of default handlers are not "+
 			"registered; %d vs %d", len(e.registered), 3)
-		//If this fails, is means the default handlers have changed. edit the
-		//number here and add tests below. be suspicious if it goes down.
+		// If this fails, is means the default handlers have changed. edit the
+		// number here and add tests below. be suspicious if it goes down.
 	}
 
 	if getFuncName(e.registered[Text]) != getFuncName(e.receiveTextMessage) {
@@ -147,7 +148,7 @@ func TestEvents_RegisterReceiveHandler(t *testing.T) {
 
 	e := initEvents(me)
 
-	//test that a new receive handler can be registered.
+	// Test that a new reception handler can be registered.
 	mt := MessageType(42)
 	err := e.RegisterReceiveHandler(mt, e.receiveReaction)
 	if err != nil {
@@ -155,20 +156,20 @@ func TestEvents_RegisterReceiveHandler(t *testing.T) {
 			"sucesfull: %+v", mt, err)
 	}
 
-	//check that it is written
+	// check that it is written
 	returnedHandler, exists := e.registered[mt]
 	if !exists {
 		t.Fatalf("Failed to get handler '%s' after registration", mt)
 	}
 
-	//check that the correct function is written
+	// check that the correct function is written
 	if getFuncName(e.receiveReaction) != getFuncName(returnedHandler) {
 		t.Fatalf("Failed to get correct handler for '%s' after "+
 			"registration, %s vs %s", mt, getFuncName(e.receiveReaction),
 			getFuncName(returnedHandler))
 	}
 
-	//test that writing to the same receive handler fails
+	// test that writing to the same receive handler fails
 	err = e.RegisterReceiveHandler(mt, e.receiveTextMessage)
 	if err == nil {
 		t.Fatalf("Failed to register '%s' when it should be "+
@@ -178,14 +179,14 @@ func TestEvents_RegisterReceiveHandler(t *testing.T) {
 			"tyle '%s': %+v", mt, err)
 	}
 
-	//check that it is still written
+	// check that it is still written
 	returnedHandler, exists = e.registered[mt]
 	if !exists {
 		t.Fatalf("Failed to get handler '%s' after second "+
 			"registration", mt)
 	}
 
-	//check that the correct function is written
+	// check that the correct function is written
 	if getFuncName(e.receiveReaction) != getFuncName(returnedHandler) {
 		t.Fatalf("Failed to get correct handler for '%s' after "+
 			"second registration, %s vs %s", mt, getFuncName(e.receiveReaction),
@@ -205,11 +206,11 @@ type dummyMessageTypeHandler struct {
 	round       rounds.Round
 }
 
-func (dmth *dummyMessageTypeHandler) dummyMessageTypeReceiveMessage(channelID *id.ID,
-	messageID cryptoChannel.MessageID, messageType MessageType,
-	nickname string, content []byte, identity cryptoChannel.Identity,
-	timestamp time.Time, lease time.Duration, round rounds.Round,
-	status SentStatus) uint64 {
+func (dmth *dummyMessageTypeHandler) dummyMessageTypeReceiveMessage(
+	channelID *id.ID, messageID cryptoChannel.MessageID,
+	messageType MessageType, nickname string, content []byte,
+	_ ed25519.PublicKey, _ uint8, timestamp time.Time, lease time.Duration,
+	round rounds.Round, _ SentStatus) uint64 {
 	dmth.triggered = true
 	dmth.channelID = channelID
 	dmth.messageID = messageID
@@ -229,7 +230,7 @@ func TestEvents_triggerEvents(t *testing.T) {
 
 	dummy := &dummyMessageTypeHandler{}
 
-	//register the handler
+	// register the handler
 	mt := MessageType(42)
 	err := e.RegisterReceiveHandler(mt, dummy.dummyMessageTypeReceiveMessage)
 	if err != nil {
@@ -237,7 +238,7 @@ func TestEvents_triggerEvents(t *testing.T) {
 			"%+v", err)
 	}
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -246,17 +247,17 @@ func TestEvents_triggerEvents(t *testing.T) {
 	r := rounds.Round{ID: 420, Timestamps: make(map[states.Round]time.Time)}
 	r.Timestamps[states.QUEUED] = netTime.Now()
 
-	//call the trigger
+	// call the trigger
 	_, err = e.triggerEvent(chID, umi, netTime.Now(), receptionID.EphemeralIdentity{}, r, Delivered)
 	if err != nil {
 		t.Fatalf(err.Error())
 	}
-	//check that the event was triggered
+	// check that the event was triggered
 	if !dummy.triggered {
 		t.Errorf("The event was not triggered")
 	}
 
-	//check the data is stored in the dummy
+	// check the data is stored in the dummy
 	if !dummy.channelID.Cmp(chID) {
 		t.Errorf("The channel IDs do not match %s vs %s",
 			dummy.channelID, chID)
@@ -305,10 +306,10 @@ func TestEvents_triggerEvents_noChannel(t *testing.T) {
 
 	dummy := &dummyMessageTypeHandler{}
 
-	//skip handler registration
+	// skip handler registration
 	mt := MessageType(1)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -317,13 +318,13 @@ func TestEvents_triggerEvents_noChannel(t *testing.T) {
 	r := rounds.Round{ID: 420, Timestamps: make(map[states.Round]time.Time)}
 	r.Timestamps[states.QUEUED] = netTime.Now()
 
-	//call the trigger
+	// call the trigger
 	_, err := e.triggerEvent(chID, umi, netTime.Now(), receptionID.EphemeralIdentity{}, r, Delivered)
 	if err != nil {
 		t.Fatalf(err.Error())
 	}
 
-	//check that the event was triggered
+	// check that the event was triggered
 	if dummy.triggered {
 		t.Errorf("The event was triggered when it is unregistered")
 	}
@@ -336,7 +337,7 @@ func TestEvents_triggerAdminEvents(t *testing.T) {
 
 	dummy := &dummyMessageTypeHandler{}
 
-	//register the handler
+	// register the handler
 	mt := MessageType(42)
 	err := e.RegisterReceiveHandler(mt, dummy.dummyMessageTypeReceiveMessage)
 	if err != nil {
@@ -344,7 +345,7 @@ func TestEvents_triggerAdminEvents(t *testing.T) {
 			"%+v", err)
 	}
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -355,19 +356,19 @@ func TestEvents_triggerAdminEvents(t *testing.T) {
 
 	msgID := cryptoChannel.MakeMessageID(u.userMessage.Message, chID)
 
-	//call the trigger
+	// call the trigger
 	_, err = e.triggerAdminEvent(chID, cm, netTime.Now(), msgID, receptionID.EphemeralIdentity{}, r,
 		Delivered)
 	if err != nil {
 		t.Fatalf(err.Error())
 	}
 
-	//check that the event was triggered
+	// check that the event was triggered
 	if !dummy.triggered {
 		t.Errorf("The admin event was not triggered")
 	}
 
-	//check the data is stored in the dummy
+	// check the data is stored in the dummy
 	if !dummy.channelID.Cmp(chID) {
 		t.Errorf("The channel IDs do not match %s vs %s",
 			dummy.channelID, chID)
@@ -417,9 +418,9 @@ func TestEvents_triggerAdminEvents_noChannel(t *testing.T) {
 	dummy := &dummyMessageTypeHandler{}
 
 	mt := MessageType(1)
-	//skip handler registration
+	// skip handler registration
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -430,14 +431,14 @@ func TestEvents_triggerAdminEvents_noChannel(t *testing.T) {
 
 	msgID := cryptoChannel.MakeMessageID(u.userMessage.Message, chID)
 
-	//call the trigger
+	// call the trigger
 	_, err := e.triggerAdminEvent(chID, cm, netTime.Now(), msgID, receptionID.EphemeralIdentity{}, r,
 		Delivered)
 	if err != nil {
 		t.Fatalf(err.Error())
 	}
 
-	//check that the event was triggered
+	// check that the event was triggered
 	if dummy.triggered {
 		t.Errorf("The admin event was triggered when unregistered")
 	}
@@ -448,7 +449,7 @@ func TestEvents_receiveTextMessage_Message(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -480,11 +481,11 @@ func TestEvents_receiveTextMessage_Message(t *testing.T) {
 	r := rounds.Round{ID: 420, Timestamps: make(map[states.Round]time.Time)}
 	r.Timestamps[states.QUEUED] = netTime.Now()
 
-	//call the handler
+	// call the handler
 	e.receiveTextMessage(chID, msgID, 0, senderNickname,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if !me.eventReceive.channelID.Cmp(chID) {
 		t.Errorf("Channel ID did not propogate correctly, %s vs %s",
 			me.eventReceive.channelID, chID)
@@ -526,7 +527,7 @@ func TestEvents_receiveTextMessage_Reply(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -560,11 +561,11 @@ func TestEvents_receiveTextMessage_Reply(t *testing.T) {
 		t.Fatalf(err.Error())
 	}
 
-	//call the handler
+	// call the handler
 	e.receiveTextMessage(chID, msgID, Text, senderUsername,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if !me.eventReceive.channelID.Cmp(chID) {
 		t.Errorf("Channel ID did not propogate correctly, %s vs %s",
 			me.eventReceive.channelID, chID)
@@ -606,7 +607,7 @@ func TestEvents_receiveTextMessage_Reply_BadReply(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -640,11 +641,11 @@ func TestEvents_receiveTextMessage_Reply_BadReply(t *testing.T) {
 		t.Fatalf(err.Error())
 	}
 
-	//call the handler
+	// call the handler
 	e.receiveTextMessage(chID, msgID, 0, senderUsername,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if !me.eventReceive.channelID.Cmp(chID) {
 		t.Errorf("Channel ID did not propogate correctly, %s vs %s",
 			me.eventReceive.channelID, chID)
@@ -686,7 +687,7 @@ func TestEvents_receiveReaction(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -720,11 +721,11 @@ func TestEvents_receiveReaction(t *testing.T) {
 		t.Fatalf(err.Error())
 	}
 
-	//call the handler
+	// call the handler
 	e.receiveReaction(chID, msgID, 0, senderUsername,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if !me.eventReceive.channelID.Cmp(chID) {
 		t.Errorf("Channel ID did not propogate correctly, %s vs %s",
 			me.eventReceive.channelID, chID)
@@ -766,7 +767,7 @@ func TestEvents_receiveReaction_InvalidReactionMessageID(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -800,11 +801,11 @@ func TestEvents_receiveReaction_InvalidReactionMessageID(t *testing.T) {
 		t.Fatalf(err.Error())
 	}
 
-	//call the handler
+	// call the handler
 	e.receiveReaction(chID, msgID, 0, senderUsername,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if me.eventReceive.channelID != nil {
 		t.Errorf("Channel ID did propogated correctly when the reaction " +
 			"is bad")
@@ -836,7 +837,7 @@ func TestEvents_receiveReaction_InvalidReactionContent(t *testing.T) {
 
 	e := initEvents(me)
 
-	//craft the input for the event
+	// craft the input for the event
 	chID := &id.ID{}
 	chID[0] = 1
 
@@ -869,11 +870,11 @@ func TestEvents_receiveReaction_InvalidReactionContent(t *testing.T) {
 	if err != nil {
 		t.Fatalf(err.Error())
 	}
-	//call the handler
+	// call the handler
 	e.receiveReaction(chID, msgID, 0, senderUsername,
-		textMarshaled, pi.Identity, ts, lease, r, Delivered)
+		textMarshaled, pi.PubKey, pi.CodesetVersion, ts, lease, r, Delivered)
 
-	//check the results on the model
+	// check the results on the model
 	if me.eventReceive.channelID != nil {
 		t.Errorf("Channel ID did propogated correctly when the reaction " +
 			"is bad")
diff --git a/channels/joinedChannel_test.go b/channels/joinedChannel_test.go
index e3bee24de..e5a0899c6 100644
--- a/channels/joinedChannel_test.go
+++ b/channels/joinedChannel_test.go
@@ -9,6 +9,7 @@ package channels
 
 import (
 	"bytes"
+	"crypto/ed25519"
 	"encoding/binary"
 	"gitlab.com/elixxir/client/broadcast"
 	clientCmix "gitlab.com/elixxir/client/cmix"
@@ -591,11 +592,10 @@ func (m *mockBroadcastClient) AddIdentity(*id.ID, time.Time, bool)
 func (m *mockBroadcastClient) AddService(*id.ID, message.Service, message.Processor) {}
 func (m *mockBroadcastClient) DeleteClientService(*id.ID)                            {}
 func (m *mockBroadcastClient) RemoveIdentity(*id.ID)                                 {}
-func (m *mockBroadcastClient) GetRoundResults(timeout time.Duration,
-	roundCallback clientCmix.RoundEventCallback, roundList ...id.Round) {
+func (m *mockBroadcastClient) GetRoundResults(time.Duration, clientCmix.RoundEventCallback, ...id.Round) {
 }
-func (m *mockBroadcastClient) AddHealthCallback(f func(bool)) uint64 { return 0 }
-func (m *mockBroadcastClient) RemoveHealthCallback(uint64)           {}
+func (m *mockBroadcastClient) AddHealthCallback(func(bool)) uint64 { return 0 }
+func (m *mockBroadcastClient) RemoveHealthCallback(uint64)         {}
 
 ////////////////////////////////////////////////////////////////////////////////
 // Mock EventModel                                                            //
@@ -611,33 +611,29 @@ type mockEventModel struct {
 	leftCh   *id.ID
 }
 
-func (m *mockEventModel) UpdateSentStatus(uuid uint64, messageID cryptoChannel.MessageID,
-	timestamp time.Time, round rounds.Round, status SentStatus) {
-	//TODO implement me
-	panic("implement me")
-}
+func (m *mockEventModel) JoinChannel(c *cryptoBroadcast.Channel) { m.joinedCh = c }
+func (m *mockEventModel) LeaveChannel(c *id.ID)                  { m.leftCh = c }
 
-func (m *mockEventModel) JoinChannel(c *cryptoBroadcast.Channel) {
-	m.joinedCh = c
-}
-func (m *mockEventModel) LeaveChannel(c *id.ID) {
-	m.leftCh = c
-}
-func (m *mockEventModel) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.MessageID,
-	nickname, text string, identity cryptoChannel.Identity,
-	timestamp time.Time, lease time.Duration, round rounds.Round,
-	mType MessageType, status SentStatus) uint64 {
+func (m *mockEventModel) ReceiveMessage(*id.ID, cryptoChannel.MessageID, string,
+	string, ed25519.PublicKey, uint8, time.Time, time.Duration, rounds.Round,
+	MessageType, SentStatus) uint64 {
 	return 0
 }
-func (m *mockEventModel) ReceiveReply(channelID *id.ID, messageID cryptoChannel.MessageID,
-	reactionTo cryptoChannel.MessageID, nickname, text string,
-	identity cryptoChannel.Identity, timestamp time.Time,
-	lease time.Duration, round rounds.Round, mType MessageType, status SentStatus) uint64 {
+
+func (m *mockEventModel) ReceiveReply(*id.ID, cryptoChannel.MessageID,
+	cryptoChannel.MessageID, string, string, ed25519.PublicKey, uint8,
+	time.Time, time.Duration, rounds.Round, MessageType, SentStatus) uint64 {
 	return 0
 }
-func (m *mockEventModel) ReceiveReaction(channelID *id.ID, messageID cryptoChannel.MessageID,
-	reactionTo cryptoChannel.MessageID, nickname, reaction string,
-	identity cryptoChannel.Identity, timestamp time.Time,
-	lease time.Duration, round rounds.Round, mType MessageType, status SentStatus) uint64 {
+
+func (m *mockEventModel) ReceiveReaction(*id.ID, cryptoChannel.MessageID,
+	cryptoChannel.MessageID, string, string, ed25519.PublicKey, uint8,
+	time.Time, time.Duration, rounds.Round, MessageType, SentStatus) uint64 {
 	return 0
 }
+
+func (m *mockEventModel) UpdateSentStatus(uint64, cryptoChannel.MessageID,
+	time.Time, rounds.Round, SentStatus) {
+	// TODO implement me
+	panic("implement me")
+}
-- 
GitLab