Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/1.12.0' into feature/mq
Browse files Browse the repository at this point in the history
  • Loading branch information
chopin-fan committed Nov 27, 2024
2 parents 2d72b74 + 85e9efd commit 6880c6b
Show file tree
Hide file tree
Showing 37 changed files with 630 additions and 77 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build
on:
push:
branches:
- dev
- master
- feature/use-github-actions

env:
DOTNET_INSTALL_DIR: "./.dotnet"

jobs:
build:

runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'

- name: Download AElf build tools
run: bash scripts/download_binary.sh

- name: Install Protobuf
run: bash scripts/install_protobuf.sh

- name: Build Solution
run: bash scripts/build.sh

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
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test
on:
push:
branches:
- dev
- master
- feature/use-github-actions

jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Run dotnet ci action
uses: AElfProject/dotnet-ci-action@v0.0.1
with:
commit-token: ${{ secrets.COMMIT_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
branch-name: "feature/badge-json"
solution-name: "AElf.All.sln"
53 changes: 23 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
# AElf - A Decentralized Cloud Computing Blockchain Network
# aelf - A Decentralized Cloud Computing Blockchain Network

[![GitHub closed issues](https://img.shields.io/github/issues-closed/aelfproject/aelf.svg)](https://app.gitkraken.com/glo/board/XKsOZJarBgAPseno)
[![lisence](https://img.shields.io/github/license/AElfProject/AElf.svg)](https://github.com/AElfProject/AElf/blob/dev/LICENSE)
[![Nuget](https://img.shields.io/nuget/v/AElf.OS.svg)](https://www.nuget.org/packages?q=aelf)
[![MyGet (with prereleases)](https://img.shields.io/myget/aelf-project-dev/vpre/aelf.os.svg?label=myget)](https://www.myget.org/gallery/aelf-project-dev)
[![MyGet (with prereleases)](https://img.shields.io/myget/aelf-project/vpre/aelf.os.svg?label=myget)](https://www.myget.org/gallery/aelf-project)
[![Twitter Follow](https://img.shields.io/twitter/follow/aelfblockchain.svg?label=%40aelfblockchain&style=social)](https://twitter.com/aelfblockchain)
[![Telegram](https://badgen.net/badge/telegram/join/blue?icon=telegram)](https://t.me/aelfdeveloper)

BRANCH | AZURE PIPELINES | TESTS | CODE COVERAGE
------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------
MASTER | [![Build Status](https://dev.azure.com/AElfProject/AElf/_apis/build/status/AElfProject.AElf?branchName=master)](https://dev.azure.com/AElfProject/AElf/_build/latest?definitionId=1&branchName=master) | [![Test Status](https://img.shields.io/azure-devops/tests/AElfProject/AElf/1/master)](https://dev.azure.com/AElfProject/AElf/_build/latest?definitionId=1&branchName=master) | [![codecov](https://codecov.io/gh/AElfProject/AElf/branch/master/graph/badge.svg)](https://codecov.io/gh/AElfProject/AElf)
DEV | [![Build Status](https://dev.azure.com/AElfProject/AElf/_apis/build/status/AElfProject.AElf?branchName=dev)](https://dev.azure.com/AElfProject/AElf/_build/latest?definitionId=1&branchName=dev) | [![Test Status](https://img.shields.io/azure-devops/tests/AElfProject/AElf/1/dev)](https://dev.azure.com/AElfProject/AElf/_build/latest?definitionId=1&branchName=dev) | [![codecov](https://codecov.io/gh/AElfProject/AElf/branch/dev/graph/badge.svg)](https://codecov.io/gh/AElfProject/AElf)
BRANCH | GITHUB ACTIONS BUILD | TESTS | CODE COVERAGE
------ |--------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------
MASTER | ![GitHub Workflow Build Status](https://github.com/AElfProject/AElf/actions/workflows/build.yml/badge.svg?branch=master) | ![GitHub Workflow Test Status](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AElfProject/AElf/feature/badge-json/master-test-results.json) | [![codecov](https://codecov.io/gh/AElfProject/AElf/branch/master/graph/badge.svg)](https://codecov.io/gh/AElfProject/AElf)
DEV | ![GitHub Workflow Build Status](https://github.com/AElfProject/AElf/actions/workflows/build.yml/badge.svg?branch=dev) | ![GitHub Workflow Test Status](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AElfProject/AElf/feature/badge-json/dev-test-results.json) | [![codecov](https://codecov.io/gh/AElfProject/AElf/branch/dev/graph/badge.svg)](https://codecov.io/gh/AElfProject/AElf)

Welcome to AElf's official GitHub repo !

AElf is a blockchain system aiming to achieve scalability and extensibility through the use of side-chains and a flexible design. To support multiple use cases AElf makes it as easy as possible to extend/customize the system by providing easy to use tools and frameworks in order to customize the chains and write smart contracts. AElf will eventually support various languages that will let developers choose the one they are the most comfortable with.
Welcome to aelf's official GitHub repo !

aelf is a blockchain system aiming to achieve scalability and extensibility through the use of side-chains and a flexible design. To support multiple use cases aelf makes it as easy as possible to extend/customize the system by providing easy to use tools and frameworks in order to customize the chains and write smart contracts. aelf will eventually support various languages that will let developers choose the one they are the most comfortable with.

For more information you can follow these links:
* [Official website](https://aelf.io)
* [Documentation](https://docs.aelf.io/en/latest/)
* [Environment setup](https://docs.aelf.io/en/latest/getting_started/development-environment/index.html)
* [Running a node](https://docs.aelf.io/en/latest/getting_started/development-environment/node.html)
* [Smart contract development](https://docs.aelf.io/en/latest/getting_started/smart_contracts/index.html)
* [Web Api](https://docs.aelf.io/en/latest/reference/web-api/web-api.html)
* [Testnet](https://docs.aelf.io/en/latest/tutorials/testnet.html)
* [White Paper](https://aelf.com/gridcn/aelf_whitepaper_v1.7_en.pdf)

This repository contains the code that runs an AElf node, you'll find bellow other important repositories in the AElf
* [Official website](https://aelf.com/)
* [Documentation](https://docs.aelf.com/)
* [White Paper](https://docs.aelf.com/resources/whitepaper-2/)

This repository contains the code that runs an aelf node, you'll find below other important repositories in the aelf
ecosystem:

TOOL/LIBRARY | description
-------------|-------------
[aelf-sdk.js](https://docs.aelf.io/en/latest/reference/chain-sdk/javascript/js-sdk.html) | Javascript development kit for interacting with an AElf node, useful for dApp developers.
[aelf-command](https://docs.aelf.io/en/latest/reference/cli/methods.html) | CLI tool for interacting with an AElf node and wallet.
[aelf-boilerplate](https://aelf-boilerplate-docs.readthedocs.io/en/latest/) | framework for smart contract and dApp development.
[aelf-sdk.js](https://docs.aelf.com/tools/chain-sdk/javascript-sdk/) | Javascript development kit for interacting with an aelf node, useful for dApp developers.
[aelf-command](https://docs.aelf.com/tools/aelf-cli/introduction/) | CLI tool for interacting with an aelf node and wallet.
[aelf-contract-templates](https://docs.aelf.com/tools/smart-contract-templates/developing-smart-contracts/) | framework for smart contract and dApp development.

## Getting Started

### This repository

This repo is where you will find the code that can use to run an AElf node. It also contains a **tests** folder that centralizes all the unit tests.
This repo is where you will find the code that can use to run an aelf node. It also contains a **tests** folder that centralizes all the unit tests.

### Documentation

We strongly recommend you follow official documentation that will guide you through installing dependencies and running the node,
these two guides will get you started:
* [Environment setup](https://docs.aelf.io/en/latest/getting_started/development-environment/index.html)
* [Running a node](https://docs.aelf.io/en/latest/getting_started/development-environment/node.html)
We strongly recommend you follow [official documentation](https://docs.aelf.com/) that will guide you through installing dependencies and running the node.

## Contributing

Expand All @@ -62,11 +55,11 @@ We currently only use GitHub for tracking issues, feature request and pull reque

If you think you have found a bug in our system feel free to open a GitHub issue, but first:
- check with GitHub's search engine that the bug doesn't already exist.
- in the request give as much information as possible such as: the OS, the version of AElf, how to reproduce...
- in the request give as much information as possible such as: the OS, the version of aelf, how to reproduce...

#### Missing feature

We also use the GitHub issue tracker for features. If you think that some piece of functionality is missing in AElf, you can open an issue with the following in mind:
We also use the GitHub issue tracker for features. If you think that some piece of functionality is missing in aelf, you can open an issue with the following in mind:
- check for similare feature requests already open.
- provide as much detail and context as possible.
- be as convincing as possible as to why we need this feature and how everybody can benefit from it.
Expand All @@ -83,8 +76,8 @@ When you are ready for a review by the core team, just remove ```[WIP]``` from y

## Versioning

We use Semantic Versioning (SemVer) for versioning, if you're intereted in closely following AElf's developement please check out the [SemVer docs](https://semver.org/).
We use Semantic Versioning (SemVer) for versioning, if you're interested in closely following aelf's development please check out the [SemVer docs](https://semver.org/).

## License

AElf is licenced under [MIT](https://github.com/AElfProject/AElf/blob/dev/LICENSE)
aelf is licenced under [MIT](https://github.com/AElfProject/AElf/blob/dev/LICENSE)
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
8 changes: 7 additions & 1 deletion contract/AElf.Contracts.MultiToken/TokenContract_Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,16 @@ private Address ExtractTokenContractAddress(ByteString bytes)
private void AssertCrossChainTransaction(Transaction originalTransaction, Address validAddress,
params string[] validMethodNames)
{
var validateResult = validMethodNames.Contains(originalTransaction.MethodName)
var validateResult = validMethodNames.Contains(MaybeRecoverInlineTransactionFunctionName(originalTransaction.MethodName))
&& originalTransaction.To == validAddress;
Assert(validateResult, "Invalid transaction.");
}

private static string MaybeRecoverInlineTransactionFunctionName(string methodName)
{
var parts = methodName.Split('.');
return parts.Length > 1 ? parts[^2] : methodName;
}

private void RegisterTokenInfo(TokenInfo tokenInfo)
{
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.303"
"version": "8.0.*"
}
}
10 changes: 10 additions & 0 deletions protobuf/aelf/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ message Transaction {
bytes signature = 10000;
}

message TransactionAndChainId {
Transaction transaction = 1;
int32 chain_id = 2;
}

message MultiTransaction {
repeated TransactionAndChainId transactions = 1;
bytes signature = 10000;
}

message StatePath {
// The partial path of the state path.
repeated string parts = 1;
Expand Down
15 changes: 15 additions & 0 deletions protobuf/inline_transaction.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

option csharp_namespace = "AElf.Types";


import "aelf/core.proto";
import "aelf/options.proto";

service InlineTransaction {
}

message InlineTransactionCreated {
option (aelf.is_event) = true;
aelf.Transaction transaction = 1 [(aelf.is_indexed) = true];
}
6 changes: 6 additions & 0 deletions protobuf/test_virtual_address_contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ service VirtualAddressContract {
option (aelf.base) = "acs1.proto";

rpc VirtualAddressVote(VirtualAddressVoteInput) returns (google.protobuf.Empty);
rpc VirtualAddressVoteWithInline(VirtualAddressVoteWithCountInput) returns (google.protobuf.Empty);
rpc VirtualAddressWithdraw(aelf.Hash) returns (google.protobuf.Empty);
rpc VirtualAddressChangeVotingOption(VirtualAddressChangeVotingOptionInput) returns (google.protobuf.Empty);
rpc VirtualAddressClaimProfit(VirtualAddressClaimProfitInput) returns (google.protobuf.Empty);
Expand All @@ -32,6 +33,11 @@ message VirtualAddressVoteInput {
aelf.Hash token = 4;
}

message VirtualAddressVoteWithCountInput {
VirtualAddressVoteInput vote_input = 1; // Existing input type
int32 count = 2; // Additional count input
}

message VirtualAddressChangeVotingOptionInput {
bool is_reset = 1;
aelf.Hash vote_id = 2;
Expand Down
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];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using AElf.Kernel;
using AElf.Kernel.Blockchain.Application;
using AElf.Kernel.FeatureDisable.Core;
using AElf.Kernel.SmartContract;
using AElf.Kernel.SmartContract.Application;
Expand All @@ -13,8 +14,8 @@ public class UnitTestPlainTransactionExecutingService : PlainTransactionExecutin
{
public UnitTestPlainTransactionExecutingService(ISmartContractExecutiveService smartContractExecutiveService,
IEnumerable<IPostExecutionPlugin> postPlugins, IEnumerable<IPreExecutionPlugin> prePlugins,
ITransactionContextFactory transactionContextFactory, IFeatureDisableService featureDisableService) : base(
smartContractExecutiveService, postPlugins, prePlugins, transactionContextFactory, featureDisableService)
ITransactionContextFactory transactionContextFactory, IFeatureDisableService featureDisableService,IBlockchainService blockchainService) : base(
smartContractExecutiveService, postPlugins, prePlugins, transactionContextFactory, featureDisableService,blockchainService)
{
}

Expand Down
13 changes: 13 additions & 0 deletions src/AElf.Kernel.Core/Extensions/TransactionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public static int Size(this Transaction transaction)

public static bool VerifySignature(this Transaction transaction)
{
if (transaction.IsInlineWithTransactionId())
{
return true;
}
if (!transaction.VerifyFields())
return false;

Expand All @@ -27,7 +31,16 @@ public static bool VerifySignature(this Transaction transaction)

public static bool VerifyExpiration(this Transaction transaction, long chainBranchBlockHeight)
{
if (transaction.IsInlineWithTransactionId())
{
return true;
}
return transaction.RefBlockNumber <= chainBranchBlockHeight &&
transaction.GetExpiryBlockNumber() > chainBranchBlockHeight;
}

public static bool IsInlineWithTransactionId(this Transaction transaction)
{
return transaction.MethodName.Contains(".");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
<ContractMessage Include="..\..\protobuf\virtual_transaction.proto">
<Link>Protobuf\Proto\virtual_transaction.proto</Link>
</ContractMessage>
<ContractMessage Include="..\..\protobuf\inline_transaction.proto">
<Link>Protobuf\Proto\inline_transaction.proto</Link>
</ContractMessage>
</ItemGroup>
</Project>
Loading

0 comments on commit 6880c6b

Please sign in to comment.