-
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 branch 'release/1.12.2' into feature/mq
- Loading branch information
Showing
29 changed files
with
695 additions
and
49 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
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/> | ||
<add key="aelf" value="https://www.myget.org/F/aelf-project-dev/api/v3/index.json" protocolVersion="3"/> | ||
<add key="Nuget Test" value="https://int.nugettest.org/api/v2" /> | ||
<add key="nexus" value="https://nexus-poc.test.aelf.dev/repository/nuget-group/index.json" protocolVersion="3" /> | ||
</packageSources> | ||
</configuration> |
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
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
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
28 changes: 28 additions & 0 deletions
28
src/AElf.Sdk.CSharp.Internal/AElf.Sdk.CSharp.Internal.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<PackageId>AElf.Sdk.CSharp.Internal</PackageId> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<LangVersion>latest</LangVersion> | ||
<Description>Types for the C# smart contract SDK.</Description> | ||
<RootNamespace>AElf.Sdk.CSharp.Internal</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Bn254.Net" Version="0.1.0" > | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="Rebex.Elliptic.Ed25519" Version="1.2.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="Nethereum.Web3" Version="4.21.4"> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AElf.Sdk.CSharp.Spec\AElf.Sdk.CSharp.Spec.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("AElf.Sdk.CSharp")] |
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,61 @@ | ||
using System; | ||
using AElf.Sdk.CSharp.Spec; | ||
using Bn254.Net; | ||
using Nethereum.Util; | ||
|
||
namespace AElf.Sdk.CSharp.Internal; | ||
|
||
internal class InternalBuiltIns : IBuiltIns | ||
{ | ||
public static void Initialize() | ||
{ | ||
// call this method to ensure this assembly is loaded in the runtime. | ||
} | ||
|
||
public bool Ed25519Verify(byte[] signature, byte[] message, byte[] publicKey) | ||
{ | ||
try | ||
{ | ||
var instance = new Rebex.Security.Cryptography.Ed25519(); | ||
instance.FromPublicKey(publicKey); | ||
return instance.VerifyMessage(message, signature); | ||
} | ||
catch (Exception e) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public byte[] Keccak256(byte[] message) | ||
{ | ||
return Sha3Keccack.Current.CalculateHash(message); | ||
} | ||
|
||
public (byte[] x, byte[] y) Bn254G1Mul(byte[] x1, byte[] y1, byte[] s) | ||
{ | ||
var (xUInt256, yUInt256) = Bn254.Net.Bn254.Mul(UInt256.FromBigEndianBytes(x1), UInt256.FromBigEndianBytes(y1), | ||
UInt256.FromBigEndianBytes(s)); | ||
return (xUInt256.ToBigEndianBytes(), yUInt256.ToBigEndianBytes()); | ||
} | ||
|
||
public (byte[] x3, byte[] y3) Bn254G1Add(byte[] x1, byte[] y1, byte[] x2, byte[] y2) | ||
{ | ||
var (x3UInt256, y3UInt256) = Bn254.Net.Bn254.Add(UInt256.FromBigEndianBytes(x1), UInt256.FromBigEndianBytes(y1), | ||
UInt256.FromBigEndianBytes(x2), UInt256.FromBigEndianBytes(y2)); | ||
return (x3UInt256.ToBigEndianBytes(), y3UInt256.ToBigEndianBytes()); | ||
} | ||
|
||
public bool Bn254Pairing((byte[], byte[], byte[], byte[], byte[], byte[])[] input) | ||
{ | ||
var elements = new (UInt256, UInt256, UInt256, UInt256, UInt256, UInt256)[input.Length]; | ||
for (var i = 0; i < input.Length; i++) | ||
{ | ||
var (x1, y1, x2, y2, x3, y3) = input[i]; | ||
elements[i] = (UInt256.FromBigEndianBytes(x1), UInt256.FromBigEndianBytes(y1), | ||
UInt256.FromBigEndianBytes(x2), UInt256.FromBigEndianBytes(y2), | ||
UInt256.FromBigEndianBytes(x3), UInt256.FromBigEndianBytes(y3)); | ||
} | ||
|
||
return Bn254.Net.Bn254.Pairing(elements); | ||
} | ||
} |
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<Configuration>Release</Configuration> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
|
||
</Project> |
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,10 @@ | ||
namespace AElf.Sdk.CSharp.Spec; | ||
|
||
public interface IBuiltIns | ||
{ | ||
bool Ed25519Verify(byte[] signature, byte[] message, byte[] publicKey); | ||
byte[] Keccak256(byte[] message); | ||
(byte[] x, byte[] y) Bn254G1Mul(byte[] x1, byte[] y1, byte[] s); | ||
(byte[] x3, byte[] y3) Bn254G1Add(byte[] x1, byte[] y1, byte[] x2, byte[] y2); | ||
bool Bn254Pairing((byte[], byte[], byte[], byte[], byte[], byte[])[] input); | ||
} |
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.