Skip to content

Commit

Permalink
Deployment/kakarot v0 6 2 (#946)
Browse files Browse the repository at this point in the history
* fix  protocol nonce edge case

* fix linter
  • Loading branch information
Eikix authored Apr 9, 2024
1 parent 73c1447 commit 29bc334
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/eth_provider/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ where
}
let nonce = maybe_nonce.map_err(KakarotError::from)?.nonce;

// Get the protocol nonce as well, in edge cases where the protocol nonce is higher than the account nonce.
// This can happen when an underlying Starknet transaction reverts => Account storage changes are reverted,
// but the protocol nonce is still incremented.
let protocol_nonce =
self.starknet_provider.get_nonce(starknet_block_id, address).await.map_err(KakarotError::from)?;
let nonce = nonce.max(protocol_nonce);

Ok(into_via_wrapper!(nonce))
}

Expand Down
1 change: 1 addition & 0 deletions src/eth_provider/starknet/kakarot_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub mod core {
use super::*;
abigen_legacy!(KakarotCore, "./.kakarot/artifacts/kakarot.json");

#[derive(Debug)]
pub struct CallInput {
pub(crate) nonce: FieldElement,
pub(crate) from: FieldElement,
Expand Down

0 comments on commit 29bc334

Please sign in to comment.