Skip to content

Commit 6ccc38c

Browse files
committed
fix go build
1 parent 19f83a5 commit 6ccc38c

File tree

2 files changed

+3
-79
lines changed

2 files changed

+3
-79
lines changed

common/types/message/message.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"errors"
66
"fmt"
7-
"strings"
87

98
"github.com/scroll-tech/go-ethereum/common"
109
)
@@ -348,7 +347,9 @@ type OpenVMBundleProof struct {
348347
// | 352 | 32 | accs[11] | accumulator 12 |
349348
// | 384 | dynamic | proof | proof bytes |
350349
func (p *OpenVMBundleProof) Proof() []byte {
351-
append(p.EvmProof.Instances[0:384], p.EvmProof.Proof)
350+
proofBytes := make([]byte, 0, 384+len(p.EvmProof.Proof))
351+
proofBytes = append(proofBytes, p.EvmProof.Instances[:384]...)
352+
return append(instances, p.EvmProof.Proof...)
352353
}
353354

354355
// SanityCheck checks whether a BundleProof is in a legal format

common/types/message/message_test.go

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -52,80 +52,3 @@ func TestDeserializeOpenVMProof(t *testing.T) {
5252
t.Fatalf("get unexpected bundle info, post state root is %v", ovmbundleProof.MetaData.BundleInfo.PostStateRoot)
5353
}
5454
}
55-
56-
func TestByteArrayMarshal(t *testing.T) {
57-
marshalTests := []struct {
58-
name string
59-
data ByteArray
60-
expected string
61-
}{
62-
{
63-
name: "empty",
64-
data: ByteArray{},
65-
expected: "[]",
66-
},
67-
{
68-
name: "some",
69-
data: ByteArray{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
70-
expected: "[1,2,3,4,5,6,7,8,9,10]",
71-
},
72-
{
73-
name: "nil",
74-
data: nil,
75-
expected: "[]",
76-
},
77-
}
78-
79-
for _, tt := range marshalTests {
80-
t.Run(tt.name, func(t *testing.T) {
81-
data, err := json.Marshal(tt.data)
82-
if err != nil {
83-
t.Fatalf("failed to marshal ByteArray: %v", err)
84-
}
85-
if string(data) != tt.expected {
86-
t.Fatalf("unexpected marshaled ByteArray: %s", data)
87-
}
88-
})
89-
}
90-
91-
unmarshalTests := []struct {
92-
name string
93-
data string
94-
expected ByteArray
95-
}{
96-
{
97-
name: "empty",
98-
data: "[]",
99-
expected: ByteArray{},
100-
},
101-
{
102-
name: "some",
103-
data: "[1,2,3,4,5,6,7,8,9,10]",
104-
expected: ByteArray{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
105-
},
106-
{
107-
name: "base64",
108-
data: "\"AQIDBAUGBwgJCg==\"",
109-
expected: ByteArray{
110-
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
111-
},
112-
},
113-
}
114-
115-
for _, tt := range unmarshalTests {
116-
t.Run(tt.name, func(t *testing.T) {
117-
var data ByteArray
118-
if err := json.Unmarshal([]byte(tt.data), &data); err != nil {
119-
t.Fatalf("failed to unmarshal ByteArray: %v", err)
120-
}
121-
if len(data) != len(tt.expected) {
122-
t.Fatalf("unexpected unmarshaled ByteArray: %v", data)
123-
}
124-
for i := range data {
125-
if data[i] != tt.expected[i] {
126-
t.Fatalf("unexpected unmarshaled ByteArray: %v", data)
127-
}
128-
}
129-
})
130-
}
131-
}

0 commit comments

Comments
 (0)