Skip to content

Commit

Permalink
Merge pull request #2536 from AElfProject/upgrade-package-version
Browse files Browse the repository at this point in the history
upgrade abp framework
  • Loading branch information
jason-aelf authored May 17, 2020
2 parents 329e3a7 + 460317d commit ed24619
Show file tree
Hide file tree
Showing 48 changed files with 116 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace AElf.Blockchains.BasicBaseChain
public abstract class GenesisSmartContractDtoProviderBase : IGenesisSmartContractDtoProvider
{
protected readonly IContractDeploymentListProvider ContractDeploymentListProvider;
protected readonly IServiceContainer<IContractInitializationProvider> ContractInitializationProviders;
protected readonly IEnumerable<IContractInitializationProvider> ContractInitializationProviders;

protected GenesisSmartContractDtoProviderBase(IContractDeploymentListProvider contractDeploymentListProvider,
IServiceContainer<IContractInitializationProvider> contractInitializationProviders)
IEnumerable<IContractInitializationProvider> contractInitializationProviders)
{
ContractDeploymentListProvider = contractDeploymentListProvider;
ContractInitializationProviders = contractInitializationProviders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MainChainGenesisSmartContractDtoProvider : GenesisSmartContractDtoP
private readonly ContractOptions _contractOptions;

public MainChainGenesisSmartContractDtoProvider(IContractDeploymentListProvider contractDeploymentListProvider,
IServiceContainer<IContractInitializationProvider> contractInitializationProviders,
IEnumerable<IContractInitializationProvider> contractInitializationProviders,
IOptionsSnapshot<ContractOptions> contractOptions)
: base(contractDeploymentListProvider, contractInitializationProviders)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SideChainGenesisSmartContractDtoProvider : GenesisSmartContractDtoP
public SideChainGenesisSmartContractDtoProvider(
ISideChainInitializationDataProvider sideChainInitializationDataProvider,
IContractDeploymentListProvider contractDeploymentListProvider,
IServiceContainer<IContractInitializationProvider> contractInitializationProviders,
IEnumerable<IContractInitializationProvider> contractInitializationProviders,
IOptionsSnapshot<ContractOptions> contractOptions)
:base(contractDeploymentListProvider, contractInitializationProviders)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AElf.Cluster/AElf.Cluster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="1.1.2" />
<PackageReference Include="Volo.Abp.Autofac" Version="2.7.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/AElf.ContractTestBase/GenesisSmartContractDtoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ namespace AElf.ContractTestBase
public class GenesisSmartContractDtoProvider : IGenesisSmartContractDtoProvider
{
private readonly IContractDeploymentListProvider _contractDeploymentListProvider;
private readonly IServiceContainer<IContractInitializationProvider> _contractInitializationProviders;
private readonly IEnumerable<IContractInitializationProvider> _contractInitializationProviders;
private readonly IContractCodeProvider _contractCodeProvider;

public GenesisSmartContractDtoProvider(IContractDeploymentListProvider contractDeploymentListProvider,
IServiceContainer<IContractInitializationProvider> contractInitializationProviders,
IEnumerable<IContractInitializationProvider> contractInitializationProviders,
IContractCodeProvider contractCodeProvider)
{
_contractDeploymentListProvider = contractDeploymentListProvider;
Expand Down
6 changes: 3 additions & 3 deletions src/AElf.Contracts.TestKit/AElf.Contracts.TestKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.1.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="1.1.2" />
<PackageReference Include="Volo.Abp.TestBase" Version="1.1.2" />
<PackageReference Include="Moq" Version="4.14.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="2.7.0" />
<PackageReference Include="Volo.Abp.TestBase" Version="2.7.0" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/AElf.Contracts.TestKit/ContractTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Acs0;
using AElf.Contracts.Deployer;
Expand All @@ -17,6 +16,7 @@
using MartinCostello.Logging.XUnit;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Testing;
using Volo.Abp.Threading;
using Xunit;
using Xunit.Abstractions;
Expand Down
4 changes: 2 additions & 2 deletions src/AElf.Core/AElf.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.3" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.10.0" />
<PackageReference Include="Volo.Abp.Core" Version="1.1.2" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.11.0" />
<PackageReference Include="Volo.Abp.Core" Version="2.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/AElf.CrossChain.Core/AElf.CrossChain.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.EventBus" Version="1.1.2" />
<PackageReference Include="Volo.Abp.EventBus" Version="2.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/AElf.CrossChain/CrossChainPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CrossChainPlugin : IChainInitializationDataPlugin, INodePlugin
private readonly ICrossChainRequestService _crossChainRequestService;
private readonly List<ICrossChainCommunicationPlugin> _crossChainCommunicationPlugins;

public CrossChainPlugin(ICrossChainRequestService crossChainRequestService, IServiceContainer<ICrossChainCommunicationPlugin> crossChainCommunicationPlugins)
public CrossChainPlugin(ICrossChainRequestService crossChainRequestService, IEnumerable<ICrossChainCommunicationPlugin> crossChainCommunicationPlugins)
{
_crossChainRequestService = crossChainRequestService;
_crossChainCommunicationPlugins = crossChainCommunicationPlugins.ToList();
Expand Down
2 changes: 1 addition & 1 deletion src/AElf.Database/AElf.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<ProjectReference Include="..\AElf.Core\AElf.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Data" Version="1.1.2" />
<PackageReference Include="Volo.Abp.Data" Version="2.7.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace AElf.Kernel.CodeCheck.Infrastructure
{
Expand All @@ -12,7 +13,7 @@ public class ContractAuditorContainer : IContractAuditorContainer
private readonly ConcurrentDictionary<int, IContractAuditor> _contractAuditors =
new ConcurrentDictionary<int, IContractAuditor>();

public ContractAuditorContainer(IServiceContainer<IContractAuditor> contractAuditors)
public ContractAuditorContainer(IEnumerable<IContractAuditor> contractAuditors)
{
foreach (var auditor in contractAuditors)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AElf.Kernel.Core/AElf.Kernel.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Volo.Abp.EventBus" Version="1.1.2" />
<PackageReference Include="Volo.Abp.EventBus" Version="2.7.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AElf.Cryptography\AElf.Cryptography.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class BlockExtraDataService : IBlockExtraDataService
{
private readonly List<IBlockExtraDataProvider> _blockExtraDataProviders;

public BlockExtraDataService(IServiceContainer<IBlockExtraDataProvider> blockExtraDataProviders)
public BlockExtraDataService(IEnumerable<IBlockExtraDataProvider> blockExtraDataProviders)
{
_blockExtraDataProviders = blockExtraDataProviders.ToList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class LogEventListeningService<T> : ILogEventListeningService<T>

public ILogger<LogEventListeningService<T>> Logger { get; set; }

public LogEventListeningService(IServiceContainer<T> logEventProcessors)
public LogEventListeningService(IEnumerable<T> logEventProcessors)
{
_logEventProcessors = logEventProcessors.ToLookup(p => p.GetType()).Select(coll => coll.First()).ToList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace AElf.Kernel.FeeCalculation.Application
{
public class ResourceTokenFeeService : IResourceTokenFeeService
{
private readonly IServiceContainer<IResourceTokenFeeProvider> _resourceTokenFeeProviders;
private readonly IEnumerable<IResourceTokenFeeProvider> _resourceTokenFeeProviders;

public ResourceTokenFeeService(IServiceContainer<IResourceTokenFeeProvider> resourceTokenFeeProviders)
public ResourceTokenFeeService(IEnumerable<IResourceTokenFeeProvider> resourceTokenFeeProviders)
{
_resourceTokenFeeProviders = resourceTokenFeeProviders;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AElf.Contracts.MultiToken;
using AElf.Kernel.FeeCalculation.Application;
Expand All @@ -18,7 +17,7 @@ namespace AElf.Kernel.SmartContract.ExecutionPluginForMethodFee
{
internal class FeeChargePreExecutionPlugin : SmartContractExecutionPluginBase, IPreExecutionPlugin, ISingletonDependency
{
private readonly IHostSmartContractBridgeContextService _contextService;
private readonly ISmartContractAddressService _smartContractAddressService;
private readonly IPrimaryTokenSymbolProvider _primaryTokenSymbolProvider;
private readonly IPrimaryTokenFeeService _txFeeService;
private readonly ITransactionFeeExemptionService _transactionFeeExemptionService;
Expand All @@ -28,15 +27,15 @@ private readonly IContractReaderFactory<TokenContractImplContainer.TokenContract

public ILogger<FeeChargePreExecutionPlugin> Logger { get; set; }

public FeeChargePreExecutionPlugin(IHostSmartContractBridgeContextService contextService,
public FeeChargePreExecutionPlugin(ISmartContractAddressService smartContractAddressService,
IPrimaryTokenSymbolProvider primaryTokenSymbolProvider,
ITransactionFeeExemptionService transactionFeeExemptionService,
IPrimaryTokenFeeService txFeeService,
ITransactionSizeFeeSymbolsProvider transactionSizeFeeSymbolsProvider,
IContractReaderFactory<TokenContractImplContainer.TokenContractImplStub> contractReaderFactory) :
base("acs1")
{
_contextService = contextService;
_smartContractAddressService = smartContractAddressService;
_primaryTokenSymbolProvider = primaryTokenSymbolProvider;
_txFeeService = txFeeService;
_transactionSizeFeeSymbolsProvider = transactionSizeFeeSymbolsProvider;
Expand All @@ -50,8 +49,6 @@ public async Task<IEnumerable<Transaction>> GetPreTransactionsAsync(
{
try
{
var context = _contextService.Create();

var chainContext = new ChainContext
{
BlockHash = transactionContext.PreviousBlockHash,
Expand All @@ -62,10 +59,10 @@ public async Task<IEnumerable<Transaction>> GetPreTransactionsAsync(
return new List<Transaction>();
}

context.TransactionContext = transactionContext;
var tokenContractAddress = context.GetContractAddressByName(TokenSmartContractAddressNameProvider.StringName);
var tokenContractAddress = await _smartContractAddressService.GetAddressByContractNameAsync(chainContext,
TokenSmartContractAddressNameProvider.StringName);

if (context.CurrentHeight < AElfConstants.GenesisBlockHeight + 1 || tokenContractAddress == null)
if (transactionContext.BlockHeight < AElfConstants.GenesisBlockHeight + 1 || tokenContractAddress == null)
{
return new List<Transaction>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ namespace AElf.Kernel.SmartContract.ExecutionPluginForResourceFee
{
internal class ResourceConsumptionPostExecutionPlugin : SmartContractExecutionPluginBase, IPostExecutionPlugin, ISingletonDependency
{
private readonly IHostSmartContractBridgeContextService _contextService;
private readonly ISmartContractAddressService _smartContractAddressService;
private readonly IResourceTokenFeeService _resourceTokenFeeService;
private readonly IContractReaderFactory<TokenContractImplContainer.TokenContractImplStub>
_contractReaderFactory;

public ILogger<ResourceConsumptionPostExecutionPlugin> Logger { get; set; }

public ResourceConsumptionPostExecutionPlugin(IHostSmartContractBridgeContextService contextService,
public ResourceConsumptionPostExecutionPlugin(ISmartContractAddressService smartContractAddressService,
IResourceTokenFeeService resourceTokenFeeService,
IContractReaderFactory<TokenContractImplContainer.TokenContractImplStub> contractReaderFactory) :
base("acs8")
{
_contextService = contextService;
_smartContractAddressService = smartContractAddressService;
_resourceTokenFeeService = resourceTokenFeeService;
_contractReaderFactory = contractReaderFactory;

Expand All @@ -41,12 +41,17 @@ public async Task<IEnumerable<Transaction>> GetPostTransactionsAsync(
{
return new List<Transaction>();
}

var context = _contextService.Create();
context.TransactionContext = transactionContext;

var chainContext = new ChainContext
{
BlockHash = transactionContext.PreviousBlockHash,
BlockHeight = transactionContext.BlockHeight - 1
};

// Generate token contract stub.
var tokenContractAddress = context.GetContractAddressByName(TokenSmartContractAddressNameProvider.StringName);
var tokenContractAddress =
await _smartContractAddressService.GetAddressByContractNameAsync(chainContext,
TokenSmartContractAddressNameProvider.StringName);
if (tokenContractAddress == null)
{
return new List<Transaction>();
Expand All @@ -63,19 +68,13 @@ public async Task<IEnumerable<Transaction>> GetPostTransactionsAsync(
{
return new List<Transaction>();
}

if (transactionContext.Transaction.To == context.Self &&
transactionContext.Transaction.MethodName == nameof(ResourceConsumptionContractContainer

if (transactionContext.Transaction.MethodName == nameof(ResourceConsumptionContractContainer
.ResourceConsumptionContractStub.BuyResourceToken))
{
return new List<Transaction>();
}

var chainContext = new ChainContext
{
BlockHash = transactionContext.PreviousBlockHash,
BlockHeight = transactionContext.BlockHeight - 1
};
var chargeResourceTokenInput = new ChargeResourceTokenInput
{
Caller = transactionContext.Transaction.From
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Acs8;
using AElf.Contracts.MultiToken;
using AElf.Kernel.SmartContract.Application;
using AElf.Kernel.SmartContract;
using AElf.Kernel.Token;
using AElf.Types;
using Google.Protobuf;
Expand All @@ -17,15 +15,15 @@ namespace AElf.Kernel.SmartContract.ExecutionPluginForResourceFee
internal class ResourceConsumptionPreExecutionPlugin : SmartContractExecutionPluginBase, IPreExecutionPlugin,
ISingletonDependency
{
private readonly IHostSmartContractBridgeContextService _contextService;
private readonly ISmartContractAddressService _smartContractAddressService;
private readonly IContractReaderFactory<TokenContractImplContainer.TokenContractImplStub>
_contractReaderFactory;

public ResourceConsumptionPreExecutionPlugin(IHostSmartContractBridgeContextService contextService,
public ResourceConsumptionPreExecutionPlugin(ISmartContractAddressService smartContractAddressService,
IContractReaderFactory<TokenContractImplContainer.TokenContractImplStub> contractReaderFactory) :
base("acs8")
{
_contextService = contextService;
_smartContractAddressService = smartContractAddressService;
_contractReaderFactory = contractReaderFactory;
}

Expand All @@ -36,12 +34,17 @@ public async Task<IEnumerable<Transaction>> GetPreTransactionsAsync(
{
return new List<Transaction>();
}

var context = _contextService.Create();
context.TransactionContext = transactionContext;

var chainContext = new ChainContext
{
BlockHash = transactionContext.PreviousBlockHash,
BlockHeight = transactionContext.BlockHeight - 1
};

// Generate token contract stub.
var tokenContractAddress = context.GetContractAddressByName(TokenSmartContractAddressNameProvider.StringName);
var tokenContractAddress =
await _smartContractAddressService.GetAddressByContractNameAsync(chainContext,
TokenSmartContractAddressNameProvider.StringName);
if (tokenContractAddress == null)
{
return new List<Transaction>();
Expand All @@ -59,8 +62,7 @@ public async Task<IEnumerable<Transaction>> GetPreTransactionsAsync(
return new List<Transaction>();
}

if (transactionContext.Transaction.To == context.Self &&
transactionContext.Transaction.MethodName == nameof(ResourceConsumptionContractContainer
if (transactionContext.Transaction.MethodName == nameof(ResourceConsumptionContractContainer
.ResourceConsumptionContractStub.BuyResourceToken))
{
return new List<Transaction>();
Expand Down
2 changes: 1 addition & 1 deletion src/AElf.Kernel.Token/AElf.Kernel.Token.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.Core" Version="1.1.2" />
<PackageReference Include="Volo.Abp.Core" Version="2.7.0" />
</ItemGroup>
<ItemGroup>
<ContractStub Include="..\..\protobuf\token_contract.proto">
Expand Down
4 changes: 2 additions & 2 deletions src/AElf.Launcher/AElf.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Volo.Abp.Autofac" Version="1.1.2" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="2.7.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="2.7.0" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit ed24619

Please sign in to comment.