Skip to content

Commit

Permalink
Merge branch 'master' into dbft3.0-doublespeakers
Browse files Browse the repository at this point in the history
  • Loading branch information
vncoelho authored May 22, 2024
2 parents 0ac2035 + cf70a69 commit e84e4a0
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy
# Install the libleveldb-dev package
RUN apt-get update && apt-get install -y libleveldb-dev
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-jammy",
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "devcontainer.dockerfile"
},
"postCreateCommand": "dotnet build",
"customizations": {
"vscode": {
Expand Down
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Fixes # (issue)

<!-- Please delete options that are not relevant. -->

- [ ] Optimization (the change is only an optimization)
- [ ] Style (the change is only a code style for better maintenance or standard purpose)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ jobs:
dotnet test ./tests/Neo.Network.RPC.Tests /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json'
dotnet test ./tests/Neo.Plugins.OracleService.Tests /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json'
dotnet test ./tests/Neo.Plugins.RpcServer.Tests /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json'
dotnet test ./tests/Neo.Plugins.Storage.Tests /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json' /p:CoverletOutputFormat='lcov'
dotnet test ./tests/Neo.Plugins.Storage.Tests /p:CollectCoverage=true /p:CoverletOutput='${{ github.workspace }}/TestResults/coverage/' /p:MergeWith='${{ github.workspace }}/TestResults/coverage/coverage.json' /p:CoverletOutputFormat='cobertura'
- name: Coveralls
if: matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@v2.2.3
uses: coverallsapp/github-action@v2.3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
format: lcov
file: ${{ github.workspace }}/TestResults/coverage/coverage.info
format: cobertura
file: ${{ github.workspace }}/TestResults/coverage/coverage.cobertura.xml

PublishPackage:
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Neo.Plugins.Store.Models
{
public class ApplicationEngineLogModel
{
public UInt160 ScriptHash { get; private init; } = new();
public string Message { get; private init; } = string.Empty;
public required UInt160 ScriptHash { get; init; }
public required string Message { get; init; }

public static ApplicationEngineLogModel Create(EngineLogState logEventState) =>
new()
Expand Down
12 changes: 6 additions & 6 deletions src/Plugins/ApplicationLogs/Store/Models/BlockchainEventModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ namespace ApplicationLogs.Store.Models
{
public class BlockchainEventModel
{
public UInt160 ScriptHash { get; private init; } = new();
public string EventName { get; private init; } = string.Empty;
public StackItem[] State { get; private init; } = [];
public required UInt160 ScriptHash { get; init; }
public required string EventName { get; init; }
public required StackItem[] State { get; init; }

public static BlockchainEventModel Create(UInt160 scriptHash, string eventName, StackItem[] state) =>
public static BlockchainEventModel Create(UInt160 scriptHash, string eventName, params StackItem[] state) =>
new()
{
ScriptHash = scriptHash,
EventName = eventName ?? string.Empty,
State = state,
};

public static BlockchainEventModel Create(NotifyLogState notifyLogState, StackItem[] state) =>
public static BlockchainEventModel Create(NotifyLogState notifyLogState, params StackItem[] state) =>
new()
{
ScriptHash = notifyLogState.ScriptHash,
EventName = notifyLogState.EventName,
State = state,
};

public static BlockchainEventModel Create(ContractLogState contractLogState, StackItem[] state) =>
public static BlockchainEventModel Create(ContractLogState contractLogState, params StackItem[] state) =>
new()
{
ScriptHash = contractLogState.ScriptHash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@ namespace ApplicationLogs.Store.Models
{
public class BlockchainExecutionModel
{
public TriggerType Trigger { get; private init; } = TriggerType.All;
public VMState VmState { get; private init; } = VMState.NONE;
public string Exception { get; private init; } = string.Empty;
public long GasConsumed { get; private init; } = 0L;
public StackItem[] Stack { get; private init; } = [];
public BlockchainEventModel[] Notifications { get; set; } = [];
public ApplicationEngineLogModel[] Logs { get; set; } = [];
public required TriggerType Trigger { get; init; }
public required VMState VmState { get; init; }
public required string Exception { get; init; }
public required long GasConsumed { get; init; }
public required StackItem[] Stack { get; init; }
public required BlockchainEventModel[] Notifications { get; set; }
public required ApplicationEngineLogModel[] Logs { get; set; }

public static BlockchainExecutionModel Create(TriggerType trigger, ExecutionLogState executionLogState, StackItem[] stack) =>
public static BlockchainExecutionModel Create(TriggerType trigger, ExecutionLogState executionLogState, params StackItem[] stack) =>
new()
{
Trigger = trigger,
VmState = executionLogState.VmState,
Exception = executionLogState.Exception ?? string.Empty,
GasConsumed = executionLogState.GasConsumed,
Stack = stack,
Notifications = [],
Logs = []
};
}
}
2 changes: 1 addition & 1 deletion src/Plugins/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ protected virtual JToken TraverseIterator(JArray _params)
Guid sid = Result.Ok_Or(() => Guid.Parse(_params[0].GetString()), RpcError.InvalidParams.WithData($"Invalid session id {nameof(sid)}"));
Guid iid = Result.Ok_Or(() => Guid.Parse(_params[1].GetString()), RpcError.InvalidParams.WithData($"Invliad iterator id {nameof(iid)}"));
int count = _params[2].GetInt32();
Result.True_Or(() => count > settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
Result.True_Or(() => count <= settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
Session session;
lock (sessions)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/RpcServer/RpcServer.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ protected virtual JToken CancelTransaction(JArray _params)

var conflict = new TransactionAttribute[] { new Conflicts() { Hash = txid } };
Signer[] signers = _params.Count >= 2 ? ((JArray)_params[1]).Select(j => new Signer() { Account = AddressToScriptHash(j.AsString(), system.Settings.AddressVersion), Scopes = WitnessScope.None }).ToArray() : Array.Empty<Signer>();
(!signers.Any()).True_Or(RpcErrorFactory.BadRequest("No signer."));
signers.Any().True_Or(RpcErrorFactory.BadRequest("No signer."));
Transaction tx = new Transaction
{
Signers = signers,
Expand Down

0 comments on commit e84e4a0

Please sign in to comment.