-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3441 from AElfProject/release/1.5.0
Release v1.5.0
- Loading branch information
Showing
188 changed files
with
11,278 additions
and
1,657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using AElf.Cryptography; | ||
using AElf.Cryptography.ECDSA; | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace AElf.Benchmark; | ||
|
||
[MarkdownExporterAttribute.GitHub] | ||
public class VrfTests : BenchmarkTestBase | ||
{ | ||
private ECKeyPair _key; | ||
private byte[] _alphaBytes; | ||
private byte[] _piBytes; | ||
|
||
[Params(1,10,100,1000)] public int VectorCount; | ||
|
||
[GlobalSetup] | ||
public void GlobalSetup() | ||
{ | ||
_key = CryptoHelper.FromPrivateKey( | ||
ByteArrayHelper.HexStringToByteArray("2eaeb403475a9962ad59302ab53fa2b668d2d24bf5a2a917707e5b2f4ded392b")); | ||
var alpha = "fb779e58991c424eaaf10b3d364c3b3e756c7b435109a985e547c058964d7bd5"; | ||
_alphaBytes = Convert.FromHexString(alpha); | ||
var pi = "03ea6c4bdb4a9e1ae0a17c427ec074f68cdac7a57e4f3fded1b07d20dd5385baf05a9d1e4064cd1c2c5e8608e96b7e3e2058500f178b414b8e910178f17a7a77af7e88befeabceb77cae3e9fd2e1a6c051"; | ||
_piBytes = Convert.FromHexString(pi); | ||
} | ||
|
||
[Benchmark] | ||
public void VrfProveTest() | ||
{ | ||
for (var i = 0; i < VectorCount; i++) | ||
{ | ||
CryptoHelper.ECVrfProve(_key, _alphaBytes); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void VrfVerifyTest() | ||
{ | ||
for (var i = 0; i < VectorCount; i++) | ||
{ | ||
CryptoHelper.ECVrfVerify(_key.PublicKey, _alphaBytes, _piBytes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
contract/AElf.Contracts.Consensus.AEDPoS/AElf.Contracts.Consensus.AEDPoS.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
contract/AElf.Contracts.Consensus.AEDPoS/Types/NextRoundInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Google.Protobuf; | ||
|
||
namespace AElf.Contracts.Consensus.AEDPoS; | ||
|
||
public partial class NextRoundInput | ||
{ | ||
public static NextRoundInput Create(Round round, ByteString randomNumber) | ||
{ | ||
return new NextRoundInput | ||
{ | ||
RoundNumber = round.RoundNumber, | ||
RealTimeMinersInformation = { round.RealTimeMinersInformation }, | ||
ExtraBlockProducerOfPreviousRound = round.ExtraBlockProducerOfPreviousRound, | ||
BlockchainAge = round.BlockchainAge, | ||
TermNumber = round.TermNumber, | ||
ConfirmedIrreversibleBlockHeight = round.ConfirmedIrreversibleBlockHeight, | ||
ConfirmedIrreversibleBlockRoundNumber = round.ConfirmedIrreversibleBlockRoundNumber, | ||
IsMinerListJustChanged = round.IsMinerListJustChanged, | ||
RoundIdForValidation = round.RoundIdForValidation, | ||
MainChainMinersRoundNumber = round.MainChainMinersRoundNumber, | ||
RandomNumber = randomNumber | ||
}; | ||
} | ||
|
||
public Round ToRound() | ||
{ | ||
return new Round | ||
{ | ||
RoundNumber = RoundNumber, | ||
RealTimeMinersInformation = { RealTimeMinersInformation }, | ||
ExtraBlockProducerOfPreviousRound = ExtraBlockProducerOfPreviousRound, | ||
BlockchainAge = BlockchainAge, | ||
TermNumber = TermNumber, | ||
ConfirmedIrreversibleBlockHeight = ConfirmedIrreversibleBlockHeight, | ||
ConfirmedIrreversibleBlockRoundNumber = ConfirmedIrreversibleBlockRoundNumber, | ||
IsMinerListJustChanged = IsMinerListJustChanged, | ||
RoundIdForValidation = RoundIdForValidation, | ||
MainChainMinersRoundNumber = MainChainMinersRoundNumber | ||
}; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
contract/AElf.Contracts.Consensus.AEDPoS/Types/NextTermInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Google.Protobuf; | ||
|
||
namespace AElf.Contracts.Consensus.AEDPoS; | ||
|
||
public partial class NextTermInput | ||
{ | ||
public static NextTermInput Create(Round round, ByteString randomNumber) | ||
{ | ||
return new NextTermInput | ||
{ | ||
RoundNumber = round.RoundNumber, | ||
RealTimeMinersInformation = { round.RealTimeMinersInformation }, | ||
ExtraBlockProducerOfPreviousRound = round.ExtraBlockProducerOfPreviousRound, | ||
BlockchainAge = round.BlockchainAge, | ||
TermNumber = round.TermNumber, | ||
ConfirmedIrreversibleBlockHeight = round.ConfirmedIrreversibleBlockHeight, | ||
ConfirmedIrreversibleBlockRoundNumber = round.ConfirmedIrreversibleBlockRoundNumber, | ||
IsMinerListJustChanged = round.IsMinerListJustChanged, | ||
RoundIdForValidation = round.RoundIdForValidation, | ||
MainChainMinersRoundNumber = round.MainChainMinersRoundNumber, | ||
RandomNumber = randomNumber | ||
}; | ||
} | ||
|
||
public Round ToRound() | ||
{ | ||
return new Round | ||
{ | ||
RoundNumber = RoundNumber, | ||
RealTimeMinersInformation = { RealTimeMinersInformation }, | ||
ExtraBlockProducerOfPreviousRound = ExtraBlockProducerOfPreviousRound, | ||
BlockchainAge = BlockchainAge, | ||
TermNumber = TermNumber, | ||
ConfirmedIrreversibleBlockHeight = ConfirmedIrreversibleBlockHeight, | ||
ConfirmedIrreversibleBlockRoundNumber = ConfirmedIrreversibleBlockRoundNumber, | ||
IsMinerListJustChanged = IsMinerListJustChanged, | ||
RoundIdForValidation = RoundIdForValidation, | ||
MainChainMinersRoundNumber = MainChainMinersRoundNumber | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.