-
Notifications
You must be signed in to change notification settings - Fork 33
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
bug: support deprecated v0 declare txns #470
Labels
enhancement
New feature or request
Comments
We can execute txns on snos successfully. #[rstest]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn declare_v0_cairo0_account(block_context: BlockContext) {
use starknet_api::core::{ContractAddress, PatriciaKey};
use starknet_api::{felt, patricia_key};
let initial_state = StarknetStateBuilder::new(&block_context).build().await;
let tx_version = TransactionVersion::ZERO;
let blockifier_class = BlockifierDeprecatedClass::default();
let class_info = calculate_class_info_for_testing(blockifier_class.into());
let sender_address = contract_address!("0x1");
let declare_tx = blockifier::test_utils::declare::declare_tx(
declare_tx_args! {
max_fee: Fee(0),
sender_address,
version: tx_version
},
class_info,
);
let txs = vec![declare_tx].into_iter().map(Into::into).collect();
let _result = execute_txs_and_run_os(
crate::common::DEFAULT_COMPILED_OS,
initial_state.cached_state,
block_context,
txs,
Default::default(),
Default::default(),
HashMap::default(),
)
.await
.expect("OS run failed");
} |
** Problem 1 **
pub async fn get_class_hash_at_async(&self, contract_address: ContractAddress) -> StateResult<ClassHash> {
let class_hash =
match self.rpc_client.starknet_rpc().get_class_hash_at(self.block_id, *contract_address.key()).await {
Ok(class_hash) => Ok(class_hash),
Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => Ok(ClassHash::default().0),
Err(e) => Err(provider_error_to_state_error(e)),
}?;
Ok(ClassHash(class_hash))
}
impl CallEntryPoint {
pub fn execute(
mut self,
state: &mut dyn State,
resources: &mut ExecutionResources,
context: &mut EntryPointExecutionContext,
) -> EntryPointExecutionResult<CallInfo> {
let tx_context = &context.tx_context;
let mut decrement_when_dropped = RecursionDepthGuard::new(
context.current_recursion_depth.clone(),
context.versioned_constants().max_recursion_depth,
);
decrement_when_dropped.try_increment_and_check_depth()?;
// Validate contract is deployed.
let storage_class_hash = state.get_class_hash_at(self.storage_address)?;
if storage_class_hash == ClassHash::default() {
return Err(PreExecutionError::UninitializedStorageAddress(self.storage_address).into());
}
..... Fixing the return in 1 since we know the contract address doesnt seem to help. |
Resolved in #471 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the Feature Request
Currently we don't support v0 declare txns.
We need to:
DECLARE
V0 on snosRelated Code
Additional Context
The text was updated successfully, but these errors were encountered: