question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Array size too big` after receiving block containing Ordinal NFT

See original GitHub issue

This block made Wasabi filter creation process to halt because NBitcoin said that Array size too big however next time it run it past. I cannot make it fail locally so, it seems there is some special condition that is not deterministic.

2023-02-01 20:38:39.917 [537] ERROR     PeriodicRunner.ExecuteAsync (107)       System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Array size too big')
   at NBitcoin.Protocol.VarString.StaticRead(BitcoinStream bs, Byte[]& bytes)
   at NBitcoin.WitScript.ReadCore(BitcoinStream stream)
   at NBitcoin.Witness.ReadWrite(BitcoinStream stream)
   at NBitcoin.Transaction.ReadWrite(BitcoinStream stream)
   at NBitcoin.BitcoinStream.ReadWrite[T](T& data)
   at NBitcoin.BitcoinStream.ReadWrite[T](List`1& list)
   at NBitcoin.Block.ReadWrite(BitcoinStream stream)
   at NBitcoin.Block.Parse(String hex, ConsensusFactory consensusFactory)
   at NBitcoin.RPC.RPCClient.GetBlockAsync(uint256 blockId, CancellationToken cancellationToken)
   at WalletWasabi.BitcoinCore.Rpc.RpcClientBase.GetBlockAsync(uint256 blockHash, CancellationToken cancellationToken)
   at WalletWasabi.Extensions.TaskExtensions.WithAwaitCancellationAsync[T](Task`1 task, CancellationToken cancellationToken)
   at WalletWasabi.Cache.IdempotencyRequestCache.GetCachedResponseAsync[TRequest,TResponse](TRequest request, ProcessRequestDelegateAsync`2 action, MemoryCacheEntryOptions options, CancellationToken cancellationToken)
   at WalletWasabi.Cache.IdempotencyRequestCache.GetCachedResponseAsync[TRequest,TResponse](TRequest request, ProcessRequestDelegateAsync`2 action, MemoryCacheEntryOptions options, CancellationToken cancellationToken)
   at WalletWasabi.BitcoinCore.Rpc.CachedRpcClient.GetBlockAsync(uint256 blockHash, CancellationToken cancellationToken)
   at WalletWasabi.Blockchain.Blocks.BlockNotifier.ActionAsync(CancellationToken cancel)
   at WalletWasabi.Bases.PeriodicRunner.ExecuteAsync(CancellationToken stoppingToken)

NBitcoin version: v7.0.14

This is the block: 0000000000000000000515e202c8ae73c8155fc472422d7593af87aa74f2cf3d

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lontiverocommented, Feb 2, 2023

7.0.14 Failure

$dotnet fsi

Microsoft (R) F# Interactive version 12.4.0.0 for F# 7.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "nuget:NBitcoin, 7.0.14";;
[Loading /home/*******/.packagemanagement/nuget/Cache/ed5af0b61ac615c41fd6fabcfdcd308332b56fd34a6a0e77f6378a7f200be1eb.fsx]
module FSI_0002.
       Ed5af0b61ac615c41fd6fabcfdcd308332b56fd34a6a0e77f6378a7f200be1eb

> open NBitcoin
- open System
- open System.IO;;
> let binBlock = File.ReadAllBytes "offending-block.hex";;
val binBlock: byte array =
  [|0uy; 0uy; 150uy; 40uy; 26uy; 43uy; 251uy; 207uy; 211uy; 15uy; 12uy; 193uy;
    41uy; 216uy; 218uy; 230uy; 71uy; 211uy; 205uy; 190uy; 109uy; 24uy; 189uy;
    141uy; 38uy; 96uy; 5uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 92uy;
    96uy; 180uy; 6uy; 48uy; 78uy; 14uy; 130uy; 138uy; 80uy; 99uy; 46uy; 144uy;
    216uy; 196uy; 217uy; 161uy; 203uy; 213uy; 156uy; 225uy; 174uy; 54uy; 66uy;
    100uy; 145uy; 191uy; 25uy; 222uy; 2uy; 137uy; 73uy; 201uy; 205uy; 218uy;
    99uy; 32uy; 39uy; 7uy; 23uy; 84uy; 112uy; 78uy; 208uy; 63uy; 1uy; 0uy; 0uy;
    0uy; 0uy; 1uy; 1uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy;
    0uy; ...|]

> Block.Load (binBlock, Network.Main);;
Binding session to '/home/******/.nuget/packages/nbitcoin/7.0.14/lib/net6.0/NBitcoin.dll'...
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Array size too big')
   at NBitcoin.Protocol.VarString.StaticRead(BitcoinStream bs, Byte[]& bytes)
   at NBitcoin.BitcoinStream.ReadWriteAsVarString(Byte[]& bytes)
   at NBitcoin.WitScript.ReadPush(BitcoinStream stream)
   at NBitcoin.WitScript.ReadCore(BitcoinStream stream)
   at NBitcoin.WitScript.Load(BitcoinStream stream)
   at NBitcoin.Witness.ReadWrite(BitcoinStream stream)
   at NBitcoin.Transaction.ReadWrite(BitcoinStream stream)
   at NBitcoin.BitcoinStream.ReadWrite[T](T& data)
   at NBitcoin.BitcoinStream.ReadWrite[T](List`1& list)
   at NBitcoin.Block.ReadWrite(BitcoinStream stream)
   at NBitcoin.BitcoinSerializableExtensions.ReadWrite(IBitcoinSerializable serializable, Stream stream, Boolean serializing, ConsensusFactory consensusFactory, Nullable`1 version)
   at NBitcoin.BitcoinSerializableExtensions.ReadWrite(IBitcoinSerializable serializable, Byte[] bytes, ConsensusFactory consensusFactory, Nullable`1 version)
   at NBitcoin.Block.Load(Byte[] hex, ConsensusFactory consensusFactory)
   at NBitcoin.Block.Load(Byte[] hex, Network network)
   at <StartupCode$FSI_0005>.$FSI_0005.main@() in /home/lontivero/temp/offending-block/stdin:line 8
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Stopped due to error
>

