Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
7d3b346
Added `neo-build` new branch
cschuchardt88 Jun 15, 2025
0728703
Add debug sink
cschuchardt88 Jun 15, 2025
39b3d6c
Add more debug logging and fixes
cschuchardt88 Jun 15, 2025
9e7d337
Added Provider
cschuchardt88 Jun 15, 2025
3b8ba05
Fixes to ApplicationEngine Threading
cschuchardt88 Jun 16, 2025
538e5b4
Fix: P/Invokes should not be visible (#4003)
Wi1l-B0t Jun 16, 2025
14a7c22
[Optimization] - Optimize key method (#4001)
ajara87 Jun 18, 2025
5a01a56
Fix Threading hanging with `NeoSystem` (#4005)
cschuchardt88 Jun 18, 2025
f864e8a
Style: unify json init style (#4004)
Wi1l-B0t Jun 18, 2025
0dad015
Update packages (#4006)
shargon Jun 19, 2025
1ebd85d
Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context…
vncoelho Jun 20, 2025
6d59406
Style: move MPT Benchamrk Project to benchmarks/ (#4011)
Wi1l-B0t Jun 21, 2025
6d711c0
[`improve`] nullable app logs (#4008)
shargon Jun 21, 2025
67915b2
Fix: remove FluentAssertions in notary tests (#4014)
Wi1l-B0t Jun 21, 2025
7036374
Add: SignClient Vsock support (#4002)
Wi1l-B0t Jun 23, 2025
6c7f6c4
Comments: add Exception info for numeric ops (#4021)
Wi1l-B0t Jun 25, 2025
d677a28
Merge `dev` into `this`
cschuchardt88 Jun 25, 2025
e4c2403
Merge `neo-build.dev` into `this`
cschuchardt88 Jun 26, 2025
e423b54
Fixes
cschuchardt88 Jun 26, 2025
3ff1ee9
Ran `dotnet format`
cschuchardt88 Jun 26, 2025
8fc2262
init project
cschuchardt88 Jul 5, 2025
7ddedf8
Changed method to static for lamda
cschuchardt88 Jul 5, 2025
a5f1773
changed variable name
cschuchardt88 Jul 5, 2025
506efb9
Fixed extensions and add helper classes
cschuchardt88 Jul 5, 2025
d05a385
Switched to using Indexer
cschuchardt88 Jul 5, 2025
cf711a5
Add executescript
cschuchardt88 Jul 7, 2025
0e243f9
Added more tests
cschuchardt88 Jul 7, 2025
86401e1
Merge `neo-build.dev` into `this`
cschuchardt88 Jul 8, 2025
4a13fd9
Fixes and removal of used code
cschuchardt88 Jul 8, 2025
96def0c
Merge `neo-build.dev` into `this`
cschuchardt88 Jul 9, 2025
b9db2c5
Fix `using` statement
cschuchardt88 Jul 9, 2025
3e2d91c
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Jul 10, 2025
a60a29d
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Jul 11, 2025
84afc6f
Fixed tests
cschuchardt88 Jul 12, 2025
a820598
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
shargon Jul 13, 2025
e255f85
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Jul 16, 2025
63da272
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Jul 18, 2025
1c3d5b8
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Jul 29, 2025
d755733
Add snapshot storage events
cschuchardt88 Jul 29, 2025
db3ec5a
Merge branch 'neo-build.dev/add/debugger-engine' of github.com:cschuc…
cschuchardt88 Jul 29, 2025
2496f0d
Merge
cschuchardt88 Jul 31, 2025
85b99c9
added `RandomNumberFactory`
cschuchardt88 Jul 31, 2025
c1330cf
fixes
cschuchardt88 Jul 31, 2025
544c439
Fixed breakpoints
cschuchardt88 Jul 31, 2025
6468a27
fixed bug with breakpoints
cschuchardt88 Jul 31, 2025
7c82a25
fixed tests
cschuchardt88 Jul 31, 2025
a3803d5
some name changes
cschuchardt88 Jul 31, 2025
ed397ff
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
shargon Jul 31, 2025
e0ca5f5
Fixed `IEquatable` for `Breakpoint`
cschuchardt88 Jul 31, 2025
0c25f92
Merge branch 'neo-build.dev/add/debugger-engine' of github.com:cschuc…
cschuchardt88 Jul 31, 2025
9dc269b
Added back `RandomNumberFactory` (core version)
cschuchardt88 Jul 31, 2025
ffc28ad
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
shargon Aug 3, 2025
ad02c73
Merge branch 'neo-build.dev' into neo-build.dev/add/debugger-engine
cschuchardt88 Aug 5, 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
4 changes: 4 additions & 0 deletions src/neo-build/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@
<None Include="../../../.neo/README.md" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>

<ItemGroup>
<Compile Include="../../IsExternalInit.cs" Visible="false" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2015-2025 The Neo Project.
//
// ContractScriptHashAttribute.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;

namespace Neo.Build.Core.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
public class ContractScriptHashAttribute(
UInt160 scriptHash) : Attribute
{
public UInt160 ScriptHash { get; } = scriptHash;

public ContractScriptHashAttribute(
string scriptHash) : this(UInt160.Parse(scriptHash))
{ }
}
}
2 changes: 1 addition & 1 deletion src/neo-build/Neo.Build.Core/Builders/BlockBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.Build.Core.Factories;
using Neo.Builders;
using Neo.Cryptography;
using Neo.Extensions.Factories;
using Neo.Network.P2P.Payloads;
using System;
using System.Linq;
Expand Down
51 changes: 51 additions & 0 deletions src/neo-build/Neo.Build.Core/Extensions/ScriptBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (C) 2015-2025 The Neo Project.
//
// ScriptBuilderExtensions.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.Build.Core.Helpers;
using Neo.Extensions;
using Neo.SmartContract;
using Neo.VM;
using System;
using System.Linq.Expressions;

namespace Neo.Build.Core.Extensions
{
public static class ScriptBuilderExtensions
{
public static ScriptBuilder EmitContractCall<T>(this ScriptBuilder builder, Expression<Action<T>> expression)
where T : class
{
var methodCallBody = (MethodCallExpression)expression.Body;
var methodName = methodCallBody.Method.Name;
var scriptHash = NeoBuildAttributeHelper.ExtractContractScriptHash(typeof(T));

if (char.IsLower(methodName[0]) == false)
methodName = char.ToLower(methodName[0]) + methodName[1..];

for (var i = methodCallBody.Arguments.Count - 1; i >= 0; i--)
{
var argumentValue = Expression.Lambda(methodCallBody.Arguments[i])
.Compile()
.DynamicInvoke();
builder.EmitPush(argumentValue);
}

builder.EmitPush(methodCallBody.Arguments.Count);
builder.Emit(OpCode.PACK);
builder.EmitPush(CallFlags.All);
builder.EmitPush(methodName);
builder.EmitPush(scriptHash);
builder.EmitSysCall(ApplicationEngine.System_Contract_Call);

return builder;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (C) 2015-2025 The Neo Project.
//
// ApplicationEngineExtensions.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.Build.Core.Exceptions;
using Neo.Build.Core.Helpers;
using Neo.Build.Core.SmartContract.Debugger;
using Neo.Persistence;
using Neo.SmartContract;
using Neo.SmartContract.Native;
using Neo.VM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace Neo.Build.Core.Extensions.SmartContract
{
public static class ApplicationEngineExtensions
{
public static VMState ExecuteScript(this ApplicationEngine engine, Script script)
{
engine.LoadScript(script);
return engine.Execute();
}

public static VMState ExecuteScript<T>(this ApplicationEngine engine, Expression<Action<T>> expression)
where T : class
{
engine.LoadScript(expression);
return engine.Execute();
}

public static void LoadScript<T>(this ApplicationEngine engine, Expression<Action<T>> expression)
where T : class
{
using var sb = new ScriptBuilder()
.EmitContractCall(expression);
engine.LoadScript(sb.ToArray());
}

public static ContractState GetContractState<T>(this ApplicationEngine engine)
where T : class
{
var scriptHash = NeoBuildAttributeHelper.ExtractContractScriptHash(typeof(T));
if (scriptHash != UInt160.Zero)
return engine.GetContractState(scriptHash);
else
{
var contractName = NeoBuildAttributeHelper.ExtractContractName(typeof(T));
return engine.GetContractState(contractName);
}
}

public static ContractState GetContractState(this ApplicationEngine engine, string contractName)
{
var snapshot = engine.SnapshotCache;

foreach (var contractState in NativeContract.ContractManagement.ListContracts(snapshot))
{
if (contractName.Equals(contractState.Manifest.Name))
return contractState;
}

// TODO: Make this exception it own class
throw new NeoBuildException($"Contract '{contractName}' not found.", NeoBuildErrorCodes.Contracts.ContractNotFound);
}

public static ContractState GetContractState(this ApplicationEngine engine, int id)
{
var snapshot = engine.SnapshotCache;

foreach (var contractState in NativeContract.ContractManagement.ListContracts(snapshot))
{
if (contractState.Id == id)
return contractState;
}

// TODO: Make this exception it own class
throw new NeoBuildException($"Contract with Id '{id}' not found.", NeoBuildErrorCodes.Contracts.ContractNotFound);
}

public static ContractState GetContractState(this ApplicationEngine engine, UInt160 scriptHash)
{
var snapshot = engine.SnapshotCache;

foreach (var contractState in NativeContract.ContractManagement.ListContracts(snapshot))
{
if (contractState.Hash == scriptHash)
return contractState;
}

// TODO: Make this exception it own class
throw new NeoBuildException($"Contract '{scriptHash}' was not found.", NeoBuildErrorCodes.Contracts.ContractNotFound);
}

public static HashSet<DebugStorage> GetContractStorage<T>(this ApplicationEngine engine, byte[]? prefix = null, SeekDirection seekDirection = SeekDirection.Forward)
where T : class
{
prefix ??= [];

var contractState = engine.GetContractState<T>();
var key = StorageKey.CreateSearchPrefix(contractState.Id, prefix);
var snapshot = engine.SnapshotCache;

return [.. snapshot.Find(key, seekDirection).Select(static s => new DebugStorage(s.Key, s.Value, StorageEvent.Read))];
}
}
}
Loading
Loading