Closed whichqua closed 1 month ago
The first fix involved the error ContractNotFound
and was resolved by handling missing nonce:
pub async fn get_nonce_at_async(&self, contract_address: ContractAddress) -> StateResult<Nonce> {
let res = self.provider.get_nonce(self.block_id, *contract_address.key()).await;
let nonce = match res {
Ok(value) => Ok(value),
Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => Ok(Felt::ZERO),
Err(e) => Err(provider_error_to_state_error(e)),
}?;
Ok(Nonce(nonce))
}
The next issue encountered is related to the class proofs:
for (class_hash, previous_class_proof) in previous_class_proofs {
assert!(previous_class_proof.verify(*class_hash).is_ok());
}
for (class_hash, class_proof) in class_proofs {
assert!(class_proof.verify(*class_hash).is_ok());
}
This assertion is currently failing. Investigations continue.
Close analysis of the following blocks 97581, 100687, 101556
:
DEPLOY_ACCOUNT
tx and are all passing, which is a good thing:
[DEBUG starknet_os] output: {
"initial_root": "0x37875a74c89de342072aa46a2ba77198f9e37e165204b438cf3e62a49abaaf",
"final_root": "0x57d3b7566a30edb0a420c47c4a0971551e515e90fe5bc145ebcf913405e93c",
"prev_block_number": "0x1894e",
"new_block_number": "0x1894f",
"prev_block_hash": "0x40c2ff2a8769f816ea1b0faf77d04c0c5803e1983d8fac7b5b6b4b30609cc14",
"new_block_hash": "0x2ef0e92885d48a546936ef03b3b7a64235b9c436d22ac9029f4227d37e2c1cf",
"os_program_hash": "0x0",
"starknet_os_config_hash": "0x504fa6e5eb930c0d8329d4a77d98391f2730dab8516600aeaf733a6123432",
"use_kzg_da": "0x0",
"full_output": "0x0",
"messages_to_l1": [],
"messages_to_l2": [],
"classes": {}
}
All blocks proven successfully.
Proving Problem:
A good number of blocks with a couple of txs including atleast one DeployAccount
plus other txs are failing during tx execution:
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] index = 256
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] start = 5
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] DEFAULT_STORAGE_TREE_HEIGHT = 251
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] index = 256
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] start = 5
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] DEFAULT_STORAGE_TREE_HEIGHT = 251
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] index = 14
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] start = 5
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] DEFAULT_STORAGE_TREE_HEIGHT = 251
thread 'main' panicked at crates/bin/prove_block/src/lib.rs:71:50:
Could not verify previous_class_proof: KeyNotInProof...
The error is that during verify proof we need all proofs to be 256 - 5, yet the index keeps showing up as 15 or 14.
[crates/rpc-client/src/pathfinder/proofs.rs:121:17] index = 14
Example blocks: 17282
, 17462
For other blocks, the issue seems to be some misscalculated hash:
[ERROR prove_block] died at: /snos/cairo-lang/src/starkware/starknet/core/os/contract_class/deprecated_compiled_class.cairo:214
[ERROR prove_block] inst_location:
Location { end_line: 224, end_col: 7, input_file: InputFile { filename: "/snos/cairo-lang/src/starkware/starknet/core/os/contract_class/deprecated_compiled_class.cairo" }, parent_location: None, start_line: 214, start_col: 5 }
[ERROR prove_block]
inner_exc error: Got an exception while executing a hint: Computed compiled_class_hash is inconsistent with the hash in the os_input. Computed hash = 1581181050526515609570793169649908419257677508622928832260239530842366398689, Expected hash = 3367764409417305403458996859647173713892682651403491887738999477132280501187.
thread 'main' panicked at crates/bin/prove_block/src/main.rs:36:61:
Block could not be proven: SnOsError(Runner(VmException(VmException { pc: Relocatable { segment_index: 0, offset: 2170 }, inst_location: Some(Location { end_line: 224, end_col: 7, input_file: InputFile { filename: "/snos/cairo-lang/src/starkware/starknet/core/os/contract_class/deprecated_compiled_class.cairo" }, parent_location: None, start_line: 214, start_col: 5 }), inner_exc: Hint((0, AssertionFailed("Computed compiled_class_hash is inconsistent with the hash in the os_input. Computed hash = 1581181050526515609570793169649908419257677508622928832260239530842366398689, Expected hash = 3367764409417305403458996859647173713892682651403491887738999477132280501187."))), error_attr_value: None, traceback: Some("Cairo traceback (most recent call last):\ncairo-lang/src/starkware/starknet/core/os/os.cairo:73:42: (pc=0:11611)\n let (block_context: BlockContext*) = get_block_context(\n ^****************^\n//snos/cairo-lang/src/starkware/starknet/core/os/block_context.cairo:59:9: (pc=0:2210)\n ) = deprecated_load_compiled_class_facts();\n ^************************************^\n//snos/cairo-lang/src/starkware/starknet/core/os/contract_class/deprecated_compiled_class.cairo:164:5: (pc=0:2134)\n deprecated_load_compiled_class_facts_inner(\n ^*****************************************^\n") })))
Example Blocks: 42883
, 37031
Describe the Feature Request Snos panics on blocks with Deploy account transactions. In order to achieve this, several parts of the code need to handle/implement what is required to process these transactions
Branch WIP: https://github.com/keep-starknet-strange/snos/tree/gm/handle-deploy-tx-trace
Related Code
Additional Context On the comments, the different issues that will be described and link the PR/commit from the fix