7.0.16 Succeed

$ dotnet fsi

Microsoft (R) F# Interactive version 12.4.0.0 for F# 7.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "nuget:NBitcoin, 7.0.16";;
[Loading /home/******/.packagemanagement/nuget/Cache/e0cf6f4ced56078898977759b15f59b26edfaa4739ce74f671ca628e1ba71ed8.fsx]
module FSI_0002.
       E0cf6f4ced56078898977759b15f59b26edfaa4739ce74f671ca628e1ba71ed8

> open NBitcoin
- open System
- open System.IO;;
> let binBlock = File.ReadAllBytes "offending-block.hex";;
val binBlock: byte array =
  [|0uy; 0uy; 150uy; 40uy; 26uy; 43uy; 251uy; 207uy; 211uy; 15uy; 12uy; 193uy;
    41uy; 216uy; 218uy; 230uy; 71uy; 211uy; 205uy; 190uy; 109uy; 24uy; 189uy;
    141uy; 38uy; 96uy; 5uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 92uy;
    96uy; 180uy; 6uy; 48uy; 78uy; 14uy; 130uy; 138uy; 80uy; 99uy; 46uy; 144uy;
    216uy; 196uy; 217uy; 161uy; 203uy; 213uy; 156uy; 225uy; 174uy; 54uy; 66uy;
    100uy; 145uy; 191uy; 25uy; 222uy; 2uy; 137uy; 73uy; 201uy; 205uy; 218uy;
    99uy; 32uy; 39uy; 7uy; 23uy; 84uy; 112uy; 78uy; 208uy; 63uy; 1uy; 0uy; 0uy;
    0uy; 0uy; 1uy; 1uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy;
    0uy; ...|]

> let block = Block.Load (binBlock, Network.Main);;
Binding session to '/home/*****/.nuget/packages/nbitcoin/7.0.16/lib/net6.0/NBitcoin.dll'...
val block: Block

Still don’t understand how it is that we are not affected.

0reactions
lontiverocommented, Feb 2, 2023

Umm that was added in version 7.0.16 and we have 7.0.14, however we are not stuck. I will do some better tests and go back with results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scalable Generative Inscriptions on BTC · ordinals ord
Generative NFTs can create a rich set of NFTs at very small data sizes. ... of inscribing large collections we may devise an...
Read more >
What are Bitcoin Ordinals? All About Bitcoin NFTs
Bitcoin NFTs surge amidst collectibles bear market, but what makes Ordinals different?
Read more >
NFTs Are Bloating Bitcoin, Creating Risks And ...
SegWit increased Bitcoin's block size from 1 megabyte to 4 megabytes and Taproot loosened requirements for data limits, allowing the full 4 ...
Read more >
Unveiling the Mysteries of Ordinal Inscriptions
Because the block size has an upper limit (about 1 MB), miners will give priority to confirm transactions with high transaction rate ...
Read more >
Bitcoin Ordinals – Will The Bitcoin NFT Ecosystem be ...
Segwit and Taproot upgrades have changed the block size of Bitcoin which has made a path for Ordinals. Recently, a report by Galaxy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found