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 8174680
Show file tree
Hide file tree
Showing 2 changed files with 15 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
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

0 comments on commit 8174680

Please sign in to comment.