5

We load tested our chain by calling the remark with events extrinsics. We used batch to have more than 33K transactions in multiple batches in one block.

The block was processed correctly even if it took a little bit more time. But the number of event was greater than u16 (65_535). This means that the block events could not be decoded by any other part of the infrastructure (indexers, explorer, polka-js, ...).

Error: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: Vec length 72264 exceeds 65536

I know there are safeguard around this:

  • Transaction pool transaction limit (can be bypassed using batches).
  • Transaction pool size limit (not reached by those extrinsics).
  • The price of those transactions without any economic incentives.
  • We could manually increase the weight (which is a bad practice in my sense)
  • We could decrease the compute time in the block (the compute time was ok, 800B/2000B, only event count was off)

After that, I wondered how other chains were doing it, and I managed to reproduce the same issue on Polkadot for an amount between 100 and 200 dot (this was done on v1.0.0 because our chain used the same, I don't know if something was done in the meantime).

My question is:

What would be a good way to handle this issue ?

5
  • 1
    Great question, but I'd suggest raising this in the issue tracker (if it's not there already).
    – Squirrel
    Commented Jan 15 at 15:22
  • 1
    Btw I love that you're load testing with is that 5,000tps?
    – Squirrel
    Commented Jan 15 at 15:23
  • 3
    Where does the error appear? In Polkadot or in something interfacing with a Polkadot node? I tested blocks with 300K+ events in the past and they were processed. But maybe PolkadotJS or indexers are assuming a u16 where it should be a u64. Commented Jan 15 at 16:05
  • Indeed, we got to pump the numbers 😅.
    – Leouarz
    Commented Jan 16 at 9:07
  • 1
    @OliverTale-Yazdi thank you for your answer, as mentionned, the block is process correctly, the issue is from interfacing with the node.
    – Leouarz
    Commented Jan 16 at 9:08

1 Answer 1

3

What would be a good way to handle this issue ?

Opening an issue in PolkadotJs/App. Otherwise you can use the Python bindings:

from substrateinterface import SubstrateInterface
chain = SubstrateInterface(url="ws://127.0.0.1:9944")

events = chain.query("System", "Events", block_hash="0x...")
for event in events:
    ...

Could also be that PJS can circumvent this bug by using the storage iteration API to iterate on the keys directly. Then it could load the events in chunks instead of all at once and dying.
The Rust bindings could also work, but did not try: https://github.com/paritytech/subxt

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.