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

[Error while decoding block] Couldn't unmarshal interface: unknown type ID 35 #3589

Open
KBA07 opened this issue Dec 12, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@KBA07
Copy link

KBA07 commented Dec 12, 2024

Describe the bug
We are facing an issue while decoding the block 170518
The given block has the hex value of
0x000000000020000000006744a346fa54cec747d9871169460fbe86c880dc6e5ab94699b7ee6606bed98ca1b8c9310000000000029a160000000100000023000000050000000000000000000000000000000000000000000000000000000000000000000000013d9bdac0ed1d761330cf680efdeb1a42159eb387d6d2950c96f7d28f61bbe2aa0000000700000000ee6a65a200000000000000000000000100000001058974ce825b7c50136a2451d98b03a80c1ee08400000001b40053e8b6debcad3ded712d58a7a5acc3b92c31912632f5faf6d29cd7621f18000000003d9bdac0ed1d761330cf680efdeb1a42159eb387d6d2950c96f7d28f61bbe2aa00000005000000012a058b02000000010000000000000000def4104644cf4e9c3a6dae8169bfb658d558b4abb97c69cf7821682e5727bd05b40053e8b6debcad3ded712d58a7a5acc3b92c31912632f5faf6d29cd7621f18000000000000000100000014c582872c37c81efa2c94ea347af49cdc23a830aa000000000000c137000000003b9aca00a3783a891cb41cadbfcf456da149f30e7af972677a162b984bef0779f254baac51ec042df1781d1295df80fb41c801269731fc6c25e1e5940dc3cb8509e30348fa712742cfdc83678acc9f95908eb98b89b28802fb559b4a2a6ff3216707c07f0ceb0b45a95f4f9a9540bbd3331d8ab4f233bffa4abb97fad9d59a1695f31b92a2b89e365facf7ab8c30de7c4a496d1e00000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c0000000100000001058974ce825b7c50136a2451d98b03a80c1ee0840000000a00000001000000000000000200000009000000016cd104dbcc1c34f930a83b1952c8f47fed74d8b7048fde45880788a07391d7280a4738863e4ac9ab65c6ea861b103c2b693b7e59d804ec4bc632acd65e863f1b0000000009000000016cd104dbcc1c34f930a83b1952c8f47fed74d8b7048fde45880788a07391d7280a4738863e4ac9ab65c6ea861b103c2b693b7e59d804ec4bc632acd65e863f1b00ed62c79a

To Reproduce
The code used to decode this block hex is

blockBytes, err := formatting.Decode(formatting.Hex, blockHex)
	if err != nil {
		return nil, xerrors.Errorf("formatting.Decode: %w", err)
	}

	var blk block.BanffBlock
	if _, err := agCodecManager.Unmarshal(blockBytes, &blk); err != nil {
		return nil, xerrors.Errorf("unmarshal block: %w", err)
	}

The code used for initializing the agCodecManager is

	// Initialize avalanchego decorder
	agCodec = linearcodec.NewDefault()
	agCodecManager = codec.NewDefaultManager()
	err := utils.Err(
		// Add BlockTypes, TransactionTypes for codec
		block.RegisterApricotBlockTypes(agCodec),
		txs.RegisterUnsignedTxsTypes(agCodec),

		block.RegisterBanffBlockTypes(agCodec),
		txs.RegisterDUnsignedTxsTypes(agCodec),

		// Regist codec for codec manager
		agCodecManager.RegisterCodec(block.CodecVersion, agCodec),
	)
	if err != nil {
		log.Fatalf("initialize decorder: %v", err)
	}

We are using the github.com/ava-labs/avalanchego v1.11.8 // indirect
After upgrading the library to the latest version. I see some functions are renamed and removed.

Expected behavior
The decode should work perfectly fine giving us the block object with details related to the block

Screenshots
N.A

Logs
N.A

Metrics
N.A

Operating System
mac-os

Additional context
We were recording avalanche-p chain blocks but got this error while recording the block number 170518. We need help in terms of any code or library updates we missed to resolve this issue.

To best protect the Avalanche community security bugs should be reported in accordance to our Security Policy

@KBA07 KBA07 added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant