neo-express icon indicating copy to clipboard operation
neo-express copied to clipboard

neo-trace fails to trace transaction - unknown storage item

Open ixje opened this issue 4 months ago • 2 comments

Describe the bug

Tracing transaction 0xbc7f37a01dd94142f873068d32bf80302eab11a08ac872cb61ddb11924895592 in block 7753996 (0xcd1f54fd5cd48e4af70814786a908807cda56f5591d667380d7d6fd0869ed71e)
Executing Transaction #0 (0x2facc946a30d45a73e5d1bf81ee6844a81507a1c860246f28da1ee195e11ffb1)
Executing Transaction #1 (0x3e141dace593af4a8c61ccbd676ae3a0ec280f881ccea4af7d8d4170b7634d98)
Executing Transaction #2 (0x852fced4b728773151192eea929e605c6e49bfdcad7b9ae826ba7e4986860bfa)
Unexpected script execution state. Expected HALT got FAULT reason: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> Neo.Network.RPC.RpcException: Unknown storage item
   at Neo.Network.RPC.RpcClient.AsRpcResponse(String content, Boolean throwOnError)
   at Neo.Network.RPC.RpcClient.Send(RpcRequest request, Boolean throwOnError)
   at Neo.Network.RPC.RpcClient.RpcSend(String method, JToken[] paraArgs)
   at Neo.BlockchainToolkit.Persistence.RpcClientExtensions.GetProof(RpcClient rpcClient, UInt256 rootHash, UInt160 scriptHash, ReadOnlySpan`1 key) in /home/erik/code/neo-express/src/bctklib/persistence/RpcClientExtensions.cs:line 27
   at Neo.BlockchainToolkit.Persistence.RpcClientExtensions.GetProvenState(RpcClient rpcClient, UInt256 rootHash, UInt160 scriptHash, ReadOnlySpan`1 key) in /home/erik/code/neo-express/src/bctklib/persistence/RpcClientExtensions.cs:line 41
   at Neo.BlockchainToolkit.Persistence.StateServiceStore.<>c__DisplayClass37_0.<TryGet>b__2() in /home/erik/code/neo-express/src/bctklib/persistence/StateServiceStore.cs:line 329
   at Neo.BlockchainToolkit.Persistence.StateServiceStore.GetStorage(UInt160 contractHash, ReadOnlyMemory`1 key, Func`1 getStorageFromService) in /home/erik/code/neo-express/src/bctklib/persistence/StateServiceStore.cs:line 359
   at Neo.BlockchainToolkit.Persistence.StateServiceStore.TryGet(Byte[] _key) in /home/erik/code/neo-express/src/bctklib/persistence/StateServiceStore.cs:line 328
   at Neo.BlockchainToolkit.Persistence.StateServiceStore.Contains(Byte[] key) in /home/erik/code/neo-express/src/bctklib/persistence/StateServiceStore.cs:line 383
   at Neo.BlockchainToolkit.Persistence.MemoryTrackingStore.Contains(Byte[] key, ImmutableDictionary`2 trackingMap, IReadOnlyStore`2 store) in /home/erik/code/neo-express/src/bctklib/persistence/MemoryTrackingStore.cs:line 68
   at Neo.BlockchainToolkit.Persistence.MemoryTrackingStore.Snapshot.Contains(Byte[] key) in /home/erik/code/neo-express/src/bctklib/persistence/MemoryTrackingStore.Snapshot.cs:line 79
   at Neo.Persistence.StoreCache.ContainsInternal(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/StoreCache.cs:line 84
   at Neo.Persistence.DataCache.Contains(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/DataCache.cs:line 331
   at Neo.Persistence.ClonedCache.ContainsInternal(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/ClonedCache.cs:line 35
   at Neo.Persistence.DataCache.Contains(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/DataCache.cs:line 331
   at Neo.Persistence.ClonedCache.ContainsInternal(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/ClonedCache.cs:line 35
   at Neo.Persistence.DataCache.Contains(StorageKey key) in /home/erik/code/neo-express/extras/neo/src/Neo/Persistence/DataCache.cs:line 331
   at Neo.SmartContract.Native.PolicyContract.IsBlocked(IReadOnlyStore snapshot, UInt160 account) in /home/erik/code/neo-express/extras/neo/src/Neo/SmartContract/Native/PolicyContract.cs:line 255
   at Neo.SmartContract.ApplicationEngine.CallContractInternal(ContractState contract, ContractMethodDescriptor method, CallFlags flags, Boolean hasReturnValue, IReadOnlyList`1 args) in /home/erik/code/neo-express/extras/neo/src/Neo/SmartContract/ApplicationEngine.cs:line 314
   at Neo.SmartContract.ApplicationEngine.CallContract(UInt160 contractHash, String method, CallFlags callFlags, Array args) in /home/erik/code/neo-express/extras/neo/src/Neo/SmartContract/ApplicationEngine.Contract.cs:line 85
   at InvokeStub_ApplicationEngine.CallContract(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Neo.SmartContract.ApplicationEngine.OnSysCall(InteropDescriptor descriptor) in /home/erik/code/neo-express/extras/neo/src/Neo/SmartContract/ApplicationEngine.cs:line 644
   at Neo.SmartContract.ApplicationEngine.OnSysCall(ExecutionEngine engine, Instruction instruction) in /home/erik/code/neo-express/extras/neo/src/Neo/SmartContract/ApplicationEngine.cs:line 268
   at Neo.VM.ExecutionEngine.ExecuteNext() in /home/erik/code/neo-express/extras/neo/src/Neo.VM/ExecutionEngine.cs:line 149

To Reproduce Apply the fixes of #485 and #486 , then run

neotrace transaction -r http://seed1.neo.org:10332 0xbc7f37a01dd94142f873068d32bf80302eab11a08ac872cb61ddb11924895592

Expected behavior created a working trace

Additional context Maybe the fix of #486 is at fault here, I don't know.

ixje avatar Aug 04 '25 15:08 ixje

Related with https://github.com/neo-project/neo-express/issues/486

shargon avatar Aug 12 '25 16:08 shargon

The problem is that GetProvenState in RpcClientExtensions doesn't handle exceptions correctly. PR to solve it #491

ajara87 avatar Aug 12 '25 22:08 ajara87