Skip to content

Commit

Permalink
L1->L2 message hashes are 256 bit hashes (#2160)
Browse files Browse the repository at this point in the history
* refactor: Update Hash message to use Hash256 type

* Regenerate spec

* refactor: Update MsgHash to use Hash256 type in AdaptReceipt function
  • Loading branch information
AnkushinDaniil authored Sep 18, 2024
1 parent 5c6ffd9 commit d637844
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 137 deletions.
2 changes: 1 addition & 1 deletion adapters/core2p2p/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func AdaptReceipt(r *core.TransactionReceipt, txn core.Transaction) *spec.Receip
Type: &spec.Receipt_L1Handler_{
L1Handler: &spec.Receipt_L1Handler{
Common: receiptCommon(r),
MsgHash: &spec.Hash{Elements: t.MessageHash()},
MsgHash: &spec.Hash256{Elements: t.MessageHash()},
},
},
}
Expand Down
7 changes: 7 additions & 0 deletions p2p/starknet/p2p/proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ message Felt252 {
bytes elements = 1;
}

// A hash value representable as a Felt252
message Hash {
bytes elements = 1;
}

// A 256 bit hash value (like Keccak256)
message Hash256 {
// Required to be 32 bytes long
bytes elements = 1;
}

message Hashes {
repeated Hash items = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion p2p/starknet/p2p/proto/receipt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message Receipt {

message L1Handler {
Common common = 1;
Hash msg_hash = 2;
Hash256 msg_hash = 2;
}

message Declare {
Expand Down
Loading

0 comments on commit d637844

Please sign in to comment.