Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Make POA great again!!! #27

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
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
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "submodules/Catalyst.Node"]
path = submodules/Catalyst.Node
url = https://github.com/catalyst-network/Catalyst.Node.git
[submodule "submodules/Catalyst.Framework"]
path = submodules/Catalyst.Framework
url = git@github.com:catalyst-network/Catalyst.Framework.git

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ FROM mcr.microsoft.com/dotnet/core/sdk:2.2
RUN apt update -y; apt-get install dnsutils lsof -y
WORKDIR /app
COPY --from=build-env /app/output .
CMD ["dotnet", "Catalyst.Dfs.SeedNode.dll", "--ipfs-password", "test"]
CMD ["dotnet", "Catalyst.Node.POA.CE.dll", "--dfs-password", "test"]
4 changes: 1 addition & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ steps:
inputs:
version: 3.0.100

- bash: |
git submodule update --init --force --recursive
displayName: 'Clone submodules'
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install rust
condition: ne( variables['Agent.OS'], 'Windows_NT' )

- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
Expand Down
2 changes: 1 addition & 1 deletion src/Catalyst.Cli.Tests/Catalyst.Cli.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>
<Import Project="..\Common.TestProjects.props" />
<ItemGroup>
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.TestUtils\Catalyst.TestUtils.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.TestUtils\Catalyst.TestUtils.csproj" />
<ProjectReference Include="..\Catalyst.Cli\Catalyst.Cli.csproj" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/Catalyst.Cli/Catalyst.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Lib\Catalyst.Core.Lib.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.Cryptography.BulletProofs\Catalyst.Core.Modules.Cryptography.BulletProofs.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.KeySigner\Catalyst.Core.Modules.KeySigner.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.Keystore\Catalyst.Core.Modules.Keystore.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.Rpc.Client\Catalyst.Core.Modules.Rpc.Client.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Lib\Catalyst.Core.Lib.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.Cryptography.BulletProofs\Catalyst.Core.Modules.Cryptography.BulletProofs.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.KeySigner\Catalyst.Core.Modules.KeySigner.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.Keystore\Catalyst.Core.Modules.Keystore.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.Rpc.Client\Catalyst.Core.Modules.Rpc.Client.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<PackageReference Include="TheDotNetLeague.Ipfs.Core.Lib" Version="0.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.Dfs\Catalyst.Core.Modules.Dfs.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.Core.Modules.Mempool\Catalyst.Core.Modules.Mempool.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Node\src\Catalyst.TestUtils\Catalyst.TestUtils.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.Dfs\Catalyst.Core.Modules.Dfs.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.Core.Modules.Mempool\Catalyst.Core.Modules.Mempool.csproj" />
<ProjectReference Include="..\..\submodules\Catalyst.Framework\src\Catalyst.TestUtils\Catalyst.TestUtils.csproj" />
<ProjectReference Include="..\Catalyst.Node.POA.CE\Catalyst.Node.POA.CE.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
using Catalyst.Core.Modules.Dfs;
using Catalyst.Core.Modules.KeySigner;
using Catalyst.Core.Modules.Keystore;
using Catalyst.Core.Modules.Kvm;
using Catalyst.Core.Modules.Ledger;
using Catalyst.Core.Modules.Mempool;
using Catalyst.Core.Modules.Rpc.Server;
Expand Down Expand Up @@ -82,6 +83,7 @@ public void Registering_All_Configs_Should_Allow_Resolving_CatalystNode(NetworkT
containerBuilder.RegisterType<ConsoleUserOutput>().As<IUserOutput>();
containerBuilder.RegisterType<ConsoleUserInput>().As<IUserInput>();
containerBuilder.RegisterInstance(Substitute.For<IPeerDiscovery>()).As<IPeerDiscovery>();
containerBuilder.RegisterModule(new KvmModule());
containerBuilder.RegisterModule(new KeySignerModule());
containerBuilder.RegisterModule(new ConsensusModule());
containerBuilder.RegisterModule(new DfsModule());
Expand Down
18 changes: 14 additions & 4 deletions src/Catalyst.Node.POA.CE.Tests/IntegrationTests/PoaTestNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
using Catalyst.Core.Lib.DAO;
using Catalyst.Core.Lib.Extensions;
using Catalyst.Core.Lib.FileSystem;
using Catalyst.Core.Lib.Mempool.Documents;
using Catalyst.Core.Lib.P2P.Models;
using Catalyst.Core.Lib.P2P.Repository;
using Catalyst.Core.Modules.Dfs;
using Catalyst.Core.Modules.Hashing;
using Catalyst.Core.Modules.Mempool;
using Catalyst.Core.Modules.Rpc.Server;
using Catalyst.Core.Modules.Web3;
using Catalyst.Protocol.Cryptography;
using Catalyst.Protocol.Network;
using Catalyst.Protocol.Peer;
using Catalyst.TestUtils;
Expand Down Expand Up @@ -102,7 +102,7 @@ public PoaTestNode(string name,
{
PeerId = p
}).ToList();
_peerRepository.AsQueryable().Returns(peersInRepo.AsQueryable());
// _peerRepository.AsQueryable().Returns(peersInRepo.AsQueryable());
_peerRepository.GetAll().Returns(peersInRepo);
_peerRepository.Get(Arg.Any<string>()).Returns(ci =>
{
Expand Down Expand Up @@ -142,7 +142,7 @@ public async Task RunAsync(CancellationToken cancellationSourceToken)
await _node.RunAsync(cancellationSourceToken).ConfigureAwait(false);
}

public async Task StartSockets() { await _node.StartSockets(); }
public async Task StartSocketsAsync() { await _node.StartSocketsAsync(); }

public void Dispose() { Dispose(true); }

Expand All @@ -158,7 +158,7 @@ protected void OverrideContainerBuilderRegistrations()
_containerProvider.ContainerBuilder.RegisterType<TestFileSystem>().As<IFileSystem>()
.WithParameter("rootPath", _nodeDirectory.FullName);
_containerProvider.ContainerBuilder.RegisterInstance(Substitute.For<IPeerDiscovery>()).As<IPeerDiscovery>();
var keySigner = Substitute.For<IKeySigner>();
var keySigner = Substitute.For<SubstituteKeySigner>();
keySigner.Verify(Arg.Any<ISignature>(), Arg.Any<byte[]>(), default).ReturnsForAnyArgs(true);
keySigner.CryptoContext.SignatureLength.Returns(64);
_containerProvider.ContainerBuilder.RegisterInstance(keySigner).As<IKeySigner>();
Expand All @@ -176,4 +176,14 @@ protected virtual void Dispose(bool disposing)
_containerProvider?.Dispose();
}
}

public abstract class SubstituteKeySigner : IKeySigner
{
public abstract IKeyStore KeyStore { get; }
public abstract ICryptoContext CryptoContext { get; }
public ISignature Sign(ReadOnlySpan<byte> data, SigningContext signingContext) => Sign(data.ToArray(), signingContext);
public abstract ISignature Sign(byte[] data, SigningContext signingContext);
public bool Verify(ISignature signature, ReadOnlySpan<byte> data, SigningContext signingContext) => Verify(signature, data.ToArray(), signingContext);
public abstract bool Verify(ISignature signature, byte[] data, SigningContext signingContext);
}
}
Loading