Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding the release PR for aelf project version 1.12.0 #3630

Merged
merged 100 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
955096c
Add whitelist solution
chopin-fan Sep 3, 2024
47595fc
Resolve issue of compilation and running, and add unit-test
chopin-fan Sep 3, 2024
53f389c
Revert appsettings.json
chopin-fan Sep 4, 2024
a57f39e
feat(zkp): Add methods required for supporting zkp verification over …
gldeng Sep 4, 2024
b66e60c
Change version to 8.0.402 in sonarqube.yaml
chopin-fan Sep 29, 2024
6469d74
Change version of sdk
chopin-fan Sep 29, 2024
00d0b6e
Change version of sdk
chopin-fan Sep 29, 2024
77e2d11
Add sources
chopin-fan Sep 29, 2024
7c9c674
Merge branch 'dev' into feature/whitelist-to-sdk
chopin-fan Sep 29, 2024
8838901
Merge branch 'dev' into feature/whitelist-to-sdk
chopin-fan Oct 3, 2024
0c5cf13
Change versions and add whitelist
chopin-fan Oct 8, 2024
8262cd9
Merge remote-tracking branch 'origin/feature/whitelist-to-sdk' into f…
chopin-fan Oct 8, 2024
4e5b3aa
Remove poseidon and groth16 in IWhitelistProvider.cs
chopin-fan Oct 8, 2024
aa43d7b
Add config for auto-publishing
chopin-fan Nov 7, 2024
534f24b
Now some of inline txs will have their own tx id via layered method n…
eanzhao Nov 9, 2024
46e54c5
Improve layered method name.
eanzhao Nov 9, 2024
be03fce
Put inline txs to block body.
eanzhao Nov 9, 2024
8291fb1
Fix block sync issue.
eanzhao Nov 11, 2024
1ac0435
1. Remove useless comments
chopin-fan Nov 12, 2024
0b3ab87
Cancel inline event log
chopin-fan Nov 12, 2024
8626f56
extend seed expiration time
JimAelf Nov 12, 2024
54fb07d
extend SEED expiration time
JimAelf Nov 13, 2024
1e7c987
transaction result status optimization, clear return the expired desc…
JimAelf Nov 13, 2024
8ec60e3
Fixed GetTransactionResultAsync: compare BestChainHeight with RefBloc…
eanzhao Nov 14, 2024
daaec05
optimize the result of transaction result
JimAelf Nov 14, 2024
1ad4d46
support zk
chopin-fan Nov 14, 2024
8c4234a
Resolve unit test issue
chopin-fan Nov 15, 2024
e1ccdb9
Resolve Verification Failure Issue
chopin-fan Nov 15, 2024
9df0b20
Resolve the difficulty of creating inline transactions by eventlog du…
chopin-fan Nov 15, 2024
5dd5ac8
Rename method name
chopin-fan Nov 15, 2024
6d433e5
Add unit-test for zk supporting
chopin-fan Nov 18, 2024
c876944
Clean up unused code and optimize the code
chopin-fan Nov 18, 2024
60b637d
Update the sdk version
chopin-fan Nov 18, 2024
d416275
Temporarily remove the unit test; it will be added back later
chopin-fan Nov 19, 2024
8299f35
Temporarily remove the unit test; it will be added back later
chopin-fan Nov 19, 2024
3067232
Modify config in azure-pipelines.yml
chopin-fan Nov 19, 2024
69ec7e8
Modify config in azure-pipelines.yml
chopin-fan Nov 19, 2024
c045573
set a the Error message to the output to infer that the transaction w…
JimAelf Nov 19, 2024
18763ee
Modify config in azure-pipelines.yml
chopin-fan Nov 19, 2024
52efae9
set a the Error message to the output to infer that the transaction w…
JimAelf Nov 19, 2024
de45a0f
set a the Error message to the output to infer that the transaction w…
JimAelf Nov 19, 2024
60cb378
If transaction satus is "NOT_EXIST", and the lag of the refblock is b…
JimAelf Nov 19, 2024
1b7c212
handle the Sonar build problem
JimAelf Nov 19, 2024
c53dbf7
handle the Sonar build problem
JimAelf Nov 19, 2024
af79e90
Fix tx expired error message.
eanzhao Nov 20, 2024
1404c3e
Add new event: SeedExpirationTimeUpdated
eanzhao Nov 20, 2024
d1a71ef
CallCount revert to 15000
chopin-fan Nov 23, 2024
6ea81f8
Merge pull request #3621 from AElfProject/feature/transaction-result-…
JimAelf Nov 25, 2024
e617a69
The Status is obsolete. Use StatusV2 instead
JimAelf Nov 25, 2024
d1658fd
The Status is obsolete. Use StatusV2 instead
JimAelf Nov 25, 2024
0f4b2c4
The Status is obsolete in this version. Use StatusV2 instead
JimAelf Nov 25, 2024
f16179d
Merge branch 'dev' into feature/inline-tx-id
chopin-fan Nov 25, 2024
b3a138c
Add unit-test for cross-aa
chopin-fan Nov 26, 2024
b498ff5
Add unit test
chopin-fan Nov 26, 2024
c84faaa
Remove unused unit test
chopin-fan Nov 26, 2024
cec89b7
unit test done
JimAelf Nov 26, 2024
2e1522e
unit test done
JimAelf Nov 26, 2024
85e9efd
Merge pull request #3620 from AElfProject/feature/inline-tx-id
JimAelf Nov 26, 2024
67ea4aa
Tune Get_TransactionResultV2_Expired_Testf and fixed tx.statusv2 issues.
eanzhao Nov 27, 2024
39398fa
Will return new status if pending txs already expired.
eanzhao Nov 27, 2024
d594e53
Merge branch 'dev' into feature/whitelist-to-sdk
chopin-fan Nov 27, 2024
f21fc2d
Merge pull request #3625 from AElfProject/feature/transaction-result-…
JimAelf Dec 3, 2024
9d567e4
Merge pull request #3624 from AElfProject/feature/extend-seed-expirat…
JimAelf Dec 3, 2024
4926267
Merge pull request #3626 from AElfProject/dev
JimAelf Dec 4, 2024
c4a291c
TransactionResult optimization, add a new method GetTransactionResult…
JimAelf Dec 4, 2024
dc42b74
Merge pull request #3627 from AElfProject/feature/transaction-result-…
JimAelf Dec 4, 2024
a74faf0
Remove inline transaction modification because of the early publishme…
JimAelf Dec 5, 2024
2a62de2
update StatusV2 to StatusWithBVP
JimAelf Dec 7, 2024
187d3ed
Merge pull request #3628 from AElfProject/feature/transaction-result-…
JimAelf Dec 7, 2024
d38683f
Remove publish config in main and side project
chopin-fan Dec 12, 2024
187a4c5
Merge branch 'dev' into feature/whitelist-to-sdk
chopin-fan Dec 12, 2024
29143a2
token contract add inline transaction modification
JimAelf Dec 14, 2024
94abd2a
Merge branch 'dev' into feature/whitelist-to-sdk
chopin-fan Dec 14, 2024
71c5095
Merge pull request #3614 from AElfProject/feature/whitelist-to-sdk
JimAelf Dec 14, 2024
6008ea5
Revert code
chopin-fan Dec 17, 2024
77ed70a
try to skip issue that node can not produce
chopin-fan Dec 18, 2024
3340791
Remove TriggerConsensusEventAsync
chopin-fan Dec 18, 2024
a584079
Add TriggerConsensusEventAsync for image
chopin-fan Dec 18, 2024
6bf28b9
remove TriggerConsensusEventAsync
chopin-fan Dec 18, 2024
745b326
add TriggerConsensusEventAsync
chopin-fan Dec 18, 2024
3222d1c
Add log
chopin-fan Dec 18, 2024
c522ab9
Add log
chopin-fan Dec 19, 2024
692c6b2
1. Remove log and resolve issue
chopin-fan Dec 19, 2024
b8fb0d8
Remove unused code
chopin-fan Dec 20, 2024
586a98a
Remove cross-aa code
chopin-fan Dec 23, 2024
ff58f36
Adjust the implementation of zk function
chopin-fan Dec 24, 2024
4d02f27
Adjust implementation of ZK function
chopin-fan Dec 25, 2024
230fceb
Adjust impletation of zk function
chopin-fan Dec 26, 2024
c124761
Adjust to static method
chopin-fan Dec 27, 2024
a2ef9a6
Add WhitelistCryptographyHelpers whitelist method
chopin-fan Dec 27, 2024
c752104
Adjust zk code
chopin-fan Dec 29, 2024
3383c90
remove priveteAssets
chopin-fan Dec 30, 2024
ee4801f
adjust version of Nethereum.Web3
chopin-fan Dec 30, 2024
a2e3579
remove unused code
chopin-fan Dec 30, 2024
7b1eb9b
Add unit test
chopin-fan Jan 1, 2025
b4804c6
Merge branch 'master' into release/1.12.2
chopin-fan Jan 1, 2025
99e57c9
Change method name to TransactionResultWithBVP
chopin-fan Jan 2, 2025
453d96b
Merge remote-tracking branch 'origin/release/1.12.2' into release/1.12.2
chopin-fan Jan 2, 2025
03ede96
Remove inline_transaction.proto
chopin-fan Jan 3, 2025
3688493
Remove poseidong
chopin-fan Jan 3, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/sonarqube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
dotnet-version: '8.0'
- name: Create temporary global.json
run: echo '{"sdk":{"version":"8.0.303"}}' > ./global.json
run: echo '{"sdk":{"version":"8.0.*"}}' > ./global.json
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
Expand Down
40 changes: 20 additions & 20 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Azure Pipelines configuration file
jobs:
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 1
# codecoverage: true
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 2
# codecoverage: false
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 3
# codecoverage: false
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 1
# codecoverage: true
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 2
# codecoverage: false
# - template: templates/build-template-window.yml
# parameters:
# parts: 3
# n: 3
# codecoverage: false
- template: templates/build-template-linux.yml
parameters:
parts: 3
Expand All @@ -40,9 +40,9 @@ jobs:
parts: 3
n: 2
codecoverage: true
- template: templates/build-template-macos.yml
parameters:
parts: 3
n: 3
codecoverage: true
# - template: templates/build-template-macos.yml
# parameters:
# parts: 3
# n: 3
# codecoverage: true

Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ private void ProcessNextRound(NextRoundInput input)
{
var minersCount = GetMinersCount(nextRound);
if (minersCount != 0 && State.ElectionContract.Value != null)
{
State.ElectionContract.UpdateMinersCount.Send(new UpdateMinersCountInput
{
MinersCount = minersCount
});
}
}
}

