wealdtech / ethereal

Apache License 2.0
208 stars 41 forks source link

panic: runtime error: slice bounds out of range when get transaction info. #5

Closed passionofvc closed 6 years ago

passionofvc commented 6 years ago

I use ethereal to get transaction info, and get panic error.

$ ./ethereal  version
1.2.128
./ethereal transaction info --transaction=0xc482297e9d657b7d2c854b57d55056f1b8e733cdc620201a102f61aa0443e0a0
Type:                   Mined transaction
Result:                 Succeeded
Block:                  6105405
From:                   0x501E6287AA70cbaB2393037F60e4d52706a87245
To:                     0xFD26D9eC46172759ff9d2039A4E841cD82E835e9
Nonce:                  5537
Gas limit:              500000
Gas used:               67605
Gas price:              60 GWei
Value:                  0
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/wealdtech/ethereal/util/txdata.valueToString(0x0, 0x17, 0x1539420, 0xc35a60, 0x0, 0x8, 0xe4fc21, 0x5, 0x400000002, 0xc42054e340, ...)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/util/txdata/signature.go:142 +0x10ad
github.com/wealdtech/ethereal/util/txdata.contractValueToString(0x0, 0x17, 0x1539420, 0xc35a60, 0x0, 0x8, 0xe4fc21, 0x5, 0x2, 0xc42054e340, ...)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/util/txdata/signature.go:107 +0x8c
github.com/wealdtech/ethereal/util/txdata.DataToString(0xc42054e340, 0x184, 0x184, 0xc42054e340, 0x184)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/util/txdata/signature.go:50 +0x369
github.com/wealdtech/ethereal/cmd.glob..func37(0x1505ae0, 0xc4201abd90, 0x0, 0x1)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/cmd/transactioninfo.go:164 +0xbd0
github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra.(*Command).execute(0x1505ae0, 0xc4201abd70, 0x1, 0x1, 0x1505ae0, 0xc4201abd70)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra/command.go:704 +0x2c6
github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1503920, 0xb7970e, 0x1503920, 0xc4201ddf20)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra/command.go:785 +0x30e
github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra.(*Command).Execute(0x1503920, 0x0, 0xba2427)
        /home/yamakin/go/src/github.com/wealdtech/ethereal/vendor/github.com/spf13/cobra/command.go:738 +0x2b
github.com/wealdtech/ethereal/cmd.Execute()
        /home/yamakin/go/src/github.com/wealdtech/ethereal/cmd/root.go:150 +0x31
main.main()
        /home/yamakin/go/src/github.com/wealdtech/ethereal/main.go:19 +0x20
mcdee commented 6 years ago

Thanks for the issue report; this should be fixed now thanks to @changwu-tw

To obtain the updated version use go get -u github.com/wealdtech/ethereal

passionofvc commented 6 years ago

thanks to @mcdee, @changwu-tw
it works!

 $ ./ethereal transaction info --transaction=0x2f3c3fe9b8eff5aa59b385f2ec5bb613240e299b10cc43850a5de7989184b314
Type:                   Mined transaction
Result:                 Succeeded
Block:                  6139310
From:                   0xEd2d6489043462B9C85Bd39Dc1C66eE1f6F1f111
To:                     0x56F527C3F4a24bB2BeBA449FFd766331DA840FFA
Nonce:                  17
Gas limit:              1500000
Gas used:               69643
Gas price:              3.41 GWei
Value:                  0
Data:                   sell(230000000000000000000)