Skip to content

Commit

Permalink
update api open rpc spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Woźniak committed May 8, 2024
1 parent a9f77e7 commit ef745b9
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 4 deletions.
1 change: 0 additions & 1 deletion crates/starknet-devnet-core/src/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ impl From<&StarknetBlock> for TypesPendingBlockHeader {
Self {
parent_hash: value.parent_hash(),
sequencer_address: value.sequencer_address(),
new_root: value.new_root(),
timestamp: value.timestamp(),
starknet_version: STARKNET_VERSION.to_string(),
l1_gas_price: ResourcePrice {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ mod tests {
StarknetRequest::BlockWithTransactionHashes(_)
| StarknetRequest::BlockWithFullTransactions(_)
| StarknetRequest::BlockWithReceipts(_) => {
assert!(matches!(sn_response, StarknetResponse::Block(_)));
assert!(matches!(
sn_response,
StarknetResponse::Block(_) | StarknetResponse::PendingBlock(_)
));
}
StarknetRequest::BlockHashAndNumber => {
assert!(matches!(sn_response, StarknetResponse::BlockHashAndNumber(_)));
Expand Down Expand Up @@ -282,7 +285,11 @@ mod tests {
));
}
StarknetRequest::StateUpdate(_) => {
assert!(matches!(sn_response, StarknetResponse::StateUpdate(_)));
assert!(matches!(
sn_response,
StarknetResponse::StateUpdate(_)
| StarknetResponse::PendingStateUpdate(_)
));
}
StarknetRequest::Syncing => {
assert!(matches!(sn_response, StarknetResponse::Syncing(_)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
{
"title": "Block with transaction hashes",
"$ref": "#/components/schemas/BLOCK_WITH_TX_HASHES"
},
{
"title": "Pending block with transaction hashes",
"$ref": "#/components/schemas/PENDING_BLOCK_WITH_TX_HASHES"
}
]
}
Expand Down Expand Up @@ -143,6 +147,10 @@
{
"title": "State update",
"$ref": "#/components/schemas/STATE_UPDATE"
},
{
"title": "Pending state update",
"$ref": "#/components/schemas/PENDING_STATE_UPDATE"
}
]
}
Expand Down Expand Up @@ -1488,6 +1496,68 @@
"starknet_version"
]
},
"PENDING_BLOCK_HEADER": {
"title": "Pending block header",
"type": "object",
"properties": {
"parent_hash": {
"title": "Parent hash",
"description": "The hash of this block's parent",
"$ref": "#/components/schemas/BLOCK_HASH"
},
"timestamp": {
"title": "Timestamp",
"description": "The time in which the block was created, encoded in Unix time",
"type": "integer",
"minimum": 0
},
"sequencer_address": {
"title": "Sequencer address",
"description": "The StarkNet identity of the sequencer submitting this block",
"$ref": "#/components/schemas/FELT"
},
"l1_gas_price": {
"title": "L1 gas price",
"description": "The price of l1 gas in the block",
"$ref": "#/components/schemas/RESOURCE_PRICE"
},
"l1_data_gas_price": {
"title": "L1 data gas price",
"description": "The price of l1 data gas in the block",
"$ref": "#/components/schemas/RESOURCE_PRICE"
},
"l1_da_mode": {
"title": "L1 da mode",
"type": "string",
"description": "specifies whether the data of this block is published via blob data or calldata",
"enum": [
"BLOB",
"CALLDATA"
]
},
"starknet_version": {
"title": "Starknet version",
"description": "Semver of the current Starknet protocol",
"type": "string"
}
},
"required": [
"parent_hash",
"timestamp",
"sequencer_address",
"l1_gas_price",
"l1_data_gas_price",
"l1_da_mode",
"starknet_version"
],
"not": {
"required": [
"block_hash",
"block_number",
"new_root"
]
}
},
"BLOCK_WITH_TX_HASHES": {
"title": "Block with transaction hashes",
"description": "The block object",
Expand Down
1 change: 0 additions & 1 deletion crates/starknet-devnet-types/src/rpc/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ pub struct BlockHeader {
pub struct PendingBlockHeader {
pub parent_hash: BlockHash,
pub sequencer_address: ContractAddress,
pub new_root: GlobalRootHex,
pub timestamp: BlockTimestamp,
pub starknet_version: String,
pub l1_gas_price: ResourcePrice,
Expand Down

0 comments on commit ef745b9

Please sign in to comment.