@@ -566,7 +566,14 @@ func convertProofToWitness(
566
566
for i := 0 ; i < upTo ; i ++ {
567
567
if ! isBranch (proof1 [i ]) {
568
568
isNonExistingProof := (isAccountProof && nonExistingAccountProof ) || (! isAccountProof && nonExistingStorageProof )
569
- areThereNibbles := len (extNibblesS ) != 0 || len (extNibblesC ) != 0
569
+ var curExtNibblesS , curExtNibblesC []byte
570
+ if len (extNibblesS ) > i {
571
+ curExtNibblesS = extNibblesS [i ]
572
+ }
573
+ if len (extNibblesC ) > i {
574
+ curExtNibblesC = extNibblesC [i ]
575
+ }
576
+ areThereNibbles := len (curExtNibblesS ) != 0 || len (curExtNibblesC ) != 0
570
577
// If i < upTo-1, it means it's not a leaf, so it's an extension node.
571
578
// There is no any special relation between isNonExistingProof and isExtension,
572
579
// except that in the non-existing proof the extension node can appear in `i == upTo-1`.
@@ -577,7 +584,7 @@ func convertProofToWitness(
577
584
if (i != upTo - 1 ) || (areThereNibbles && isNonExistingProof ) { // extension node
578
585
var numberOfNibbles byte
579
586
isExtension = true
580
- numberOfNibbles , extListRlpBytes , extValues = prepareExtensions (extNibblesS [ i ] , proof1 [i ], proof2 [i ])
587
+ numberOfNibbles , extListRlpBytes , extValues = prepareExtensions (curExtNibblesS , proof1 [i ], proof2 [i ])
581
588
582
589
keyIndex += int (numberOfNibbles )
583
590
extensionNodeInd ++
0 commit comments