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

BSC Block 30501963 is NULL??? #989

Open
litsegaard opened this issue Nov 24, 2023 · 3 comments
Open

BSC Block 30501963 is NULL??? #989

litsegaard opened this issue Nov 24, 2023 · 3 comments

Comments

@litsegaard
Copy link

litsegaard commented Nov 24, 2023

I have a log processor for a contract's transfer events which I execute asynchronously. It's been running for a couple of days and traversed roughly 2 500 000 blocks. However, when I visit block number 30501963 using something like this:

blockFromChain = await web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(sl.Log.BlockNumber)

I always get a "Block is NULL" exception. I have an IBlockProgressRepository saving the progress but it doesn't matter how many times I restart the application - block 30501963 simply does not exist. Am I living in a (naive?) world where blocks are always committed no matter how few tx:s there are? Is this a wrong assumption? If this is the case how should NULL blocks be interpreted?

I'm definitely do not say this is a Nethereum issue but in the unlikely event it is, I thought I'd better ask here.

I'm using a premium Ankr RPC-endpoint towards the BSC chain in a .Net 7 C# console app and the combination Nethereum/Ankr RPC has been working extremely well so far.

Many thanks in advance!

@litsegaard
Copy link
Author

Typo :)

@litsegaard
Copy link
Author

I needed to rephrase my issue as it turns out that calling GetBlockWithTransactionsByNumber asynchronoulsy from within a ProcessorForContract frequently returns NULLs. If I execute the following:

HexBigInteger blockNumber = new HexBigInteger(sl.Log.BlockNumber);
blockFromChain = await web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(blockNumber);

I very often get a NULL value in blockFromChain but if I select "set next statement" from within the VS debugger and selects the async call again it will indeed return a block. To me it seems that the async call doesn't wait 'til the actual block has been returned. The reason I make a GetBlockWithTransactionsByNumber from within my (Create)ProcessorForContract async method is that I need to get the actual block timestamp as my TransferEventDTO doesn't include a timestamp in the .Log or .Event objects. If there's a better way to accomplish this I'm all ears :) The async method I'm referring to looks like:

var logsProcessor = web3.Processing.Logs.CreateProcessorForContract<TransferEventDTO>(ContractAddress, (Func<EventLog<TransferEventDTO>, Task>)(async sl =>
{
   HexBigInteger blockNumber = new HexBigInteger(sl.Log.BlockNumber);
   blockFromChain = await web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(blockNumber);
   code goes here...
}

Many thanks in advance!

@AleksandarDevic
Copy link

Any update about that issue?

I have also that scenario, where after a certain time providers return null for the method GetBlockWithTransactionsByNumber.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants