~edwargix/tallyard

7b58ebf4fa78462ff4c5e0c96c8ee54815165de4 — David Florness 4 years ago ccb4824
Move version.go to root module

This isn't really specific to elections.
5 files changed, 14 insertions(+), 10 deletions(-)

M cmd/tallyard/main.go
M election/marshal_test.go
M election/msg.go
M election/voter.go
R election/version.go => version.go
M cmd/tallyard/main.go => cmd/tallyard/main.go +2 -1
@@ 13,6 13,7 @@ import (
	"maunium.net/go/mautrix"
	"maunium.net/go/mautrix/event"
	"maunium.net/go/mautrix/id"
	"tallyard.xyz"

	"tallyard.xyz/election"
	"tallyard.xyz/math"


@@ 204,7 205,7 @@ func debugEventHook(_ mautrix.EventSource, evt *event.Event) {
}

func setDeviceName(client *mautrix.Client, deviceID id.DeviceID) {
	displayName := fmt.Sprintf("tallyard %s", election.Version)
	displayName := fmt.Sprintf("tallyard %s", tallyard.Version)
	hostname, err := os.Hostname()
	if err == nil {
		log.Debugf("hostname: %s", hostname)

M election/marshal_test.go => election/marshal_test.go +2 -1
@@ 15,6 15,7 @@ import (
	"golang.org/x/crypto/nacl/box"
	"maunium.net/go/mautrix/event"
	"maunium.net/go/mautrix/id"
	"tallyard.xyz"
	"tallyard.xyz/math"
)



@@ 58,7 59,7 @@ func randomLocalVoter(t *testing.T) *LocalVoter {
		RoomID:    "room1",
		Content:   event.Content{
			Parsed: JoinElectionContent{
				Version:  Version,
				Version:  tallyard.Version,
				CreateID: "createID",
				Input:    base64.StdEncoding.EncodeToString(inputBytes[:]),
				PubKey:   base64.StdEncoding.EncodeToString((*pubKey)[:]),

M election/msg.go => election/msg.go +2 -1
@@ 18,6 18,7 @@ import (
	"maunium.net/go/mautrix"
	"maunium.net/go/mautrix/event"
	"maunium.net/go/mautrix/id"
	"tallyard.xyz"
	"tallyard.xyz/math"
)



@@ 223,7 224,7 @@ func logFuncs(baseFormat string) (error, warn, debug logfFunc) {
func incompatibleVersion(version string) bool {
	return semver.Compare(
		semver.MajorMinor(version),
		semver.MajorMinor(Version),
		semver.MajorMinor(tallyard.Version),
	) != 0
}


M election/voter.go => election/voter.go +7 -6
@@ 15,6 15,7 @@ import (
	"maunium.net/go/mautrix"
	"maunium.net/go/mautrix/event"
	"maunium.net/go/mautrix/id"
	"tallyard.xyz"
	"tallyard.xyz/math"
)



@@ 64,7 65,7 @@ func NewLocalVoter(voter *Voter, privKey *[32]byte) *LocalVoter {

func (elections *ElectionsMap) CreateElection(client *mautrix.Client, candidates []Candidate, title string, roomID id.RoomID) (*Election, error) {
	resp, err := client.SendMessageEvent(roomID, CreateElectionMessage, CreateElectionContent{
		Version:    Version,
		Version:    tallyard.Version,
		Candidates: candidates,
		Title:      title,
	})


@@ 98,7 99,7 @@ func (el *Election) JoinElection(client *mautrix.Client, eventStore *EventStore)
	}

	resp, err := client.SendMessageEvent(el.RoomID, JoinElectionMessage, JoinElectionContent{
		Version: Version,
		Version: tallyard.Version,

		CreateID: el.CreateEvt.ID,
		Input:    base64.StdEncoding.EncodeToString(inputBytes[:]),


@@ 148,7 149,7 @@ func (el *Election) StartElection(client *mautrix.Client, eventStore *EventStore
	}

	resp, err := client.SendMessageEvent(el.RoomID, StartElectionMessage, StartElectionContent{
		Version:  Version,
		Version:  tallyard.Version,
		CreateID: el.CreateEvt.ID,
		JoinIDs:  voters,
	})


@@ 225,7 226,7 @@ func (el *Election) SendProvingKeys(client *mautrix.Client, eventStore *EventSto
	}

	resp, err := client.SendMessageEvent(el.RoomID, KeysMessage, KeysMessageContent{
		Version:        Version,
		Version:        tallyard.Version,

		EvalProvingKeyURI: evalProvingKeyURI,
		JoinID:            el.LocalVoter.JoinEvt.ID,


@@ 311,7 312,7 @@ func (el *Election) SendEvals(client *mautrix.Client, eventStore *EventStore) er
	}

	resp, err := client.SendMessageEvent(el.RoomID, EvalsMessage, EvalsMessageContent{
		Version: Version,
		Version: tallyard.Version,

		Evals:   evals,
		JoinID:  el.LocalVoter.JoinEvt.ID,


@@ 398,7 399,7 @@ func (el *Election) SendSum(client *mautrix.Client, eventStore *EventStore) erro

	sumBytes := el.LocalVoter.Sum.Bytes()
	resp, err := client.SendMessageEvent(el.RoomID, SumMessage, SumMessageContent{
		Version:  Version,
		Version:  tallyard.Version,

		EvalsIDs: evalsIDs,
		JoinID:   el.LocalVoter.JoinEvt.ID,

R election/version.go => version.go +1 -1
@@ 1,3 1,3 @@
package election
package tallyard

const Version string = "v0.4.0"