Merge branch 'arjentix/fix-sequencer-msg-id' into Pravdyvy/indexer-state-management

This commit is contained in:
Pravdyvy
2026-02-13 13:37:10 +02:00
66 changed files with 4691 additions and 5759 deletions
@@ -37,13 +37,13 @@ async fn private_transfer_to_owned_account() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&from)
.get_private_account_commitment(from)
.context("Failed to get private account commitment for sender")?;
assert!(verify_commitment_is_in_state(new_commitment1, ctx.sequencer_client()).await);
let new_commitment2 = ctx
.wallet()
.get_private_account_commitment(&to)
.get_private_account_commitment(to)
.context("Failed to get private account commitment for receiver")?;
assert!(verify_commitment_is_in_state(new_commitment2, ctx.sequencer_client()).await);
@@ -79,7 +79,7 @@ async fn private_transfer_to_foreign_account() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&from)
.get_private_account_commitment(from)
.context("Failed to get private account commitment for sender")?;
let tx = fetch_privacy_preserving_tx(ctx.sequencer_client(), tx_hash).await;
@@ -105,7 +105,7 @@ async fn deshielded_transfer_to_public_account() -> Result<()> {
// Check initial balance of the private sender
let from_acc = ctx
.wallet()
.get_account_private(&from)
.get_account_private(from)
.context("Failed to get sender's private account")?;
assert_eq!(from_acc.balance, 10000);
@@ -124,11 +124,11 @@ async fn deshielded_transfer_to_public_account() -> Result<()> {
let from_acc = ctx
.wallet()
.get_account_private(&from)
.get_account_private(from)
.context("Failed to get sender's private account")?;
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&from)
.get_private_account_commitment(from)
.context("Failed to get private account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
@@ -164,7 +164,7 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> {
.wallet()
.storage()
.user_data
.get_private_account(&to_account_id)
.get_private_account(to_account_id)
.cloned()
.context("Failed to get private account")?;
@@ -190,7 +190,7 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&from)
.get_private_account_commitment(from)
.context("Failed to get private account commitment for sender")?;
assert_eq!(tx.message.new_commitments[0], new_commitment1);
@@ -201,7 +201,7 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> {
let to_res_acc = ctx
.wallet()
.get_account_private(&to_account_id)
.get_account_private(to_account_id)
.context("Failed to get recipient's private account")?;
assert_eq!(to_res_acc.balance, 100);
@@ -232,11 +232,11 @@ async fn shielded_transfer_to_owned_private_account() -> Result<()> {
let acc_to = ctx
.wallet()
.get_account_private(&to)
.get_account_private(to)
.context("Failed to get receiver's private account")?;
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&to)
.get_private_account_commitment(to)
.context("Failed to get receiver's commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
@@ -321,7 +321,7 @@ async fn private_transfer_to_owned_account_continuous_run_path() -> Result<()> {
.wallet()
.storage()
.user_data
.get_private_account(&to_account_id)
.get_private_account(to_account_id)
.cloned()
.context("Failed to get private account")?;
@@ -354,7 +354,7 @@ async fn private_transfer_to_owned_account_continuous_run_path() -> Result<()> {
// Verify receiver account balance
let to_res_acc = ctx
.wallet()
.get_account_private(&to_account_id)
.get_account_private(to_account_id)
.context("Failed to get receiver account")?;
assert_eq!(to_res_acc.balance, 100);
@@ -385,13 +385,13 @@ async fn initialize_private_account() -> Result<()> {
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&account_id)
.get_private_account_commitment(account_id)
.context("Failed to get private account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
let account = ctx
.wallet()
.get_account_private(&account_id)
.get_account_private(account_id)
.context("Failed to get private account")?;
assert_eq!(
+3 -3
View File
@@ -12,7 +12,7 @@ use tokio::test;
use wallet::cli::{Command, programs::native_token_transfer::AuthTransferSubcommand};
/// Timeout in milliseconds to reliably await for block finalization
const L2_TO_L1_TIMEOUT_MILLIS: u64 = 100000;
const L2_TO_L1_TIMEOUT_MILLIS: u64 = 220000;
#[test]
async fn indexer_test_run() -> Result<()> {
@@ -130,13 +130,13 @@ async fn indexer_state_consistency() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&from)
.get_private_account_commitment(from)
.context("Failed to get private account commitment for sender")?;
assert!(verify_commitment_is_in_state(new_commitment1, ctx.sequencer_client()).await);
let new_commitment2 = ctx
.wallet()
.get_private_account_commitment(&to)
.get_private_account_commitment(to)
.context("Failed to get private account commitment for receiver")?;
assert!(verify_commitment_is_in_state(new_commitment2, ctx.sequencer_client()).await);
+2 -2
View File
@@ -188,11 +188,11 @@ async fn restore_keys_from_seed() -> Result<()> {
// Verify commitments exist for private accounts
let comm1 = ctx
.wallet()
.get_private_account_commitment(&to_account_id1)
.get_private_account_commitment(to_account_id1)
.expect("Acc 1 commitment should exist");
let comm2 = ctx
.wallet()
.get_private_account_commitment(&to_account_id2)
.get_private_account_commitment(to_account_id2)
.expect("Acc 2 commitment should exist");
assert!(verify_commitment_is_in_state(comm1, ctx.sequencer_client()).await);
+3 -3
View File
@@ -86,7 +86,7 @@ async fn claim_pinata_to_existing_private_account() -> Result<()> {
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&ctx.existing_private_accounts()[0])
.get_private_account_commitment(ctx.existing_private_accounts()[0])
.context("Failed to get private account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
@@ -135,7 +135,7 @@ async fn claim_pinata_to_new_private_account() -> Result<()> {
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&winner_account_id)
.get_private_account_commitment(winner_account_id)
.context("Failed to get private account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
@@ -157,7 +157,7 @@ async fn claim_pinata_to_new_private_account() -> Result<()> {
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&winner_account_id)
.get_private_account_commitment(winner_account_id)
.context("Failed to get private account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
+44 -39
View File
@@ -65,8 +65,8 @@ async fn create_and_transfer_public_token() -> Result<()> {
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_public_account_id(definition_account_id),
supply_account_id: format_public_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name: name.clone(),
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -161,7 +161,7 @@ async fn create_and_transfer_public_token() -> Result<()> {
let subcommand = TokenProgramAgnosticSubcommand::Burn {
definition: format_public_account_id(definition_account_id),
holder: format_public_account_id(recipient_account_id),
amount: 3,
amount: burn_amount,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -304,8 +304,8 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_public_account_id(definition_account_id),
supply_account_id: format_private_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name: name.clone(),
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -333,7 +333,7 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&supply_account_id)
.get_private_account_commitment(supply_account_id)
.context("Failed to get supply account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment1, ctx.sequencer_client()).await);
@@ -354,13 +354,13 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
let new_commitment1 = ctx
.wallet()
.get_private_account_commitment(&supply_account_id)
.get_private_account_commitment(supply_account_id)
.context("Failed to get supply account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment1, ctx.sequencer_client()).await);
let new_commitment2 = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id)
.get_private_account_commitment(recipient_account_id)
.context("Failed to get recipient account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment2, ctx.sequencer_client()).await);
@@ -369,7 +369,7 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
let subcommand = TokenProgramAgnosticSubcommand::Burn {
definition: format_public_account_id(definition_account_id),
holder: format_private_account_id(recipient_account_id),
amount: 3,
amount: burn_amount,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -396,14 +396,14 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
let new_commitment2 = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id)
.get_private_account_commitment(recipient_account_id)
.context("Failed to get recipient account commitment")?;
assert!(verify_commitment_is_in_state(new_commitment2, ctx.sequencer_client()).await);
// Check the recipient account balance after burn
let recipient_acc = ctx
.wallet()
.get_account_private(&recipient_account_id)
.get_account_private(recipient_account_id)
.context("Failed to get recipient account")?;
let token_holding = TokenHolding::try_from(&recipient_acc.data)?;
@@ -460,8 +460,8 @@ async fn create_token_with_private_definition() -> Result<()> {
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_private_account_id(definition_account_id),
supply_account_id: format_public_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name: name.clone(),
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -472,7 +472,7 @@ async fn create_token_with_private_definition() -> Result<()> {
// Verify private definition commitment
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&definition_account_id)
.get_private_account_commitment(definition_account_id)
.context("Failed to get definition commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
@@ -537,7 +537,7 @@ async fn create_token_with_private_definition() -> Result<()> {
// Verify definition account has updated supply
let definition_acc = ctx
.wallet()
.get_account_private(&definition_account_id)
.get_account_private(definition_account_id)
.context("Failed to get definition account")?;
let token_definition = TokenDefinition::try_from(&definition_acc.data)?;
@@ -584,14 +584,14 @@ async fn create_token_with_private_definition() -> Result<()> {
// Verify private recipient commitment
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id_private)
.get_private_account_commitment(recipient_account_id_private)
.context("Failed to get recipient commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
// Verify private recipient balance
let recipient_acc_private = ctx
.wallet()
.get_account_private(&recipient_account_id_private)
.get_account_private(recipient_account_id_private)
.context("Failed to get private recipient account")?;
let token_holding = TokenHolding::try_from(&recipient_acc_private.data)?;
@@ -639,12 +639,13 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
};
// Create token with both private definition and supply
let name = "A NAME".to_string();
let total_supply = 37;
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_private_account_id(definition_account_id),
supply_account_id: format_private_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name,
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -655,21 +656,21 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
// Verify definition commitment
let definition_commitment = ctx
.wallet()
.get_private_account_commitment(&definition_account_id)
.get_private_account_commitment(definition_account_id)
.context("Failed to get definition commitment")?;
assert!(verify_commitment_is_in_state(definition_commitment, ctx.sequencer_client()).await);
// Verify supply commitment
let supply_commitment = ctx
.wallet()
.get_private_account_commitment(&supply_account_id)
.get_private_account_commitment(supply_account_id)
.context("Failed to get supply commitment")?;
assert!(verify_commitment_is_in_state(supply_commitment, ctx.sequencer_client()).await);
// Verify supply balance
let supply_acc = ctx
.wallet()
.get_account_private(&supply_account_id)
.get_account_private(supply_account_id)
.context("Failed to get supply account")?;
let token_holding = TokenHolding::try_from(&supply_acc.data)?;
@@ -712,20 +713,20 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
// Verify both commitments updated
let supply_commitment = ctx
.wallet()
.get_private_account_commitment(&supply_account_id)
.get_private_account_commitment(supply_account_id)
.context("Failed to get supply commitment")?;
assert!(verify_commitment_is_in_state(supply_commitment, ctx.sequencer_client()).await);
let recipient_commitment = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id)
.get_private_account_commitment(recipient_account_id)
.context("Failed to get recipient commitment")?;
assert!(verify_commitment_is_in_state(recipient_commitment, ctx.sequencer_client()).await);
// Verify balances
let supply_acc = ctx
.wallet()
.get_account_private(&supply_account_id)
.get_account_private(supply_account_id)
.context("Failed to get supply account")?;
let token_holding = TokenHolding::try_from(&supply_acc.data)?;
assert_eq!(
@@ -738,7 +739,7 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
let recipient_acc = ctx
.wallet()
.get_account_private(&recipient_account_id)
.get_account_private(recipient_account_id)
.context("Failed to get recipient account")?;
let token_holding = TokenHolding::try_from(&recipient_acc.data)?;
assert_eq!(
@@ -798,12 +799,13 @@ async fn shielded_token_transfer() -> Result<()> {
};
// Create token
let name = "A NAME".to_string();
let total_supply = 37;
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_public_account_id(definition_account_id),
supply_account_id: format_public_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name,
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -844,14 +846,14 @@ async fn shielded_token_transfer() -> Result<()> {
// Verify recipient commitment exists
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id)
.get_private_account_commitment(recipient_account_id)
.context("Failed to get recipient commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
// Verify recipient balance
let recipient_acc = ctx
.wallet()
.get_account_private(&recipient_account_id)
.get_account_private(recipient_account_id)
.context("Failed to get recipient account")?;
let token_holding = TokenHolding::try_from(&recipient_acc.data)?;
assert_eq!(
@@ -911,12 +913,13 @@ async fn deshielded_token_transfer() -> Result<()> {
};
// Create token with private supply
let name = "A NAME".to_string();
let total_supply = 37;
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_public_account_id(definition_account_id),
supply_account_id: format_private_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name,
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -942,14 +945,14 @@ async fn deshielded_token_transfer() -> Result<()> {
// Verify supply account commitment exists
let new_commitment = ctx
.wallet()
.get_private_account_commitment(&supply_account_id)
.get_private_account_commitment(supply_account_id)
.context("Failed to get supply commitment")?;
assert!(verify_commitment_is_in_state(new_commitment, ctx.sequencer_client()).await);
// Verify supply balance
let supply_acc = ctx
.wallet()
.get_account_private(&supply_account_id)
.get_account_private(supply_account_id)
.context("Failed to get supply account")?;
let token_holding = TokenHolding::try_from(&supply_acc.data)?;
assert_eq!(
@@ -1011,11 +1014,13 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
};
// Create token
let name = "A NAME".to_string();
let total_supply = 37;
let subcommand = TokenProgramAgnosticSubcommand::New {
definition_account_id: format_private_account_id(definition_account_id),
supply_account_id: format_private_account_id(supply_account_id),
name: "A NAME".to_string(),
total_supply: 37,
name,
total_supply,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@@ -1041,7 +1046,7 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
.wallet()
.storage()
.user_data
.get_private_account(&recipient_account_id)
.get_private_account(recipient_account_id)
.cloned()
.context("Failed to get private account keys")?;
@@ -1067,14 +1072,14 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
// Verify commitment exists
let recipient_commitment = ctx
.wallet()
.get_private_account_commitment(&recipient_account_id)
.get_private_account_commitment(recipient_account_id)
.context("Failed to get recipient commitment")?;
assert!(verify_commitment_is_in_state(recipient_commitment, ctx.sequencer_client()).await);
// Verify balance
let recipient_acc = ctx
.wallet()
.get_account_private(&recipient_account_id)
.get_account_private(recipient_account_id)
.context("Failed to get recipient account")?;
let token_holding = TokenHolding::try_from(&recipient_acc.data)?;
assert_eq!(
File diff suppressed because it is too large Load Diff