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
4 changes: 2 additions & 2 deletions components/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/iotaledger/wasp/v2/components/cache"
"github.com/iotaledger/wasp/v2/components/chains"
"github.com/iotaledger/wasp/v2/components/database"
distkeygen "github.com/iotaledger/wasp/v2/components/distkeygen"
"github.com/iotaledger/wasp/v2/components/dkg"
"github.com/iotaledger/wasp/v2/components/logger"
"github.com/iotaledger/wasp/v2/components/nodeconn"
"github.com/iotaledger/wasp/v2/components/peering"
Expand Down Expand Up @@ -46,7 +46,7 @@ func App() *app.App {
database.Component,
registry.Component,
peering.Component,
distkeygen.Component,
dkg.Component,
processors.Component,
chains.Component,
publisher.Component,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

// Package distkeygen implements Distributed Key Generation functionality.
package distkeygen
// Package dkg implements Distributed Key Generation functionality.
package dkg

import (
"go.uber.org/dig"

"github.com/iotaledger/hive.go/app"

"github.com/iotaledger/wasp/v2/packages/distkeygen"
"github.com/iotaledger/wasp/v2/packages/dkg"
"github.com/iotaledger/wasp/v2/packages/peering"
"github.com/iotaledger/wasp/v2/packages/registry"
)
Expand All @@ -35,11 +35,11 @@ func provide(c *dig.Container) error {
type nodeResult struct {
dig.Out

Node *distkeygen.Node
Node *dkg.Node
}

if err := c.Provide(func(deps nodeDeps) nodeResult {
node, err := distkeygen.NewNode(
node, err := dkg.NewNode(
deps.NodeIdentityProvider.NodeIdentity(),
deps.NetworkProvider,
deps.DKShareRegistry,
Expand Down
6 changes: 3 additions & 3 deletions components/webapi/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/iotaledger/wasp/v2/packages/chain"
"github.com/iotaledger/wasp/v2/packages/chains"
"github.com/iotaledger/wasp/v2/packages/daemon"
"github.com/iotaledger/wasp/v2/packages/distkeygen"
"github.com/iotaledger/wasp/v2/packages/dkg"
"github.com/iotaledger/wasp/v2/packages/evm/jsonrpc"
"github.com/iotaledger/wasp/v2/packages/isc"
"github.com/iotaledger/wasp/v2/packages/metrics"
Expand Down Expand Up @@ -225,7 +225,7 @@ func provide(c *dig.Container) error {
NodeIdentityProvider registry.NodeIdentityProvider
NetworkProvider peering.NetworkProvider `name:"networkProvider"`
TrustedNetworkManager peering.TrustedNetworkManager `name:"trustedNetworkManager"`
Node *distkeygen.Node
Node *dkg.Node
UserManager *users.UserManager
Publisher *publisher.Publisher
NodeConn chain.NodeConnection
Expand Down Expand Up @@ -282,7 +282,7 @@ func provide(c *dig.Container) error {
func() *chains.Chains {
return deps.Chains
},
func() *distkeygen.Node {
func() *dkg.Node {
return deps.Node
},
deps.ShutdownHandler,
Expand Down
6 changes: 3 additions & 3 deletions packages/apilib/rundkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/iotaledger/wasp/v2/packages/cryptolib"
)

// RunDistributedKeyGeneration runs DKG procedure on specific Wasp hosts: generates new keys and puts corresponding committee records
// RunDKG runs DKG procedure on specific Wasp hosts: generates new keys and puts corresponding committee records
// into nodes. In case of success, generated address is returned
func RunDistributedKeyGeneration(ctx context.Context, client *apiclient.APIClient, peerPubKeys []string, threshold uint16, timeout ...time.Duration) (*cryptolib.Address, error) {
func RunDKG(ctx context.Context, client *apiclient.APIClient, peerPubKeys []string, threshold uint16, timeout ...time.Duration) (*cryptolib.Address, error) {
to := uint32(120 * 1000)
if len(timeout) > 0 {
n := timeout[0].Milliseconds()
Expand All @@ -42,7 +42,7 @@ func RunDistributedKeyGeneration(ctx context.Context, client *apiclient.APIClien

addr, err := cryptolib.NewAddressFromHexString(dkShares.Address)
if err != nil {
return nil, fmt.Errorf("RunDistributedKeyGeneration: invalid address returned from DKG: %w", err)
return nil, fmt.Errorf("RunDKG: invalid address returned from DKG: %w", err)
}

return addr, nil
Expand Down
6 changes: 3 additions & 3 deletions packages/chain/chainmanager/chain_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ func testChainMgrBasic(t *testing.T, n, f int) {
for i, pid := range peerIdentities {
nodeIDs[i] = gpa.NodeIDFromPublicKey(pid.GetPublicKey())
}
committeeAddrA, dkRegs := testpeers.SetupDistributedKeyGenerationTrivial(t, n, f, peerIdentities, nil)
committeeAddrB, dkRegs := testpeers.SetupDistributedKeyGenerationTrivial(t, n, f, peerIdentities, dkRegs)
committeeAddrA, dkRegs := testpeers.SetupDkgTrivial(t, n, f, peerIdentities, nil)
committeeAddrB, dkRegs := testpeers.SetupDkgTrivial(t, n, f, peerIdentities, dkRegs)
require.NotNil(t, committeeAddrA)
require.NotNil(t, committeeAddrB)
t.Logf("Committee addressA: %v", committeeAddrA)
t.Logf("Committee addressB: %v", committeeAddrB)
//
// Chain identifiers.
committeeAddrASigner := testpeers.NewTestDistributedSignatureSigner(committeeAddrA, dkRegs, nodeIDs, peerIdentities, log)
committeeAddrASigner := testpeers.NewTestDSSSigner(committeeAddrA, dkRegs, nodeIDs, peerIdentities, log)
tcl := newTestChainLedger(t, committeeAddrASigner)
anchor, deposit := tcl.MakeTxChainOrigin()
//
Expand Down
2 changes: 1 addition & 1 deletion packages/chain/committeelog/cmt_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func testCommitteeLogBasic(t *testing.T, n, f int) {
peerPubKeys := testpeers.PublicKeys(peerIdentities)
//
// Committee.
committeeAddress, committeeKeyShares := testpeers.SetupDistributedKeyGenerationTrivial(t, n, f, peerIdentities, nil)
committeeAddress, committeeKeyShares := testpeers.SetupDkgTrivial(t, n, f, peerIdentities, nil)
//
// Construct the algorithm nodes.
gpaNodeIDs := gpa.NodeIDsFromPublicKeys(peerPubKeys)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func AggregateBatchProposals(inputs map[gpa.NodeID][]byte, nodeIDs []gpa.NodeID,
aggregatedL1Params := batchProposals.aggregatedL1Params(f)
aggregatedBatchProposals := &AggregatedBatchProposals{
batchProposalSet: batchProposals,
decidedIndexProposals: batchProposals.decidedDistributedSignatureIndexProposals(),
decidedIndexProposals: batchProposals.decidedDSSIndexProposals(),
decidedBaseAnchor: decidedBaseAnchor,
decidedRequestRefs: batchProposals.decidedRequestRefs(f, decidedBaseAnchor),
decidedRotateTo: batchProposals.decidedRotateTo(f),
Expand All @@ -99,7 +99,7 @@ func (p *AggregatedBatchProposals) ShouldBeSkipped() bool {
return p.shouldBeSkipped
}

func (p *AggregatedBatchProposals) DecidedDistributedSignatureIndexProposals() map[gpa.NodeID][]int {
func (p *AggregatedBatchProposals) DecidedDSSIndexProposals() map[gpa.NodeID][]int {
if p.shouldBeSkipped {
panic("trying to use aggregated proposal marked to be skipped")
}
Expand Down
38 changes: 19 additions & 19 deletions packages/chain/consensus/batchproposal/batch_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ import (
)

type BatchProposal struct {
nodeIndex uint16 `bcs:"export"` // Just for a double-check.
baseAnchor *isc.StateAnchor `bcs:"export,optional"` // Proposed Base Anchor to use.
distributedStateIndexProposal util.BitVector `bcs:"export"` // DSS Index proposal.
rotateTo *iotago.Address `bcs:"export,optional"` // Suggestion to rotate the committee, optional.
timeData time.Time `bcs:"export"` // Our view of time.
validatorFeeDestination isc.AgentID `bcs:"export"` // Proposed destination for fees.
requestRefs []*isc.RequestRef `bcs:"export"` // Requests we propose to include into the execution.
gasCoins []*coin.CoinWithRef `bcs:"export,optional"` // Coins to use for gas payment.
l1params *parameters.L1Params `bcs:"export,optional"` // The L1Params for current state
nodeIndex uint16 `bcs:"export"` // Just for a double-check.
baseAnchor *isc.StateAnchor `bcs:"export,optional"` // Proposed Base Anchor to use.
dssIndexProposal util.BitVector `bcs:"export"` // DSS Index proposal.
rotateTo *iotago.Address `bcs:"export,optional"` // Suggestion to rotate the committee, optional.
timeData time.Time `bcs:"export"` // Our view of time.
validatorFeeDestination isc.AgentID `bcs:"export"` // Proposed destination for fees.
requestRefs []*isc.RequestRef `bcs:"export"` // Requests we propose to include into the execution.
gasCoins []*coin.CoinWithRef `bcs:"export,optional"` // Coins to use for gas payment.
l1params *parameters.L1Params `bcs:"export,optional"` // The L1Params for current state
}

func NewBatchProposal(
nodeIndex uint16,
baseAnchor *isc.StateAnchor,
distSignIndexProposal util.BitVector,
dssIndexProposal util.BitVector,
rotateTo *iotago.Address,
timeData time.Time,
validatorFeeDestination isc.AgentID,
Expand All @@ -38,15 +38,15 @@ func NewBatchProposal(
l1params *parameters.L1Params,
) *BatchProposal {
return &BatchProposal{
nodeIndex: nodeIndex,
baseAnchor: baseAnchor,
distributedStateIndexProposal: distSignIndexProposal,
rotateTo: rotateTo,
timeData: timeData,
validatorFeeDestination: validatorFeeDestination,
requestRefs: requestRefs,
gasCoins: gasCoins,
l1params: l1params,
nodeIndex: nodeIndex,
baseAnchor: baseAnchor,
dssIndexProposal: dssIndexProposal,
rotateTo: rotateTo,
timeData: timeData,
validatorFeeDestination: validatorFeeDestination,
requestRefs: requestRefs,
gasCoins: gasCoins,
l1params: l1params,
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/chain/consensus/batchproposal/batch_proposal_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

type batchProposalSet map[gpa.NodeID]*BatchProposal

func (s batchProposalSet) decidedDistributedSignatureIndexProposals() map[gpa.NodeID][]int {
func (s batchProposalSet) decidedDSSIndexProposals() map[gpa.NodeID][]int {
ips := map[gpa.NodeID][]int{}
for nid, batchProposal := range s {
ips[nid] = batchProposal.distributedStateIndexProposal.AsInts()
ips[nid] = batchProposal.dssIndexProposal.AsInts()
}
return ips
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestBatchProposal1Serialization(t *testing.T) {
require.NoError(t, err)
require.Equal(t, batchProposal.nodeIndex, bpDecoded.nodeIndex)
require.Equal(t, batchProposal.baseAnchor, bpDecoded.baseAnchor)
require.Equal(t, batchProposal.distributedStateIndexProposal, bpDecoded.distributedStateIndexProposal)
require.Equal(t, batchProposal.dssIndexProposal, bpDecoded.dssIndexProposal)
require.Equal(t, batchProposal.timeData.UnixNano(), bpDecoded.timeData.UnixNano())
require.Equal(t, batchProposal.validatorFeeDestination, bpDecoded.validatorFeeDestination)
require.Equal(t, batchProposal.requestRefs, bpDecoded.requestRefs)
Expand Down
Loading
Loading