Skip to content
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

Delegator voting tests #1480

Merged
merged 6 commits into from
Jul 16, 2024
Merged

Delegator voting tests #1480

merged 6 commits into from
Jul 16, 2024

Conversation

grod220
Copy link
Contributor

@grod220 grod220 commented Jul 15, 2024

Follow up from #1426 & #1427

Now that we have a reasonable mock testing framework, wrote full-coverage tests for delegator voting.

Copy link

changeset-bot bot commented Jul 15, 2024

🦋 Changeset detected

Latest commit: 272de24

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@penumbra-zone/wasm Patch
@penumbra-zone/perspective Patch
@penumbra-zone/query Patch
@penumbra-zone/services Patch
@penumbra-zone/storage Patch
minifront Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +151 to +160
let tx_planner_req = TransactionPlannerRequest::decode(request)?;
let fvk: FullViewingKey = FullViewingKey::decode(full_viewing_key)?;
let fee_asset_id = Id::decode(gas_fee_token)?;
let constants: DbConstants = serde_wasm_bindgen::from_value(idb_constants)?;
let storage = init_idb_storage(constants).await?;

let plan = plan_transaction_inner(storage, tx_planner_req, fvk, fee_asset_id).await?;

Ok(serde_wasm_bindgen::to_value(&plan)?)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created plan_transaction_inner() in order to separate the serde serialization from the core logic of the function (that gets tested in the test suite).

Comment on lines +97 to +100
if let Some(id) = asset_id {
if record.note.asset_id() != id {
continue;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fix 🐞 : The query should respect passing a None. Currently breaks delegator vote planning.

@grod220 grod220 requested a review from a team July 15, 2024 19:36
Copy link
Contributor

@Valentine1898 Valentine1898 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 77 to 80
asset_id: asset::Cache::with_known_assets()
.get_unit("upenumbra")
.unwrap()
.id(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you, but you can simplify it to
asset_id: *STAKING_TOKEN_ASSET_ID,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice, will update

@grod220 grod220 merged commit 1a57749 into main Jul 16, 2024
6 checks passed
@grod220 grod220 deleted the dg-voting-tests branch July 16, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants