4
4
package chain
5
5
6
6
import (
7
- "bytes"
8
7
"context"
9
8
"encoding/binary"
10
9
"errors"
@@ -18,12 +17,9 @@ import (
18
17
"github.com/ava-labs/avalanchego/utils/logging"
19
18
"github.com/ava-labs/avalanchego/utils/math"
20
19
"github.com/ava-labs/avalanchego/utils/set"
21
- "github.com/cbergoon/merkletree"
22
20
"go.opentelemetry.io/otel/attribute"
23
21
"go.uber.org/zap"
24
22
25
- "crypto/sha256"
26
-
27
23
"github.com/ava-labs/hypersdk/executor"
28
24
"github.com/ava-labs/hypersdk/keys"
29
25
"github.com/ava-labs/hypersdk/tstate"
@@ -38,29 +34,6 @@ const (
38
34
stopBuildingThreshold = 2_048 // units
39
35
)
40
36
41
- type TestContent struct {
42
- x []byte
43
- }
44
-
45
- // CalculateHash hashes the values of a TestContent
46
- func (t TestContent ) CalculateHash () ([]byte , error ) {
47
- h := sha256 .New ()
48
- if _ , err := h .Write ([]byte (t .x )); err != nil {
49
- return nil , err
50
- }
51
-
52
- return h .Sum (nil ), nil
53
- }
54
-
55
- // Equals tests for equality of two Contents
56
- func (t TestContent ) Equals (other merkletree.Content ) (bool , error ) {
57
- otherTC , ok := other .(TestContent )
58
- if ! ok {
59
- return false , errors .New ("value is not of type TestContent" )
60
- }
61
- return bytes .Equal (t .x , otherTC .x ), nil
62
- }
63
-
64
37
var errBlockFull = errors .New ("block full" )
65
38
66
39
func HandlePreExecute (log logging.Logger , err error ) bool {
@@ -155,8 +128,6 @@ func BuildBlock(
155
128
txsAttempted = 0
156
129
results = []* Result {}
157
130
158
- txSuccessList []merkletree.Content
159
-
160
131
vdrState = vm .ValidatorState ()
161
132
sm = vm .StateManager ()
162
133
@@ -165,9 +136,6 @@ func BuildBlock(
165
136
prepareStreamLock sync.Mutex
166
137
)
167
138
168
- // prevent empty list
169
- txSuccessList = append (txSuccessList , TestContent {x : make ([]byte , 32 )})
170
-
171
139
// Batch fetch items from mempool to unblock incoming RPC/Gossip traffic
172
140
mempool .StartStreaming (ctx )
173
141
b .Txs = []* Transaction {}
@@ -413,7 +381,6 @@ func BuildBlock(
413
381
tsv .Commit ()
414
382
b .Txs = append (b .Txs , tx )
415
383
results = append (results , result )
416
- txSuccessList = append (txSuccessList , TestContent {x : tx .Bytes ()})
417
384
if tx .WarpMessage != nil {
418
385
if warpErr == nil {
419
386
// Add a bit if the warp message was verified
@@ -448,13 +415,6 @@ func BuildBlock(
448
415
}
449
416
}
450
417
451
- trie , err := merkletree .NewTree (txSuccessList )
452
- if err != nil {
453
- b .vm .Logger ().Warn ("unable to build trie" , zap .Error (err ))
454
- return nil , err
455
- }
456
- b .TxsRoot = trie .MerkleRoot ()
457
-
458
418
// Wait for stream preparation to finish to make
459
419
// sure all transactions are returned to the mempool.
460
420
go func () {
0 commit comments