Expand Down
29 changes: 29 additions & 0 deletions contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,35 @@
};
}

public override Empty ExtendSeedExpirationTime(ExtendSeedExpirationTimeInput input)
{
var tokenInfo = GetTokenInfo(input.Symbol);
if (tokenInfo == null)
{
throw new AssertionException("Seed NFT does not exist.");

Check warning on line 699 in contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs

View check run for this annotation

Codecov / codecov/patch

contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs#L698-L699

Added lines #L698 - L699 were not covered by tests
}

Assert(tokenInfo.Owner == Context.Sender, "Sender is not Seed NFT owner.");
var oldExpireTimeLong = 0L;
if (tokenInfo.ExternalInfo.Value.TryGetValue(TokenContractConstants.SeedExpireTimeExternalInfoKey,
out var oldExpireTime))
{
long.TryParse(oldExpireTime, out oldExpireTimeLong);
}

Check warning on line 708 in contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs

View check run for this annotation

Codecov / codecov/patch

contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs#L706-L708

Added lines #L706 - L708 were not covered by tests

tokenInfo.ExternalInfo.Value[TokenContractConstants.SeedExpireTimeExternalInfoKey] =
input.ExpirationTime.ToString();
State.TokenInfos[input.Symbol] = tokenInfo;
Context.Fire(new SeedExpirationTimeUpdated
{
ChainId = tokenInfo.IssueChainId,
Symbol = input.Symbol,
OldExpirationTime = oldExpireTimeLong,
NewExpirationTime = input.ExpirationTime
});
return new Empty();
}

private int GetMaxBatchApproveCount()
{
return State.MaxBatchApproveCount.Value == 0
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "8.0.x"
"version": "8.0.*"
}
}
3 changes: 3 additions & 0 deletions nuget.config
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>
2 changes: 2 additions & 0 deletions protobuf/aelf/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ enum TransactionResultStatus {
PENDING_VALIDATION = 5;
// Transaction validation failed.
NODE_VALIDATION_FAILED = 6;
// Transaction is expired
EXPIRED = 7;
}

message TransactionResult {
Expand Down
16 changes: 16 additions & 0 deletions protobuf/token_contract_impl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ service TokenContractImpl {
rpc GetMaxBatchApproveCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) {

}

rpc ExtendSeedExpirationTime (ExtendSeedExpirationTimeInput) returns (google.protobuf.Empty) {
}
}

message AdvanceResourceTokenInput {
Expand Down Expand Up @@ -444,4 +447,17 @@ message ModifyTokenIssuerAndOwnerInput {

message SetTokenIssuerAndOwnerModificationEnabledInput{
bool enabled = 1;
}

message ExtendSeedExpirationTimeInput {
string symbol = 1;
int64 expiration_time = 2;
}

message SeedExpirationTimeUpdated {
option (aelf.is_event) = true;
int32 chain_id = 1;
string symbol = 2;
int64 old_expiration_time = 3;
int64 new_expiration_time = 4;
}
2 changes: 1 addition & 1 deletion protobuf/virtual_transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ message VirtualTransactionCreated {
string method_name = 4 [(aelf.is_indexed) = true];
bytes params = 5;
aelf.Address signatory = 6 [(aelf.is_indexed) = true];
}
}
3 changes: 1 addition & 2 deletions src/AElf.CSharp.CodeOps/AElf.CSharp.CodeOps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.Net80" Version="1.5.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
<PackageReference Include="Groth16.Net" Version="1.1.0" />
<PackageReference Include="Poseidon.Net" Version="0.1.1" />
<PackageReference Include="Groth16.Net" Version="1.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/AElf.CSharp.CodeOps/Validators/Method/ArrayValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading;
using AElf.CSharp.Core;
using AElf.Types;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Volo.Abp.DependencyInjection;
Expand All @@ -24,7 +25,7 @@ public class ArrayValidator : IValidator<MethodDefinition>, ITransientDependency
.LimitByTotalSize(typeof(decimal), sizeof(decimal))
.LimitByTotalSize(typeof(char), sizeof(char))
.LimitByTotalSize(typeof(String), 128) // Need to limit the size of strings by disallowing String.Concat
.LimitByTotalSize(typeof(BigIntValue), 128)
// It isn't possible to estimate runtime sizes for below, so limit by count
.LimitByCount(typeof(Type), 5)
.LimitByCount(typeof(Object), 5) // Support object in Linq queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
if (_allowedStateTypes.Contains(field.FieldType.FullName))
return false;

if(field.FieldType.Resolve().BaseType.FullName == typeof(StructuredState).FullName)
return false;

Check warning on line 235 in src/AElf.CSharp.CodeOps/Validators/Module/ContractStructureValidator.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.CSharp.CodeOps/Validators/Module/ContractStructureValidator.cs#L235

Added line #L235 was not covered by tests
// If not ContractReferenceState then it is not allowed
return field.FieldType.Resolve().BaseType.FullName != typeof(ContractReferenceState).FullName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using AElf.Cryptography.Bn254;
using AElf.Cryptography.EdDSA;
using AElf.Cryptography.Keccak;
using AElf.Cryptography.SecretSharing;
using AElf.CSharp.Core;
using AElf.Kernel.SmartContract;
Expand Down Expand Up @@ -50,7 +53,6 @@ private void WhitelistAssemblies(Whitelist whitelist)
.Assembly(typeof(SecretSharingHelper).Assembly, Trust.Partial) // AElf.Cryptography
.Assembly(typeof(ISmartContractBridgeContext).Assembly, Trust.Full) // AElf.Kernel.SmartContract.Shared
.Assembly(typeof(Groth16.Net.Verifier).Assembly, Trust.Full) // AElf.Cryptography.ECDSA
.Assembly(typeof(Poseidon.Net.Poseidon).Assembly, Trust.Full)
;
}

Expand All @@ -64,6 +66,15 @@ private void WhitelistSystemTypes(Whitelist whitelist)
.Type("Func`1", Permission.Allowed) // Required for protobuf generated code
.Type("Func`2", Permission.Allowed) // Required for protobuf generated code
.Type("Func`3", Permission.Allowed) // Required for protobuf generated code
.Type("Func`4", Permission.Allowed)
.Type("ValueTuple`1", Permission.Allowed)
.Type("ValueTuple`2", Permission.Allowed)
.Type("ValueTuple`3", Permission.Allowed)
.Type("ValueTuple`4", Permission.Allowed)
.Type("ValueTuple`5", Permission.Allowed)
.Type("ValueTuple`6", Permission.Allowed)
.Type("ValueTuple`7", Permission.Allowed)
.Type("ValueTuple`8", Permission.Allowed)
.Type("Nullable`1", Permission.Allowed) // Required for protobuf generated code
.Type(typeof(BitConverter), Permission.Denied, member => member
.Member(nameof(BitConverter.GetBytes), Permission.Allowed))
Expand Down Expand Up @@ -160,6 +171,27 @@ private void WhitelistOthers(Whitelist whitelist)
)
;
}

private void WhitelistCryptographyHelpers(Whitelist whitelist)
{
whitelist
// Selectively allowed types and members
.Namespace("AElf.Cryptography.Bn254", Permission.Denied, type => type
.Type(typeof(Bn254Helper), Permission.Denied, member => member
.Member(nameof(Bn254Helper.Bn254Pairing), Permission.Allowed)
.Member(nameof(Bn254Helper.Bn254G1Add), Permission.Allowed)
.Member(nameof(Bn254Helper.Bn254G1Mul), Permission.Allowed)
))
.Namespace("AElf.Cryptography.EdDSA", Permission.Denied, type => type
.Type(typeof(EdDsaHelper), Permission.Denied, member => member
.Member(nameof(EdDsaHelper.Ed25519Verify), Permission.Allowed)
))
.Namespace("AElf.Cryptography.Keccak", Permission.Denied, type => type
.Type(typeof(KeccakHelper), Permission.Denied, member => member
.Member(nameof(KeccakHelper.Keccak256), Permission.Allowed)
))
;
}

private Whitelist CreateWhitelist()
{
Expand All @@ -169,6 +201,7 @@ private Whitelist CreateWhitelist()
WhitelistReflectionTypes(whitelist);
WhitelistLinqAndCollections(whitelist);
WhitelistOthers(whitelist);
WhitelistCryptographyHelpers(whitelist);
return whitelist;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/AElf.Cryptography/AElf.Cryptography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<PackageReference Include="Secp256k1.Net" Version="1.2.0" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="Secp256k1.Native" Version="0.1.24-alpha" />
<PackageReference Include="Bn254.Net" Version="0.1.0" />
<PackageReference Include="Rebex.Elliptic.Ed25519" Version="1.2.1" />
<PackageReference Include="Nethereum.Web3" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AElf.Types\AElf.Types.csproj" />
Expand Down
38 changes: 38 additions & 0 deletions src/AElf.Cryptography/Bn254/Bn254Helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Bn254.Net;
using NetBn254 = Bn254.Net;

namespace AElf.Cryptography.Bn254
{
public static class Bn254Helper
{
public static (byte[] x, byte[] y) Bn254G1Mul(byte[] x1, byte[] y1, byte[] s)
{
var (xUInt256, yUInt256) = NetBn254.Bn254.Mul(UInt256.FromBigEndianBytes(x1),
UInt256.FromBigEndianBytes(y1),
UInt256.FromBigEndianBytes(s));
return (xUInt256.ToBigEndianBytes(), yUInt256.ToBigEndianBytes());
}

Check warning on line 14 in src/AElf.Cryptography/Bn254/Bn254Helper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Bn254/Bn254Helper.cs#L9-L14

Added lines #L9 - L14 were not covered by tests

public static (byte[] x3, byte[] y3) Bn254G1Add(byte[] x1, byte[] y1, byte[] x2, byte[] y2)
{
var (x3UInt256, y3UInt256) = NetBn254.Bn254.Add(UInt256.FromBigEndianBytes(x1),
UInt256.FromBigEndianBytes(y1),
UInt256.FromBigEndianBytes(x2), UInt256.FromBigEndianBytes(y2));
return (x3UInt256.ToBigEndianBytes(), y3UInt256.ToBigEndianBytes());
}

Check warning on line 22 in src/AElf.Cryptography/Bn254/Bn254Helper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Bn254/Bn254Helper.cs#L17-L22

Added lines #L17 - L22 were not covered by tests

public static bool Bn254Pairing((byte[], byte[], byte[], byte[], byte[], byte[])[] input)
{
var elements = new (UInt256, UInt256, UInt256, UInt256, UInt256, UInt256)[input.Length];

Check warning on line 26 in src/AElf.Cryptography/Bn254/Bn254Helper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Bn254/Bn254Helper.cs#L25-L26

Added lines #L25 - L26 were not covered by tests
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));
}

Check warning on line 33 in src/AElf.Cryptography/Bn254/Bn254Helper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Bn254/Bn254Helper.cs#L28-L33

Added lines #L28 - L33 were not covered by tests

return NetBn254.Bn254.Pairing(elements);
}

