Skip to content

Commit

Permalink
Rename FROST::DKG#part1 to generate_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
azuchi committed Feb 19, 2024
1 parent 8c304ae commit d7a93d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ round1_outputs = {}
# Round 1:
# For each participant, perform the first part of the DKG protocol.
1.upto(max_signer) do |i|
polynomial, package = FROST::DKG.part1(i, min_signer, max_signer, group)
polynomial, package = FROST::DKG.generate_secret(i, min_signer, max_signer, group)
secrets[i] = polynomial
round1_outputs[i] = package
end

# Each participant sends their commitments and proof to other participants.
received_package = {}
1.upto(max_signer) do |i|
received_package[i] = round1_outputs.select {|k, _| k != i}.values
received_package[i] = round1_outputs.select { |k, _| k != i }.values
end

# Each participant verify knowledge of proof in received package.
Expand All @@ -118,15 +118,15 @@ end
# Each participant verify received shares.
1.upto(max_signer) do |i|
received_shares[i].each do |send_by, share|
target_package = received_package[i].find{ |package| package.identifier == send_by }
target_package = received_package[i].find { |package| package.identifier == send_by }
expect(target_package.verify_share(share)).to be true
end
end

# Each participant compute signing share.
signing_shares = {}
1.upto(max_signer) do |i|
shares = received_shares[i].map{|_, share| share}
shares = received_shares[i].map { |_, share| share }
signing_shares[i] = FROST::DKG.compute_signing_share(secrets[i], shares)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/frost/dkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module DKG
# @param [Integer] identifier
# @param [ECDSA::Group] group Group of elliptic curve.
# @return [Array] The triple of polynomial and public package(FROST::DKG::Package)
def part1(identifier, min_signers, max_signers, group)
def generate_secret(identifier, min_signers, max_signers, group)
raise ArgumentError, "identifier must be Integer" unless identifier.is_a?(Integer)
raise ArgumentError, "identifier must be greater than 0." if identifier < 1
raise ArgumentError, "group must be ECDSA::Group." unless group.is_a?(ECDSA::Group)
Expand Down
2 changes: 1 addition & 1 deletion spec/frost/dkg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
# Round 1:
# For each participant, perform the first part of the DKG protocol.
1.upto(max_signer) do |i|
polynomial, package = FROST::DKG.part1(i, min_signer, max_signer, group)
polynomial, package = FROST::DKG.generate_secret(i, min_signer, max_signer, group)
secrets[i] = polynomial
round1_outputs[i] = package
end
Expand Down

0 comments on commit d7a93d3

Please sign in to comment.