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

Classes related to Neo.SmartContract types should not be internal #1783

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public ExecutionContext LoadScript(Script script, CallFlags callFlags)
return context;
}

internal StackItem Convert(object value)
protected internal StackItem Convert(object value)
{
return value switch
{
Expand All @@ -174,7 +174,7 @@ internal StackItem Convert(object value)
};
}

internal object Convert(StackItem item, InteropParameterDescriptor descriptor)
protected internal object Convert(StackItem item, InteropParameterDescriptor descriptor)
{
if (descriptor.IsArray)
{
Expand Down Expand Up @@ -224,7 +224,7 @@ protected override void OnSysCall(uint method)
if (!state.CallFlags.HasFlag(descriptor.RequiredCallFlags))
throw new InvalidOperationException($"Cannot call this SYSCALL with the flag {state.CallFlags}.");
AddGas(descriptor.FixedPrice);
List<object> parameters = descriptor.Parameters.Length > 0
List<object> parameters = descriptor.Parameters.Count > 0
? new List<object>()
: null;
foreach (var pd in descriptor.Parameters)
Expand Down
2 changes: 1 addition & 1 deletion src/neo/SmartContract/Callbacks/SyscallCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Neo.SmartContract.Callbacks
internal class SyscallCallback : CallbackBase
{
public InteropDescriptor Method { get; }
public override int ParametersCount => Method.Parameters.Length;
public override int ParametersCount => Method.Parameters.Count;

public SyscallCallback(uint method, bool check = true)
{
Expand Down
5 changes: 3 additions & 2 deletions src/neo/SmartContract/InteropDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Neo.Cryptography;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
Expand All @@ -11,7 +12,7 @@ public class InteropDescriptor
public string Name { get; }
public uint Hash { get; }
internal MethodInfo Handler { get; }
internal InteropParameterDescriptor[] Parameters { get; }
public IReadOnlyList<InteropParameterDescriptor> Parameters { get; }
public long FixedPrice { get; }
public CallFlags RequiredCallFlags { get; }
public bool AllowCallback { get; }
Expand All @@ -21,7 +22,7 @@ internal InteropDescriptor(string name, MethodInfo handler, long fixedPrice, Cal
this.Name = name;
this.Hash = BitConverter.ToUInt32(Encoding.ASCII.GetBytes(name).Sha256(), 0);
this.Handler = handler;
this.Parameters = handler.GetParameters().Select(p => new InteropParameterDescriptor(p)).ToArray();
this.Parameters = handler.GetParameters().Select(p => new InteropParameterDescriptor(p)).ToList();
this.FixedPrice = fixedPrice;
this.RequiredCallFlags = requiredCallFlags;
this.AllowCallback = allowCallback;
Expand Down
6 changes: 3 additions & 3 deletions src/neo/SmartContract/InteropParameterDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Neo.SmartContract
{
internal class InteropParameterDescriptor
public class InteropParameterDescriptor
{
public string Name { get; }
public Type Type { get; }
Expand Down Expand Up @@ -39,13 +39,13 @@ internal class InteropParameterDescriptor
[typeof(ECPoint)] = p => p.IsNull ? null : ECPoint.DecodePoint(p.GetSpan(), ECCurve.Secp256r1),
};

public InteropParameterDescriptor(ParameterInfo parameterInfo)
internal InteropParameterDescriptor(ParameterInfo parameterInfo)
: this(parameterInfo.ParameterType)
{
this.Name = parameterInfo.Name;
}

public InteropParameterDescriptor(Type type)
internal InteropParameterDescriptor(Type type)
{
this.Type = type;
if (IsEnum)
Expand Down