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

fix(node): update distpacher stack item return #2418

Merged
merged 1 commit into from
Jun 11, 2021
Merged
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
4 changes: 2 additions & 2 deletions packages/neo-one-node-vm/lib/Dispatcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
<PackageReference Include="RocksDbNative" Version="6.2.2" />
<PackageReference Include="RocksDbSharp" Version="6.2.2" />
<!-- <PackageReference Include="Neo-VM-N1-Fork" Version="3.0.0-rc3" />
<PackageReference Include="Neo-NEO-ONE-Fork" Version="3.0.0-rc3" /> -->
<!-- <PackageReference Include="Neo-VM-N1-Fork" Version="3.0.0-rc3" /> -->
<!-- <PackageReference Include="Neo-NEO-ONE-Fork" Version="3.0.0-rc3" /> -->
<ProjectReference Include="/Users/spencercorwin/neo/src/neo/neo.csproj" />
<ProjectReference Include="/Users/spencercorwin/neo-vm/src/neo-vm/neo-vm.csproj" />
</ItemGroup>
Expand Down
14 changes: 13 additions & 1 deletion packages/neo-one-node-vm/lib/ReturnHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ public MapReturn(Map item)
}
}

public class BufferReturn
{
public byte[] value;
public StackItemType Type => StackItemType.Buffer;
public readonly bool IsNull;
public BufferReturn(Neo.VM.Types.Buffer item)
{
this.value = item.InnerBuffer;
this.IsNull = item.IsNull;
}
}

public class InteropInterfaceReturn
{
public dynamic value;
Expand Down Expand Up @@ -135,7 +147,7 @@ public static dynamic convertStackItem(StackItem item)
return item.Type switch
{
StackItemType.Any => item,
StackItemType.Buffer => item,
StackItemType.Buffer => new BufferReturn((Neo.VM.Types.Buffer)item),
StackItemType.Pointer => new PointerReturn((Neo.VM.Types.Pointer)item),
StackItemType.Array => new ArrayReturn((Neo.VM.Types.Array)item),
StackItemType.Struct => new StructReturn((Struct)item),
Expand Down