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

panic: runtime error: makeslice: len out of range #187

Closed
jhawk28 opened this issue Apr 1, 2024 · 6 comments · May be fixed by #188
Closed

panic: runtime error: makeslice: len out of range #187

jhawk28 opened this issue Apr 1, 2024 · 6 comments · May be fixed by #188

Comments

@jhawk28
Copy link

jhawk28 commented Apr 1, 2024

some transactions are causing the library to panic at: github.com/gagliardetto/solana-go@v1.9.3/transaction.go:490

@gagliardetto
Copy link
Owner

Hi

can you please post the whole panic trace?

@gagliardetto
Copy link
Owner

It would also be useful to have one of these transactions that cause the panic.

@jhawk28
Copy link
Author

jhawk28 commented Apr 1, 2024

panic: runtime error: makeslice: len out of range
goroutine 3107636 [running]:
github.com/gagliardetto/solana-go.(*Transaction).UnmarshalWithDecoder(0xc052ed05a0, 0xc023e44d20)
        /Users/joshua/go/pkg/mod/github.com/gagliardetto/solana-go@v1.9.3/transaction.go:490 +0x7c
github.com/gagliardetto/binary.(*Decoder).decodeBin(0xc023e44d20, {0x0, 0x0, 0x0}, 0x0?)
        /Users/joshua/go/pkg/mod/github.com/gagliardetto/binary@v0.7.9/decoder_bin.go:84 +0x10ec
github.com/gagliardetto/binary.(*Decoder).decodeWithOptionBin(0x0?, {0x10f7f60?, 0xc05b9931f8?}, 0x412005?)
        /Users/joshua/go/pkg/mod/github.com/gagliardetto/binary@v0.7.9/decoder_bin.go:37 +0x105
github.com/gagliardetto/binary.(*Decoder).Decode(0xc008228230?, {0x10f7f60?, 0xc05b9931f8?})
        /Users/joshua/go/pkg/mod/github.com/gagliardetto/binary@v0.7.9/decoder.go:130 +0x52
github.com/gagliardetto/solana-go.TransactionFromDecoder(...)
        /Users/joshua/go/pkg/mod/github.com/gagliardetto/solana-go@v1.9.3/transaction.go:83

@jhawk28
Copy link
Author

jhawk28 commented Apr 1, 2024

I don't have a transaction that is causing the issue yet. If can get find one, I'll post.

NOTE: I'm parsing a sendTransaction to pull out the blockhash.

ex:

	var data []byte
	switch encoding {
	case "base64":
		data, err = base64.StdEncoding.DecodeString(encoded)
		if err != nil {
			return ""
		}
	case "", "base58":
		data, err = base58.Decode(encoded)
		if err != nil {
			return ""
		}
	default:
		// unknown encoding
		return ""
	}

	tx, err := solana.TransactionFromDecoder(bin.NewBinDecoder(data))
	if err != nil || tx == nil {
		return ""
	}
	return tx.Message.RecentBlockhash.String()

@gagliardetto
Copy link
Owner

Try github.com/gagliardetto/solana-go@v1.10.0

@gagliardetto
Copy link
Owner

Closing as stale

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

Successfully merging a pull request may close this issue.

2 participants