Skip to content

Commit

Permalink
Fix p2p header adapters (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan authored Sep 11, 2024
1 parent 71c7ca2 commit b2f565e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ feedernode: juno-cached
--metrics-port=9090

node1: juno-cached
# todo remove rm before merge
rm -rf ./p2p-dbs/node1/ && \
./build/juno \
--network=sepolia \
--log-level=debug \
Expand Down
7 changes: 3 additions & 4 deletions adapters/core2p2p/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ func AdaptHeader(header *core.Header, commitments *core.BlockCommitments,
NLeaves: header.EventCount,
Root: AdaptHash(commitments.EventCommitment),
},
// todo fill receipts with receipt commitment
Receipts: AdaptHash(&felt.Zero),
Receipts: AdaptHash(commitments.ReceiptCommitment),
ProtocolVersion: header.ProtocolVersion,
GasPriceFri: AdaptUint128(header.GasPrice),
GasPriceFri: AdaptUint128(header.GasPriceSTRK),
Signatures: utils.Map(header.Signatures, AdaptSignature),
StateDiffCommitment: &spec.StateDiffCommitment{
StateDiffLength: stateDiffLength,
Root: AdaptHash(stateDiffCommitment),
},
GasPriceWei: AdaptUint128(header.GasPriceSTRK),
GasPriceWei: AdaptUint128(header.GasPrice),
DataGasPriceFri: AdaptUint128(header.L1DataGasPrice.PriceInFri),
DataGasPriceWei: AdaptUint128(header.L1DataGasPrice.PriceInWei),
L1DataAvailabilityMode: adaptL1DA(header.L1DAMode),
Expand Down
1 change: 0 additions & 1 deletion adapters/p2p2core/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func AdaptBlockHeader(h *spec.SignedBlockHeader, eventsBloom *bloom.BloomFilter)
PriceInWei: AdaptUint128(h.DataGasPriceWei),
PriceInFri: AdaptUint128(h.DataGasPriceFri),
},
// todo(kirill) check prices
GasPrice: AdaptUint128(h.GasPriceWei),
GasPriceSTRK: AdaptUint128(h.GasPriceFri),
}
Expand Down
2 changes: 1 addition & 1 deletion p2p/starknet/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (h *Handler) onHeadersRequest(req *spec.BlockHeadersRequest) (iter.Seq[prot

return &spec.BlockHeadersResponse{
HeaderMessage: &spec.BlockHeadersResponse_Header{
Header: core2p2p.AdaptHeader(header, commitments, stateUpdate.StateDiff.Commitment(),
Header: core2p2p.AdaptHeader(header, commitments, stateUpdate.StateDiff.Hash(),
stateUpdate.StateDiff.Length()),
},
}, nil
Expand Down

0 comments on commit b2f565e

Please sign in to comment.