Skip to content

Commit

Permalink
Merge pull request #3596 from AElfProject/release/1.10.0
Browse files Browse the repository at this point in the history
Regarding the release PR for aelf project version 1.10.0
  • Loading branch information
JimAelf authored Aug 2, 2024
2 parents 1f29cab + a6ecf37 commit 499125c
Show file tree
Hide file tree
Showing 279 changed files with 1,990 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0'
dotnet-version: '8.0'

- name: 'Download AElf build tools'
run: bash scripts/download_binary.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarqube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0'
dotnet-version: '8.0'
- name: Create temporary global.json
run: echo '{"sdk":{"version":"7.0.410"}}' > ./global.json
run: echo '{"sdk":{"version":"8.0.303"}}' > ./global.json
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
Expand Down
21 changes: 21 additions & 0 deletions AElf.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.TestContract
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.VirtualTransactionEventContract.Tests", "test\AElf.Contracts.VirtualTransactionEventContract.Tests\AElf.Contracts.VirtualTransactionEventContract.Tests.csproj", "{6981684D-450C-412B-9082-0B0A67A679B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Kernel.FeatureDisable", "src\AElf.Kernel.FeatureDisable\AElf.Kernel.FeatureDisable.csproj", "{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Kernel.FeatureDisable.Tests", "test\AElf.Kernel.FeatureDisable.Tests\AElf.Kernel.FeatureDisable.Tests.csproj", "{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Kernel.FeatureDisable.Core", "src\AElf.Kernel.FeatureDisable.Core\AElf.Kernel.FeatureDisable.Core.csproj", "{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1089,6 +1095,18 @@ Global
{6981684D-450C-412B-9082-0B0A67A679B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6981684D-450C-412B-9082-0B0A67A679B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6981684D-450C-412B-9082-0B0A67A679B9}.Release|Any CPU.Build.0 = Release|Any CPU
{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E}.Release|Any CPU.Build.0 = Release|Any CPU
{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67}.Release|Any CPU.Build.0 = Release|Any CPU
{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1280,5 +1298,8 @@ Global
{64498F8C-B827-4E1C-B5FB-4B9188C839A8} = {D3950CC9-808F-4ED8-946A-79A992F3F8EF}
{0F10B838-C363-4F55-A5BB-B7F9F80565AB} = {D3950CC9-808F-4ED8-946A-79A992F3F8EF}
{6981684D-450C-412B-9082-0B0A67A679B9} = {D3950CC9-808F-4ED8-946A-79A992F3F8EF}
{A4ACE6D2-4CF8-4B52-93C9-BB8BEC0C098E} = {90B310B4-C2DB-419E-B5EE-97FA096B62CC}
{8C0D86A4-D1A7-4B61-AC44-755F5AC75D67} = {4E54480A-D155-43ED-9736-1A5BE7957211}
{659A7C7A-44C9-424E-B4F6-D1D3656F7AD4} = {90B310B4-C2DB-419E-B5EE-97FA096B62CC}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion bench/AElf.BenchBase/AElf.BenchBase.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<SkipAudit>true</SkipAudit>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion bench/AElf.Benchmark/AElf.Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<!-- <NoWarn>0436</NoWarn>-->
<OutputType>Exe</OutputType>
Expand Down
2 changes: 1 addition & 1 deletion bench/AElf.Database.Benches/AElf.Database.Benches.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn>xUnit1013</NoWarn>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
CAKE_VERSION=0.37.0
DOTNET_VERSION=6.0.300
DOTNET_VERSION=8.0.303
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\common.props"/>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Association</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Association is a contract that enables the creation of organizations and approvals.
Expand Down
4 changes: 3 additions & 1 deletion contract/AElf.Contracts.Association/Association.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public override ProposalOutput GetProposal(Hash proposalId)
ToBeReleased = readyToRelease,
ApprovalCount = proposal.Approvals.Count,
RejectionCount = proposal.Rejections.Count,
AbstentionCount = proposal.Abstentions.Count
AbstentionCount = proposal.Abstentions.Count,
Title = proposal.Title,
Description = proposal.Description
};
}

Expand Down
8 changes: 8 additions & 0 deletions contract/AElf.Contracts.Association/AssociationConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace AElf.Contracts.Association;

public static class AssociationConstants
{
public const int MaxLengthForTitle = 255;
public const int MaxLengthForDescription = 10200;
public const int MaxLengthForProposalDescriptionUrl = 255;
}
20 changes: 18 additions & 2 deletions contract/AElf.Contracts.Association/Association_Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ private Hash GenerateProposalId(CreateProposalInput input)

private Hash CreateNewProposal(CreateProposalInput input)
{
CheckCreateProposalInput(input);
var proposalId = GenerateProposalId(input);
var proposal = new ProposalInfo
{
Expand All @@ -154,16 +155,31 @@ private Hash CreateNewProposal(CreateProposalInput input)
OrganizationAddress = input.OrganizationAddress,
ProposalId = proposalId,
Proposer = Context.Sender,
ProposalDescriptionUrl = input.ProposalDescriptionUrl
ProposalDescriptionUrl = input.ProposalDescriptionUrl,
Title = input.Title,
Description = input.Description
};
Assert(Validate(proposal), "Invalid proposal.");
Assert(State.Proposals[proposalId] == null, "Proposal already exists.");
State.Proposals[proposalId] = proposal;
Context.Fire(new ProposalCreated
{
ProposalId = proposalId,
OrganizationAddress = input.OrganizationAddress
OrganizationAddress = input.OrganizationAddress,
Title = input.Title,
Description = input.Description
});
return proposalId;
}

private void CheckCreateProposalInput(CreateProposalInput input)
{
// Check the length of title
Assert(input.Title.Length <= AssociationConstants.MaxLengthForTitle, "Title is too long.");
// Check the length of description
Assert(input.Description.Length <= AssociationConstants.MaxLengthForDescription, "Description is too long.");
// Check the length of description url
Assert(input.ProposalDescriptionUrl.Length <= AssociationConstants.MaxLengthForProposalDescriptionUrl,
"Description url is too long.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\common.props"/>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Configuration</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Configuration is a contract used for changing configurable aspects of the chain, like for example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public static class AEDPoSContractConstants
public const string SideChainShareProfitsTokenSymbol = "SHARE";
public const string PayTxFeeSymbolListName = "SymbolListToPayTxFee";
public const string PayRentalSymbolListName = "SymbolListToPayRental";
public const string SecretSharingEnabledConfigurationKey = "SecretSharingEnabled";
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override Empty UpdateInformationFromCrossChain(BytesValue input)
var minersKeys = consensusInformation.Round.RealTimeMinersInformation.Keys;
State.MainChainCurrentMinerList.Value = new MinerList
{
Pubkeys = { minersKeys.Select(ByteStringHelper.FromHexString) }
Pubkeys = { minersKeys.Select(k => ByteStringHelper.FromHexString(k)) }
};

return new Empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ private AElfConsensusHeaderInformation GetConsensusExtraDataToPublishOutValue(Ro
updatedRound.RealTimeMinersInformation[pubkey].ImpliedIrreversibleBlockHeight = Context.CurrentHeight;

// Update secret pieces of latest in value.
UpdateLatestSecretPieces(updatedRound, pubkey, triggerInformation);

if (IsSecretSharingEnabled())
{
UpdateLatestSecretPieces(updatedRound, pubkey, triggerInformation);
}

// To publish Out Value.
return new AElfConsensusHeaderInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void ProcessNextTerm(NextTermInput input)

// Update miners list.
var miners = new MinerList();
miners.Pubkeys.AddRange(nextRound.RealTimeMinersInformation.Keys.Select(ByteStringHelper.FromHexString));
miners.Pubkeys.AddRange(nextRound.RealTimeMinersInformation.Keys.Select(k => ByteStringHelper.FromHexString(k)));
if (!SetMinerList(miners, nextRound.TermNumber)) Assert(false, "Failed to update miner list.");

// Update term number lookup. (Using term number to get first round number of related term.)
Expand Down Expand Up @@ -249,7 +249,10 @@ private void ProcessUpdateValue(UpdateValueInput updateValueInput)
minerInRound.ProducedBlocks = minerInRound.ProducedBlocks.Add(1);
minerInRound.ProducedTinyBlocks = minerInRound.ProducedTinyBlocks.Add(1);

PerformSecretSharing(updateValueInput, minerInRound, currentRound, _processingBlockMinerPubkey);
if (IsSecretSharingEnabled())
{
PerformSecretSharing(updateValueInput, minerInRound, currentRound, _processingBlockMinerPubkey);
}

foreach (var tuneOrder in updateValueInput.TuneOrderInformation)
currentRound.RealTimeMinersInformation[tuneOrder.Key].FinalOrderOfNextRound = tuneOrder.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Linq;
using AElf.Cryptography.SecretSharing;
using AElf.CSharp.Core;
using AElf.Sdk.CSharp;
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;

namespace AElf.Contracts.Consensus.AEDPoS;

Expand Down Expand Up @@ -49,4 +52,28 @@ private void RevealSharedInValues(Round currentRound, string publicKey)
currentRound.RealTimeMinersInformation[publicKeyOfAnotherMiner].PreviousInValue = revealedInValue;
}
}

private bool IsSecretSharingEnabled()
{
if (State.ConfigurationContract.Value == null)
{
var configurationContractAddress =
Context.GetContractAddressByName(SmartContractConstants.ConfigurationContractSystemName);
if (configurationContractAddress == null)
{
// Which means Configuration Contract hasn't been deployed yet.
return false;
}

State.ConfigurationContract.Value = configurationContractAddress;
}

var secretSharingEnabled = new BoolValue();
secretSharingEnabled.MergeFrom(State.ConfigurationContract.GetConfiguration.Call(new StringValue
{
Value = AEDPoSContractConstants.SecretSharingEnabledConfigurationKey
}).Value);

return secretSharingEnabled.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override MinerList GetCurrentMinerList(Empty input)
{
Pubkeys =
{
round.RealTimeMinersInformation.Keys.Select(ByteStringHelper.FromHexString)
round.RealTimeMinersInformation.Keys.Select(k => ByteStringHelper.FromHexString(k))
}
}
: new MinerList();
Expand Down Expand Up @@ -236,7 +236,7 @@ private Round GenerateFirstRoundOfNextTerm(string senderPubkey, int miningInterv
// Miners of new round are same with current round.
var miners = new MinerList();
miners.Pubkeys.AddRange(
currentRound.RealTimeMinersInformation.Keys.Select(ByteStringHelper.FromHexString));
currentRound.RealTimeMinersInformation.Keys.Select(k => ByteStringHelper.FromHexString(k)));
newRound = miners.GenerateFirstRoundOfNewTerm(currentRound.GetMiningInterval(),
Context.CurrentBlockTime, currentRound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Consensus.AEDPoS</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Consensus is a contract that implements AElf’s DPoS consensus protocol.</Description>
Expand Down Expand Up @@ -47,6 +47,9 @@
<ContractReference Include="..\..\protobuf\profit_contract.proto">
<Link>Protobuf\Proto\reference\profit_contract.proto</Link>
</ContractReference>
<ContractReference Include="..\..\protobuf\configuration_contract.proto">
<Link>Protobuf\Proto\reference\configuration_contract.proto</Link>
</ContractReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using AElf.Contracts.Configuration;
using AElf.Contracts.Election;
using AElf.Contracts.MultiToken;
using AElf.Contracts.Parliament;
Expand All @@ -15,4 +16,5 @@ public partial class AEDPoSContractState
internal TokenContractContainer.TokenContractReferenceState TokenContract { get; set; }
internal TokenHolderContractContainer.TokenHolderContractReferenceState TokenHolderContract { get; set; }
internal ParliamentContractContainer.ParliamentContractReferenceState ParliamentContract { get; set; }
internal ConfigurationContainer.ConfigurationReferenceState ConfigurationContract { get; set; }
}
2 changes: 1 addition & 1 deletion contract/AElf.Contracts.Consensus.AEDPoS/Types/Round.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public MinerList GetMinerList()
{
return new MinerList
{
Pubkeys = { RealTimeMinersInformation.Keys.Select(ByteStringHelper.FromHexString) }
Pubkeys = { RealTimeMinersInformation.Keys.Select(k => ByteStringHelper.FromHexString(k)) }
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props"/>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.CrossChain</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>CrossChain is a contract that implements cross-chain related features, especially
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\common.props"/>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Economic</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Economic is a contract that implements the basic functionality used to manage the economic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\common.props"/>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Election</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Election is a contract that implements voting.</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public override Empty InitialElectionContract(InitialElectionContractInput input
State.MinersCount.Value = input.MinerList.Count;
State.InitialMiners.Value = new PubkeyList
{
Value = { input.MinerList.Select(ByteStringHelper.FromHexString) }
// ReSharper disable once ConvertClosureToMethodGroup
Value = { input.MinerList.Select(m => ByteStringHelper.FromHexString(m)) }
};
foreach (var pubkey in input.MinerList)
State.CandidateInformationMap[pubkey] = new CandidateInformation
Expand Down
5 changes: 3 additions & 2 deletions contract/AElf.Contracts.Election/ViewMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ private List<ByteString> GetVictories(List<string> currentMiners)
if (diff > 0)
{
victories =
new List<ByteString>(validCandidates.Select(ByteStringHelper.FromHexString));
new List<ByteString>(validCandidates.Select(v => ByteStringHelper.FromHexString(v)));
var backups = currentMiners.Where(k => !validCandidates.Contains(k)).ToList();
if (State.InitialMiners.Value != null)
backups.AddRange(
State.InitialMiners.Value.Value.Select(k => k.ToHex()).Where(k => !backups.Contains(k)));

victories.AddRange(backups.OrderBy(p => p)
.Take(Math.Min(diff, currentMiners.Count))
.Select(ByteStringHelper.FromHexString));
// ReSharper disable once ConvertClosureToMethodGroup
.Select(v => ByteStringHelper.FromHexString(v)));
Context.LogDebug(() => string.Join("\n", victories.Select(v => v.ToHex().Substring(0, 10)).ToList()));
return victories;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackageId>AElf.Contracts.Genesis</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Genesis is a contract that implements base functionality of the chain such as contract proposal
Expand Down
Loading

0 comments on commit 499125c

Please sign in to comment.