Skip to content

Commit

Permalink
fix(node): update distpacher stack item return
Browse files Browse the repository at this point in the history
  • Loading branch information
spencercorwin committed Jun 11, 2021
1 parent cc38afc commit 9dac074
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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
15 changes: 14 additions & 1 deletion packages/neo-one-node-vm/lib/ReturnHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public PrimitiveReturn(PrimitiveType item, dynamic value)
}
}


public class PointerReturn
{
public readonly byte[] value;
Expand Down Expand Up @@ -106,6 +107,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 +148,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

0 comments on commit 9dac074

Please sign in to comment.