Check warning on line 36 in src/AElf.Cryptography/Bn254/Bn254Helper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Bn254/Bn254Helper.cs#L35-L36

Added lines #L35 - L36 were not covered by tests
}
}
22 changes: 22 additions & 0 deletions src/AElf.Cryptography/EdDSA/EdDsaHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using Rebex.Security.Cryptography;

namespace AElf.Cryptography.EdDSA
{
public static class EdDsaHelper
{
public static bool Ed25519Verify(byte[] signature, byte[] message, byte[] publicKey)
{

Check warning on line 9 in src/AElf.Cryptography/EdDSA/EdDsaHelper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/EdDSA/EdDsaHelper.cs#L9

Added line #L9 was not covered by tests
try
{
var instance = new Ed25519();
instance.FromPublicKey(publicKey);
return instance.VerifyMessage(message, signature);

Check warning on line 14 in src/AElf.Cryptography/EdDSA/EdDsaHelper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/EdDSA/EdDsaHelper.cs#L11-L14

Added lines #L11 - L14 were not covered by tests
}
catch (Exception e)

Check warning on line 16 in src/AElf.Cryptography/EdDSA/EdDsaHelper.cs

View workflow job for this annotation

GitHub Actions / static-code-analysis

The variable 'e' is declared but never used
{
return false;

Check warning on line 18 in src/AElf.Cryptography/EdDSA/EdDsaHelper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/EdDSA/EdDsaHelper.cs#L16-L18

Added lines #L16 - L18 were not covered by tests
}
}

Check warning on line 20 in src/AElf.Cryptography/EdDSA/EdDsaHelper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/EdDSA/EdDsaHelper.cs#L20

Added line #L20 was not covered by tests
}
}
12 changes: 12 additions & 0 deletions src/AElf.Cryptography/Keccak/KeccakHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Nethereum.Util;

namespace AElf.Cryptography.Keccak
{
public static class KeccakHelper
{
public static byte[] Keccak256(byte[] message)
{
return Sha3Keccack.Current.CalculateHash(message);
}

Check warning on line 10 in src/AElf.Cryptography/Keccak/KeccakHelper.cs

View check run for this annotation

Codecov / codecov/patch

src/AElf.Cryptography/Keccak/KeccakHelper.cs#L8-L10

Added lines #L8 - L10 were not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configuration>Release</Configuration>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configuration>Release</Configuration>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IExecutionObserverThreshold GetExecutionObserverThreshold(IBlockIndex blo
var branchCountObserverThreshold = GetBlockExecutedData(blockIndex, BranchCountThresholdKey)?.Value ??
SmartContractConstants.ExecutionBranchThreshold;
var callCountObserverThreshold = GetBlockExecutedData(blockIndex, CallCountThresholdKey)?.Value ??
SmartContractConstants.ExecutionBranchThreshold;
SmartContractConstants.ExecutionCallThreshold;
return new ExecutionObserverThreshold
{
ExecutionBranchThreshold = branchCountObserverThreshold,
Expand Down
Loading
Loading