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

Split accounts 3 #247

Merged
merged 53 commits into from
Nov 10, 2023
Merged

Split accounts 3 #247

merged 53 commits into from
Nov 10, 2023

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Oct 17, 2023

This PR has the full rust implementation.
Rust tests and more ts tests will be made subsequently.

@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 2:09pm
staking-devnet 🛑 Canceled (Inspect) Nov 10, 2023 2:09pm

) -> Result<(VestingSchedule, VestingSchedule)> {
let remaining_amount = total_amount
.checked_sub(transferred_amount)
.ok_or(ErrorCode::GenericOverflow)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You could even throw SplitTooManyTokens here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise that error is not used

Copy link
Collaborator

Choose a reason for hiding this comment

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

the SplitTooManyTokens code implies that this method is only called in the split/accept methods. what happens if someone calls this somewhere else?

@@ -10,31 +10,27 @@ import {
import path from "path";
import { Keypair, PublicKey, Transaction } from "@solana/web3.js";
import { StakeConnection, PythBalance, VestingAccountState } from "../app";
import { BN, Wallet } from "@project-serum/anchor";
import { assertBalanceMatches } from "./utils/api_utils";
import { ErrorCode, BN, Wallet, AnchorError } from "@project-serum/anchor";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some unused imports here

unlocked: PythBalance.fromString("33"),
},
}
);
Copy link
Contributor Author

@guibescos guibescos Nov 9, 2023

Choose a reason for hiding this comment

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

Wonder if we should check more stuff about Alice's account

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe add a call to updateVoterWeight

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is fine as a test. You already have the tests in voter_weight_test around how the different types of tokens are translated into voter weights, so not sure what it achieves to do effectively the same test here.

Copy link
Collaborator

@jayantk jayantk left a comment

Choose a reason for hiding this comment

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

lol approving this myself

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