Skip to content

Commit 8e322db

Browse files
authored
Update starknet header to include l2 gas price (#197)
This PR adds the field. It's marked optional so that it works on older streams.
2 parents 3bddfbe + c555fbc commit 8e322db

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "starknet: add l2 gas price header prop",
4+
"packageName": "@apibara/starknet",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/starknet/proto/data.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ message BlockHeader {
5050
ResourcePrice l1_data_gas_price = 9;
5151
// L1 data availability mode.
5252
L1DataAvailabilityMode l1_data_availability_mode = 10;
53+
// Price of L2 gas in the block.
54+
ResourcePrice l2_gas_price = 11;
5355
}
5456

5557
// A transaction.
@@ -523,4 +525,4 @@ enum CallType {
523525
CALL_TYPE_LIBRARY_CALL = 1;
524526
CALL_TYPE_CALL = 2;
525527
CALL_TYPE_DELEGATE = 3;
526-
}
528+
}

packages/starknet/src/block.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export type DataAvailabilityMode = CodecType<typeof DataAvailabilityMode>;
182182
* @prop l1GasPrice Calldata gas price.
183183
* @prop l1DataGasPrice Blob gas price.
184184
* @prop l1DataAvailabilityMode How data is posted to L1.
185+
* @prop l2GasPrice L2 gas price.
185186
*/
186187
export const BlockHeader = MessageCodec({
187188
blockHash: OptionalCodec(FieldElement),
@@ -194,6 +195,7 @@ export const BlockHeader = MessageCodec({
194195
l1GasPrice: RequiredCodec(ResourcePrice),
195196
l1DataGasPrice: RequiredCodec(ResourcePrice),
196197
l1DataAvailabilityMode: RequiredCodec(L1DataAvailabilityMode),
198+
l2GasPrice: OptionalCodec(ResourcePrice),
197199
});
198200

199201
export type BlockHeader = Readonly<CodecType<typeof BlockHeader>>;

packages/starknet/src/proto/data.ts

Lines changed: 23 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)