Skip to content

Commit d235270

Browse files
committed
Remove additional info printing
1 parent 25ad7f0 commit d235270

File tree

2 files changed

+14
-47
lines changed

2 files changed

+14
-47
lines changed

core/block.go

+14-41
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/binary"
55
"errors"
66
"fmt"
7-
"github.com/davecgh/go-spew/spew"
87
"slices"
98

109
"github.com/Masterminds/semver/v3"
@@ -193,11 +192,11 @@ func pre07Hash(b *Block, chain *felt.Felt) (*felt.Felt, *BlockCommitments, error
193192
}
194193

195194
func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments, error) {
196-
wg := conc.NewWaitGroup()
197195
var txCommitment, eCommitment, rCommitment, sdCommitment *felt.Felt
198196
var sdLength uint64
199197
var tErr, eErr, rErr error
200198

199+
wg := conc.NewWaitGroup()
201200
wg.Go(func() {
202201
txCommitment, tErr = transactionCommitmentPoseidon(b.Transactions)
203202
})
@@ -207,12 +206,10 @@ func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments
207206
wg.Go(func() {
208207
rCommitment, rErr = receiptCommitment(b.Receipts)
209208
})
210-
211209
wg.Go(func() {
212210
sdLength = stateDiff.Length()
213211
sdCommitment = stateDiff.Hash()
214212
})
215-
216213
wg.Wait()
217214

218215
if tErr != nil {
@@ -227,32 +224,12 @@ func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments
227224

228225
concatCounts := concatCounts(b.TransactionCount, b.EventCount, sdLength, b.L1DAMode)
229226

230-
hash := crypto.PoseidonArray(
231-
new(felt.Felt).SetBytes([]byte("STARKNET_BLOCK_HASH0")),
232-
new(felt.Felt).SetUint64(b.Number), // block number
233-
b.GlobalStateRoot, // global state root
234-
b.SequencerAddress, // sequencer address
235-
new(felt.Felt).SetUint64(b.Timestamp), // block timestamp
236-
concatCounts,
237-
sdCommitment,
238-
txCommitment, // transaction commitment
239-
eCommitment, // event commitment
240-
rCommitment, // receipt commitment
241-
b.GasPrice, // gas price in wei
242-
b.GasPriceSTRK, // gas price in fri
243-
b.L1DataGasPrice.PriceInWei,
244-
b.L1DataGasPrice.PriceInFri,
245-
new(felt.Felt).SetBytes([]byte(b.ProtocolVersion)),
246-
&felt.Zero, // reserved: extra data
247-
b.ParentHash, // parent block hash
248-
)
249-
250-
if b.Number == 24521 {
251-
spew.Dump(
252-
b.Number, // block number
253-
b.GlobalStateRoot, // global state root
254-
b.SequencerAddress, // sequencer address
255-
b.Timestamp, // block timestamp
227+
return crypto.PoseidonArray(
228+
new(felt.Felt).SetBytes([]byte("STARKNET_BLOCK_HASH0")),
229+
new(felt.Felt).SetUint64(b.Number), // block number
230+
b.GlobalStateRoot, // global state root
231+
b.SequencerAddress, // sequencer address
232+
new(felt.Felt).SetUint64(b.Timestamp), // block timestamp
256233
concatCounts,
257234
sdCommitment,
258235
txCommitment, // transaction commitment
@@ -262,19 +239,15 @@ func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments
262239
b.GasPriceSTRK, // gas price in fri
263240
b.L1DataGasPrice.PriceInWei,
264241
b.L1DataGasPrice.PriceInFri,
265-
b.ProtocolVersion,
242+
new(felt.Felt).SetBytes([]byte(b.ProtocolVersion)),
266243
&felt.Zero, // reserved: extra data
267244
b.ParentHash, // parent block hash
268-
fmt.Sprintf("new hash is %v", hash),
269-
)
270-
}
271-
272-
return hash, &BlockCommitments{
273-
TransactionCommitment: txCommitment,
274-
EventCommitment: eCommitment,
275-
ReceiptCommitment: rCommitment,
276-
StateDiffCommitment: sdCommitment,
277-
}, nil
245+
), &BlockCommitments{
246+
TransactionCommitment: txCommitment,
247+
EventCommitment: eCommitment,
248+
ReceiptCommitment: rCommitment,
249+
StateDiffCommitment: sdCommitment,
250+
}, nil
278251
}
279252

280253
// post07Hash computes the block hash for blocks generated after Cairo 0.7.0

core/receipt.go

-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package core
22

33
import (
4-
"fmt"
54
"github.com/NethermindEth/juno/core/crypto"
65
"github.com/NethermindEth/juno/core/felt"
76
"github.com/NethermindEth/juno/core/trie"
8-
"github.com/davecgh/go-spew/spew"
97
)
108

119
type GasConsumed struct {
@@ -68,10 +66,6 @@ func receiptCommitment(receipts []*TransactionReceipt) (*felt.Felt, error) {
6866
return commitment, trie.RunOnTempTriePoseidon(commitmentTrieHeight, func(trie *trie.Trie) error {
6967
for i, receipt := range receipts {
7068
receiptTrieKey := new(felt.Felt).SetUint64(uint64(i))
71-
fmt.Printf("Receipt %d hash %v\n", i, receipt.hash())
72-
if i == 4 {
73-
spew.Dump("4th receipt", receipt, receipt.hash())
74-
}
7569
_, err := trie.Put(receiptTrieKey, receipt.hash())
7670
if err != nil {
7771
return err

0 commit comments

Comments
 (0)