-
Notifications
You must be signed in to change notification settings - Fork 62
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 spec reader tests #657
Open
marioiordanov
wants to merge
47
commits into
json-rpc-v0.8.0
Choose a base branch
from
json-rpc-v0.8.0-spec-reader
base: json-rpc-v0.8.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
a552d1d
changed files
marioiordanov 1779527
added spec instructions
marioiordanov 14accab
estimate fee fix
marioiordanov 0f9d2ed
fix data from spec
marioiordanov 54a14b2
added todos
marioiordanov 587926d
added l2_gas_price
marioiordanov b1d00d9
progress
marioiordanov 65eeba7
progress
marioiordanov 647ba27
changes to spec reader procedure
marioiordanov 7f4996b
change getCompiledCasm request based on tests
marioiordanov 369a958
add versioned constants when generating data for gas usage in traces
marioiordanov f7aaa1e
fix tuple generator
marioiordanov 2e20d3d
add versioned constants
marioiordanov b9a1382
spec files
marioiordanov 0a3b581
edit ws file
marioiordanov 40afd35
edit spec
marioiordanov 3cc1efd
renamed block to block_id
marioiordanov be027d8
SubscriptionNotification refactored, renamed SubscriptionNotification…
marioiordanov 17a5050
changed block to block_id
marioiordanov b8c1c6b
changed block to block_id
marioiordanov 4a0eb65
fix change
marioiordanov 4793568
fix test
marioiordanov 650a70e
make block_hash and block_number optional as part of emitted event. I…
marioiordanov ff9e3a8
added Deserialize support
marioiordanov 270f95f
edit spec
marioiordanov 2525f02
edit spec reader tests
marioiordanov 143148c
Merge branch 'json-rpc-v0.8.0' into json-rpc-v0.8.0-spec-reader
marioiordanov b327704
fmt
marioiordanov d53d373
fixes after merge
marioiordanov 9d82830
fixes
marioiordanov e72bede
clippy fix
marioiordanov 4349848
remove 0.7.1 files
marioiordanov b427f79
remove a test and ignore some other
marioiordanov 599b2d6
replace spec version
marioiordanov d25a023
edit version is spec
marioiordanov 6327376
address todos
marioiordanov a88285b
renamings
marioiordanov 80c5193
comment part of the code
marioiordanov 4cce222
serde fix
marioiordanov a3f9cac
import instead of fully qualify
marioiordanov 0658f67
rename does_block_number_matches_criteria to is_block_number_in_range
marioiordanov 71424eb
remove wrong filter
marioiordanov a8e7514
added comment
marioiordanov b567418
remove comment
marioiordanov a9b4bdf
edit comment
marioiordanov b2e2207
remove variable
marioiordanov 11f9079
remove ignore attribute
marioiordanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ use blockifier::execution::call_info::CallInfo; | |
use blockifier::state::cached_state::CachedState; | ||
use blockifier::state::state_api::StateReader; | ||
use blockifier::transaction::objects::TransactionExecutionInfo; | ||
use blockifier::versioned_constants::VersionedConstants; | ||
use starknet_types::rpc::state::ThinStateDiff; | ||
use starknet_types::rpc::transaction_receipt::ExecutionResources; | ||
use starknet_types::rpc::transactions::{ | ||
|
@@ -15,11 +16,14 @@ use crate::error::{DevnetResult, Error}; | |
fn get_execute_call_info<S: StateReader>( | ||
state: &mut CachedState<S>, | ||
execution_info: &TransactionExecutionInfo, | ||
versioned_constants: &VersionedConstants, | ||
) -> DevnetResult<ExecutionInvocation> { | ||
Ok(match &execution_info.execute_call_info { | ||
Some(call_info) => match call_info.execution.failed { | ||
false => ExecutionInvocation::Succeeded(FunctionInvocation::try_from_call_info( | ||
call_info, state, | ||
call_info, | ||
state, | ||
versioned_constants, | ||
)?), | ||
true => ExecutionInvocation::Reverted(starknet_types::rpc::transactions::Reversion { | ||
revert_reason: execution_info | ||
|
@@ -46,9 +50,10 @@ fn get_execute_call_info<S: StateReader>( | |
fn get_call_info_invocation<S: StateReader>( | ||
state: &mut CachedState<S>, | ||
call_info_invocation: &Option<CallInfo>, | ||
versioned_constants: &VersionedConstants, | ||
) -> DevnetResult<Option<FunctionInvocation>> { | ||
Ok(if let Some(call_info) = call_info_invocation { | ||
Some(FunctionInvocation::try_from_call_info(call_info, state)?) | ||
Some(FunctionInvocation::try_from_call_info(call_info, state, versioned_constants)?) | ||
} else { | ||
None | ||
}) | ||
|
@@ -59,13 +64,18 @@ pub(crate) fn create_trace<S: StateReader>( | |
tx_type: TransactionType, | ||
execution_info: &TransactionExecutionInfo, | ||
state_diff: ThinStateDiff, | ||
versioned_constants: &VersionedConstants, | ||
) -> DevnetResult<TransactionTrace> { | ||
let state_diff = Some(state_diff); | ||
let validate_invocation = get_call_info_invocation(state, &execution_info.validate_call_info)?; | ||
let validate_invocation = | ||
get_call_info_invocation(state, &execution_info.validate_call_info, versioned_constants)?; | ||
let execution_resources = ExecutionResources::from(execution_info); | ||
|
||
let fee_transfer_invocation = | ||
get_call_info_invocation(state, &execution_info.fee_transfer_call_info)?; | ||
let fee_transfer_invocation = get_call_info_invocation( | ||
state, | ||
&execution_info.fee_transfer_call_info, | ||
versioned_constants, | ||
)?; | ||
|
||
match tx_type { | ||
TransactionType::Declare => Ok(TransactionTrace::Declare(DeclareTransactionTrace { | ||
|
@@ -80,6 +90,7 @@ pub(crate) fn create_trace<S: StateReader>( | |
constructor_invocation: get_call_info_invocation( | ||
state, | ||
&execution_info.execute_call_info, | ||
versioned_constants, | ||
)?, | ||
fee_transfer_invocation, | ||
state_diff, | ||
|
@@ -88,13 +99,17 @@ pub(crate) fn create_trace<S: StateReader>( | |
} | ||
TransactionType::Invoke => Ok(TransactionTrace::Invoke(InvokeTransactionTrace { | ||
validate_invocation, | ||
execute_invocation: get_execute_call_info(state, execution_info)?, | ||
execute_invocation: get_execute_call_info(state, execution_info, versioned_constants)?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There already is a util function |
||
fee_transfer_invocation, | ||
state_diff, | ||
execution_resources, | ||
})), | ||
TransactionType::L1Handler => { | ||
match get_call_info_invocation(state, &execution_info.execute_call_info)? { | ||
match get_call_info_invocation( | ||
state, | ||
&execution_info.execute_call_info, | ||
versioned_constants, | ||
)? { | ||
Some(function_invocation) => { | ||
Ok(TransactionTrace::L1Handler(L1HandlerTransactionTrace { | ||
function_invocation, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When will it be false? Only when one of the blocks in
num_to_hash
has the same number as pending_block? And when should that be the case?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.
Exactly in this case.
num_to_hash
apart from being in the same object aspending_block
has no relation to it.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.
Creating pending block have to be changed. It should advance the block number, but this is happening not in StarknetBlocks file, but in Starknet. Thats why this case is covered