Skip to content
Snippets Groups Projects
Unverified Commit 1063d3f6 authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

Upgrade dRNG with drand v1.1.1 (#700)

* :arrow_up: Upgrade drand dependencies

* :sparkles: Enable dRNG beacon livefeed

* :recycle: Refactor dRNG API

* :white_check_mark: Update dRNG integration test
parent 733cf67e
No related branches found
No related tags found
No related merge requests found
Showing
with 867 additions and 67 deletions
......@@ -19,7 +19,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......@@ -54,7 +54,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......@@ -88,7 +88,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......@@ -123,7 +123,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......@@ -159,7 +159,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......@@ -195,7 +195,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:latest
docker pull gaiadocker/iproute2:latest
......@@ -229,7 +229,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:latest
docker pull gaiadocker/iproute2:latest
......@@ -263,7 +263,7 @@ jobs:
- name: Pull additional Docker images
run: |
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:latest
docker pull gaiadocker/iproute2:latest
......
......@@ -4,10 +4,11 @@ go 1.14
require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/dchest/blake2b v1.0.0 // indirect
github.com/dgraph-io/badger/v2 v2.0.3
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/drand/drand v0.8.1
github.com/drand/kyber v1.0.1-0.20200331114745-30e90cc60f99
github.com/drand/drand v1.1.1
github.com/drand/kyber v1.1.2
github.com/gin-gonic/gin v1.6.3
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/gobuffalo/packr/v2 v2.8.0
......@@ -18,8 +19,9 @@ require (
github.com/labstack/gommon v0.3.0
github.com/magiconair/properties v1.8.1
github.com/mr-tron/base58 v1.2.0
github.com/nikkolasg/slog v0.0.0-20170921200349-3c8d441d7a1e // indirect
github.com/panjf2000/ants/v2 v2.4.1
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.0
github.com/shirou/gopsutil v2.20.5+incompatible
github.com/spf13/pflag v1.0.5
......@@ -31,7 +33,6 @@ require (
go.uber.org/atomic v1.6.0
go.uber.org/zap v1.15.0
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect
golang.org/x/tools v0.0.0-20200330040139-fa3cc9eebcfe // indirect
google.golang.org/grpc v1.30.0
google.golang.org/grpc/examples v0.0.0-20200617041141-9a465503579e // indirect
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ import (
"crypto/sha512"
"errors"
"github.com/drand/drand/beacon"
"github.com/drand/drand/chain"
"github.com/drand/drand/key"
"github.com/iotaledger/goshimmer/packages/binary/drng/state"
"github.com/iotaledger/goshimmer/packages/binary/drng/subtypes/collectivebeacon/events"
......@@ -106,7 +106,7 @@ func verifySignature(data *events.CollectiveBeaconEvent) error {
return err
}
msg := beacon.Message(data.Round, data.PrevSignature)
msg := chain.Message(data.Round, data.PrevSignature)
if err := key.Scheme.VerifyRecovered(dpk, msg, data.Signature); err != nil {
return err
......
......@@ -5,7 +5,7 @@ import (
"log"
"testing"
"github.com/drand/drand/beacon"
"github.com/drand/drand/chain"
"github.com/drand/drand/key"
"github.com/drand/kyber/share"
"github.com/drand/kyber/util/random"
......@@ -118,7 +118,7 @@ func dkgShares(t *testing.T, n, threshold int) *payload.Payload {
err = key.Scheme.VerifyRecovered(pubPoly.Commit(), msg, sig)
require.NoError(t, err)
msg = beacon.Message(1, sig)
msg = chain.Message(1, sig)
sigs = make([][]byte, n)
// partial signatures
for i := 0; i < n; i++ {
......
......@@ -16,6 +16,7 @@ import {Explorer404} from "app/components/Explorer404";
import {Faucet} from "app/components/Faucet";
import {Neighbors} from "app/components/Neighbors";
import {Visualizer} from "app/components/Visualizer";
import {Drng} from "app/components/Drng";
interface Props {
history: any;
......@@ -60,6 +61,11 @@ export class Root extends React.Component<Props, any> {
Visualizer
</Nav.Link>
</LinkContainer>
<LinkContainer to="/drng">
<Nav.Link>
dRNG beacon
</Nav.Link>
</LinkContainer>
<LinkContainer to="/faucet">
<Nav.Link>
Faucet
......@@ -81,6 +87,7 @@ export class Root extends React.Component<Props, any> {
<Route exact path="/explorer/message/:id" component={ExplorerMessageQueryResult}/>
<Route exact path="/explorer/address/:id" component={ExplorerAddressQueryResult}/>
<Route exact path="/explorer/404/:search" component={Explorer404}/>
<Route exact path="/drng" component={Drng}/>
<Route exact path="/explorer" component={Explorer}/>
<Route exact path="/visualizer" component={Visualizer}/>
<Route exact path="/faucet" component={Faucet}/>
......
This diff is collapsed.
package committee
import (
"encoding/hex"
"net/http"
"github.com/iotaledger/goshimmer/plugins/drng"
"github.com/iotaledger/hive.go/crypto/ed25519"
"github.com/labstack/echo"
"github.com/mr-tron/base58"
)
// Handler returns the current DRNG committee used.
func Handler(c echo.Context) error {
committee := drng.Instance().State.Committee()
identities := []string{}
for _, pk := range committee.Identities {
identities = append(identities, base58.Encode(pk[:]))
}
return c.JSON(http.StatusOK, Response{
InstanceID: committee.InstanceID,
Threshold: committee.Threshold,
Identities: committee.Identities,
DistributedPK: committee.DistributedPK,
Identities: identities,
DistributedPK: hex.EncodeToString(committee.DistributedPK),
})
}
......@@ -23,7 +28,7 @@ func Handler(c echo.Context) error {
type Response struct {
InstanceID uint32 `json:"instanceID,omitempty"`
Threshold uint8 `json:"threshold,omitempty"`
Identities []ed25519.PublicKey `json:"identities,omitempty"`
DistributedPK []byte `json:"distributedPK,omitempty"`
Identities []string `json:"identities,omitempty"`
DistributedPK string `json:"distributedPK,omitempty"`
Error string `json:"error,omitempty"`
}
......@@ -6,7 +6,7 @@ echo "Build GoShimmer image"
docker build -t iotaledger/goshimmer ../../.
echo "Pull additional Docker images"
docker pull angelocapossele/drand:latest
docker pull angelocapossele/drand:1.1.1
docker pull gaiaadm/pumba:0.7.2
docker pull gaiadocker/iproute2:latest
......
......@@ -142,7 +142,7 @@ func (d *DockerContainer) CreateDrandMember(name string, goShimmerAPI string, le
}
env = append(env, "GOSHIMMER=http://"+goShimmerAPI)
containerConfig := &container.Config{
Image: "angelocapossele/drand:latest",
Image: "angelocapossele/drand:1.1.1",
ExposedPorts: nat.PortSet{
nat.Port("8000/tcp"): {},
},
......
......@@ -7,6 +7,7 @@ import (
"time"
"github.com/docker/docker/client"
"github.com/drand/drand/net"
"github.com/iotaledger/hive.go/crypto/ed25519"
"github.com/iotaledger/hive.go/identity"
)
......@@ -139,8 +140,12 @@ func (n *DRNGNetwork) WaitForDKG() error {
defer log.Printf("Waiting for DKG... done\n")
for i := dkgMaxTries; i > 0; i-- {
if dkey, err := n.members[0].Client.DistKey(n.members[0].name+":8000", false); err == nil {
n.SetDistKey(dkey.Key)
if chainInfo, err := n.members[0].Client.ChainInfo(net.CreatePeer(n.members[0].name+":8000", false)); err == nil {
distKey, err := chainInfo.PublicKey.MarshalBinary()
if err != nil {
return err
}
n.SetDistKey(distKey)
log.Printf("DistKey: %v", hex.EncodeToString(n.distKey))
return nil
}
......
......@@ -8,7 +8,7 @@ require (
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.4.0 // indirect
github.com/drand/drand v0.9.1
github.com/drand/drand v1.1.1
github.com/iotaledger/goshimmer v0.1.3
github.com/iotaledger/hive.go v0.0.0-20200810103552-94bbf59c54fa
github.com/mr-tron/base58 v1.2.0
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment