-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat: Adding proc fold, its endpoint and its unit test #13
Conversation
lib/contracts/poker/poker.masm
Outdated
use.miden::account | ||
|
||
# const.CURRNET_TURN_PLAYER_PUB_KEY_INDEX=63 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete this file since we are not using it anywhere.
lib/src/accounts/mod.rs
Outdated
@@ -173,10 +173,10 @@ fn construct_game_constructor_storage( | |||
]; | |||
player_pub_keys.extend(player_slots); | |||
|
|||
slot_index += 8; // since the mid 9 elements would cover the player stats and initially all those values are zero | |||
slot_index += 13; // since the mid 9 elements would cover the player stats and initially all those values are zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hardcode this different in constant, And name it something suitable.
@@ -64,6 +69,13 @@ pub struct PlayCallTransactionData { | |||
target_account_id: AccountId, | |||
} | |||
|
|||
#[derive(Clone)] | |||
pub struct PlayFoldTransactionData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we start moving types to types
library crate ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ig
RpoDigest::new([Felt::from(next_turn_index), Felt::ZERO, Felt::ZERO, Felt::ZERO]) | ||
); | ||
} | ||
|
||
async fn fund_account(client: &mut AzeClient, account_id: AccountId, faucet_account_id: AccountId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we minting two notes here to same account id ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func is also used by test_cards_dist, where two notes need to be minted as there are two players to whom cards are being distributed.
assert_eq!( | ||
game_account_storage.get_item(fold_index), | ||
RpoDigest::new([Felt::from(1 as u8), Felt::ZERO, Felt::ZERO, Felt::ZERO]) | ||
); | ||
|
||
let next_turn_index = slot_data.current_turn_index() + 13; | ||
// check next turn index | ||
assert_eq!( | ||
game_account_storage.get_item(CURRENT_TURN_INDEX_SLOT), | ||
RpoDigest::new([Felt::from(next_turn_index), Felt::ZERO, Felt::ZERO, Felt::ZERO]) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need few more assertions ig, but i think it's fine for now.
lib/contracts/notes/game/fold.masm
Outdated
# => [no_of_players, next_turn_index] | ||
|
||
# Calculate last_player_index = 52 + 13 * no_of_players + 0 | ||
push.13 mul |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 52 and 13 would always remain fixed so can you create constants for storing these values. Or use them if you have already created one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
No description provided.