-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update of getBlockWithTxHashes and getStateUpdate #461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like @marioiordanov to give his opinion on the type / struct conversations started by @mikiw.
In starknet-devnet-server/test_data/spec/0.7.1/<....>.json files, PENDING structs have to be added. Then tests in json_rpc/spec_reader will show if the structs are correct |
fixed in ef745b9 |
|
||
// StarknetBlock needs to be mapped to PendingBlock response only in blocks_on_demand mode | ||
// and when block_id is pending | ||
if starknet.config.blocks_on_demand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic could be moved in Starknet-core project
@@ -24,21 +24,33 @@ impl JsonRpcHandler { | |||
|
|||
/// starknet_getBlockWithTxHashes | |||
pub async fn get_block_with_tx_hashes(&self, block_id: BlockId) -> StrictRpcResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about get_block_with_txs and get_block_with_receipts
})) | ||
// StateUpdate needs to be mapped to PendingStateUpdate response only in blocks_on_demand | ||
// mode and when block_id is pending | ||
if starknet.config.blocks_on_demand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same here, can be moved into Starknet-devnet-core crate.
if starknet.config.blocks_on_demand | ||
&& block_id == ImportedBlockId::Tag(BlockTag::Pending).into() | ||
{ | ||
Ok(StarknetResponse::PendingStateUpdate(PendingStateUpdate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StarknetResponse::StateUpdate enum variant can receive an enum as its inner part, similar to StarknetResponse::TransactionTrace
if starknet.config.blocks_on_demand | ||
&& block_id == ImportedBlockId::Tag(BlockTag::Pending).into() | ||
{ | ||
Ok(StarknetResponse::PendingBlock(PendingBlock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StarknetResponse::Block can receive an enum as its inner property. For example:
enum StarknetResponse{
Block(Block)
}
enum Block {
Block,
PendingBlock
}
Usage related changes
Checklist:
./scripts/format.sh
./scripts/clippy_check.sh
./scripts/check_unused_deps.sh
./scripts/check_spelling.sh