-
Notifications
You must be signed in to change notification settings - Fork 20
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
Delegator voting tests #1480
Conversation
🦋 Changeset detectedLatest commit: 272de24 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
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)?) | ||
} |
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.
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).
if let Some(id) = asset_id { | ||
if record.note.asset_id() != id { | ||
continue; | ||
} |
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.
Bug fix 🐞 : The query should respect passing a None
. Currently breaks delegator vote planning.
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!
asset_id: asset::Cache::with_known_assets() | ||
.get_unit("upenumbra") | ||
.unwrap() | ||
.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.
It's up to you, but you can simplify it to
asset_id: *STAKING_TOKEN_ASSET_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.
oh nice, will update
Follow up from #1426 & #1427
Now that we have a reasonable mock testing framework, wrote full-coverage tests for delegator voting.