Merge branch 'schouhy/change-authorization-mechanism' into schouhy/add-token-program

This commit is contained in:
Sergio Chouhy
2025-09-25 12:52:17 -03:00
59 changed files with 1884 additions and 1211 deletions
+1
View File
@@ -21,6 +21,7 @@ workspace = true
[dependencies.sequencer_core]
path = "../sequencer_core"
features = ["testnet"]
[dependencies.sequencer_runner]
path = "../sequencer_runner"
@@ -15,5 +15,7 @@
"addr": "4d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766",
"balance": 20000
}
]
],
"signing_key": [37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 37, 37, 37]
}
+52 -15
View File
@@ -273,21 +273,10 @@ pub async fn test_success_two_transactions() {
info!("Second TX Success!");
}
pub async fn test_get_account_wallet_command() {
let command = Command::GetAccount {
addr: ACC_SENDER.to_string(),
};
pub async fn test_get_account() {
let wallet_config = fetch_config().unwrap();
let seq_client = SequencerClient::new(wallet_config.sequencer_addr.clone()).unwrap();
wallet::execute_subcommand(command).await.unwrap();
info!("Waiting for next block creation");
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
info!("Checking correct account");
let account = seq_client
.get_account(ACC_SENDER.to_string())
.await
@@ -444,6 +433,50 @@ pub async fn test_success_token_program() {
);
}
pub async fn test_pinata() {
let pinata_addr = "cafe".repeat(16);
let pinata_prize = 150;
let solution = 989106;
let command = Command::ClaimPinata {
pinata_addr: pinata_addr.clone(),
winner_addr: ACC_SENDER.to_string(),
solution,
};
let wallet_config = fetch_config().unwrap();
let seq_client = SequencerClient::new(wallet_config.sequencer_addr.clone()).unwrap();
let pinata_balance_pre = seq_client
.get_account_balance(pinata_addr.clone())
.await
.unwrap()
.balance;
wallet::execute_subcommand(command).await.unwrap();
info!("Waiting for next block creation");
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
info!("Checking correct balance move");
let pinata_balance_post = seq_client
.get_account_balance(pinata_addr.clone())
.await
.unwrap()
.balance;
let winner_balance_post = seq_client
.get_account_balance(ACC_SENDER.to_string())
.await
.unwrap()
.balance;
assert_eq!(pinata_balance_post, pinata_balance_pre - pinata_prize);
assert_eq!(winner_balance_post, 10000 + pinata_prize);
info!("Success!");
}
macro_rules! test_cleanup_wrap {
($home_dir:ident, $test_func:ident) => {{
let res = pre_test($home_dir.clone()).await.unwrap();
@@ -479,19 +512,23 @@ pub async fn main_tests_runner() -> Result<()> {
"test_failure" => {
test_cleanup_wrap!(home_dir, test_failure);
}
"test_get_account_wallet_command" => {
test_cleanup_wrap!(home_dir, test_get_account_wallet_command);
"test_get_account" => {
test_cleanup_wrap!(home_dir, test_get_account);
}
"test_success_two_transactions" => {
test_cleanup_wrap!(home_dir, test_success_two_transactions);
}
"test_pinata" => {
test_cleanup_wrap!(home_dir, test_pinata);
}
"all" => {
test_cleanup_wrap!(home_dir, test_success_move_to_another_account);
test_cleanup_wrap!(home_dir, test_success);
test_cleanup_wrap!(home_dir, test_failure);
test_cleanup_wrap!(home_dir, test_success_two_transactions);
test_cleanup_wrap!(home_dir, test_get_account_wallet_command);
test_cleanup_wrap!(home_dir, test_success_token_program);
test_cleanup_wrap!(home_dir, test_pinata);
test_cleanup_wrap!(home_dir, test_get_account);
}
_ => {
anyhow::bail!("Unknown test name");