diff --git a/cli/dvoting/mod_test.go b/cli/dvoting/mod_test.go index 50db80155..08919672f 100644 --- a/cli/dvoting/mod_test.go +++ b/cli/dvoting/mod_test.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "encoding/base64" "fmt" "io" "net" @@ -14,6 +15,7 @@ import ( "time" "github.com/stretchr/testify/require" + "go.dedis.ch/kyber/v3/pairing/bn256" ) func TestDvoting_Main(t *testing.T) { @@ -61,7 +63,7 @@ func TestDvoting_Scenario_SetupAndTransactions(t *testing.T) { shareCert(t, node3, node1, "//127.0.0.1:2111") shareCert(t, node5, node1, "//127.0.0.1:2111") - // Setup the chain with nodes 1 and 2. + // Set up the chain with nodes 1 and 2. args := append(append( append( []string{os.Args[0], "--config", node1, "ordering", "setup"}, @@ -85,7 +87,26 @@ func TestDvoting_Scenario_SetupAndTransactions(t *testing.T) { err = run(args) require.NoError(t, err) + // Add the certificate and push two new blocks to make sure node4 is + // fully participating + shareCert(t, node4, node1, "//127.0.0.1:2111") + publicKey, err := bn256.NewSuiteG2().Point().MarshalBinary() + require.NoError(t, err) + publicKeyHex := base64.StdEncoding.EncodeToString(publicKey) + argsAccess := []string{ + os.Args[0], + "--config", node1, "access", "add", + "--identity", publicKeyHex, + } + for i := 0; i < 2; i++ { + err = runWithCfg(argsAccess, config{}) + require.NoError(t, err) + } + // Add node 5 which should be participating. + // This makes sure that node 4 is actually participating and caught up. + // If node 4 is not participating, there would be too many faulty nodes + // after adding node 5. args = append([]string{ os.Args[0], "--config", node1, "ordering", "roster", "add", @@ -96,10 +117,10 @@ func TestDvoting_Scenario_SetupAndTransactions(t *testing.T) { err = run(args) require.NoError(t, err) - // Run a few transactions. - for i := 0; i < 5; i++ { - err = runWithCfg(args, config{}) - require.EqualError(t, err, "command error: transaction refused: duplicate in roster: grpcs://127.0.0.1:2115") + // Run 2 new transactions + for i := 0; i < 2; i++ { + err = runWithCfg(argsAccess, config{}) + require.NoError(t, err) } // Test a timeout waiting for a transaction. diff --git a/go.mod b/go.mod index 39d0b330f..01a0b65dc 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( ) replace ( - go.dedis.ch/dela => github.com/c4dt/dela v0.0.0-20231121144634-18760d54394e + go.dedis.ch/dela => github.com/c4dt/dela v0.0.0-20231208150034-8c94bd32e18a go.dedis.ch/dela-apps => github.com/c4dt/dela-apps v0.0.0-20231121155105-f3a8a6f4b3b8 ) diff --git a/go.sum b/go.sum index fb0d8ce8c..ae3aa5eab 100644 --- a/go.sum +++ b/go.sum @@ -399,8 +399,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/c4dt/dela v0.0.0-20231121144634-18760d54394e h1:fziIs5dB/cYete4q4FveEefw0i4gbhbSjkTTJrfd4hQ= -github.com/c4dt/dela v0.0.0-20231121144634-18760d54394e/go.mod h1:Oh/WK8JMO0POQg7nR3u436u+HwsZwPqPzDWAasgmFAU= +github.com/c4dt/dela v0.0.0-20231208150034-8c94bd32e18a h1:MU7JHdKZssVjSeQttHPPa4fUMwqEO/xBQpdQ15H/AUo= +github.com/c4dt/dela v0.0.0-20231208150034-8c94bd32e18a/go.mod h1:Oh/WK8JMO0POQg7nR3u436u+HwsZwPqPzDWAasgmFAU= github.com/c4dt/dela-apps v0.0.0-20231121155105-f3a8a6f4b3b8 h1:ELho4tnVG7lM3c2I42Q5IGNyuk/2FQCterA2zVQGvms= github.com/c4dt/dela-apps v0.0.0-20231121155105-f3a8a6f4b3b8/go.mod h1:Rky9YH7R02zSOirr2BhhdJs/9VH4+rxqkQxHU3UTQRA= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=