txpipe / pallas

Rust-native building blocks for the Cardano blockchain ecosystem
Apache License 2.0
147 stars 59 forks source link

`InvalidCbor` error when reading blocks from `sanchonet` on `Conway` era #410

Closed jpraynaud closed 1 month ago

jpraynaud commented 8 months ago

Context & versions

It looks like the blocks produced by the 8.8.0-pre Cardano node on the sanchonet network for the Conway era are not correctly parsed by Pallas 0.23.0

Steps to reproduce

We have tried to parse the blocks from latest immutable files produced on the sanchonet network with pallas-hardano and pallas-traverse:

let chunk = pallas_hardano::storage::immutable::chunk::read_blocks(Path::new("./immutable"), "05110").unwrap();

for block in chunk {
    let block = block.unwrap();
    pallas_traverse::MultiEraBlock::decode(&block).unwrap();
}

The immutable files are available on this Mithril snapshot

Actual behavior

We have received the error:

called `Result::unwrap()` on an `Err` value: InvalidCbor("unexpected type tag at position 864: expected array")

Expected behavior

The code should not have panicked and parsed a valid MultiEraBlock.

jpraynaud commented 8 months ago

Thanks for fixing the problem!

jpraynaud commented 7 months ago

Hi @scarmuega, it looks like there are some blocks produced on Sanchonet network that are still not correctly parsed.

Here is a log extract from a Mithril node running a pallas-hardano parser: parse-errors-tx-sanchonet-pallas-hardano.logs.txt

From what I see the errors are due to Invalid CBOR structure but there are several causes (at least the following ones):

Let me know if I need to create another issue or re-opening this one is fine :slightly_smiling_face:

jmhrpr commented 7 months ago

Please can you provide the file as you did before? I will take a look today

jpraynaud commented 7 months ago

Thanks @jmhrpr, here is the list of immutable files that are concerned:

jpraynaud commented 7 months ago

Yes you can use this snapshot

jmhrpr commented 7 months ago

Thank you, there is a PR which can successfully decode all these blocks. Do let me know if you run into any other issues

jpraynaud commented 7 months ago

Thanks for the fix :slightly_smiling_face:

jpraynaud commented 5 months ago

Hi @jmhrpr @scarmuega,

I have noticed a problem in the parsing of blocks for the immutable file 06470.chunk in Sanchonet network.

Here is the error message that I receive:

Invalid CBOR structure: 18446744073709551615 overflows target type at position 1068: when converting u64 to u32

The immutable file is available in this snasphot

Thanks for your support :slightly_smiling_face:

scarmuega commented 5 months ago
Invalid CBOR structure: 18446744073709551615 overflows target type at position 1068: when converting u64 to u32

@jpraynaud fixed by #462

jpraynaud commented 5 months ago

@jpraynaud fixed by #462

Thanks @scarmuega!

jpraynaud commented 4 months ago

Hi @jmhrpr @scarmuega,

I have noticed another problem in the parsing of blocks for the immutable file 07271.chunk in Sanchonet network.

Here is the error message that I receive (which is very similar to the previous overflow you fixed):

Invalid CBOR structure: 9223372036854775807 overflows target type at position 1242: when converting u64 to u32

We are running the version 0.27.0 of pallas.

The immutable file is available in this snasphot.

Thanks for your support!

scarmuega commented 4 months ago

@jpraynaud on it

scarmuega commented 4 months ago

@jpraynaud I sent PR #473 to increase the uint size that was failing.

Regardless, I think that the Tx with issues is not compatible with the official CDDL: https://github.com/IntersectMBO/cardano-ledger/blob/cb30d895b866ccd5d8c529212208aca0c913b9c2/eras/conway/impl/cddl-files/conway.cddl#L402C11-L402C23

The value found in the Tx is 18446744073709551615 which doesn't fit in a uint .size 2

scarmuega commented 4 months ago

submitted to ledger repo here: https://github.com/IntersectMBO/cardano-ledger/issues/4421