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

feat: Implement Delegate Resignation (AIP11) #2538

Merged
merged 28 commits into from
May 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8d9eacf
feat: complete the delegate resignation transaction type
vasild May 7, 2019
9eb4aba
Merge remote-tracking branch 'ArkEcosystem/core/develop' into feat/de…
vasild May 8, 2019
90e4b83
feat: introduce a wallet flag indicating whether a delegate resigned
vasild May 8, 2019
f334cad
Merge remote-tracking branch 'ArkEcosystem/core/develop' into feat/de…
vasild May 8, 2019
b58f7dc
feat: do not allow voting for a resigned delegate
vasild May 8, 2019
7c9040a
Merge branch 'develop' into feat/delegate-resignation
faustbrian May 9, 2019
bcfce03
fix: revert all unnecessary changes
May 9, 2019
758981e
fix(core-transactions): apply resigned flag on boot to delegates
May 9, 2019
ef434f9
test: adjust expectations of failing tests
May 9, 2019
e19bfd5
test: add handler and functional tests for delegate resignation
May 9, 2019
68aef6f
test(crypto): enable AIP11 for delegate resignation signing
May 9, 2019
d55644b
test(functional): add delegate resignation forging tests
May 9, 2019
119d03e
test(functional): register a delegate before resigning with 2nd signa…
May 9, 2019
231169d
chore: remove `delegates` argument from buildDelegateRanking()
vasild May 9, 2019
4df1f59
chore: set delegate resignation version to 2
vasild May 9, 2019
fc0f65c
test: update and enable DelegateResignationTransaction unit tests
vasild May 9, 2019
6c8f73c
test: generate a proper tx to test delegate resignation
vasild May 9, 2019
049e826
Merge remote-tracking branch 'ArkEcosystem/core/develop' into feat/de…
vasild May 9, 2019
fb137fa
test: use unitnet for unit tests
vasild May 9, 2019
4d9ffda
fix: throw if a delegate already resigned
May 10, 2019
4200d0d
fix: variable name collision
May 10, 2019
9031872
Merge remote-tracking branch 'ArkEcosystem/core/develop' into feat/de…
vasild May 10, 2019
9cf775b
Merge branch 'develop' into feat/delegate-resignation
faustbrian May 10, 2019
0fd5b3c
Merge branch 'develop' into feat/delegate-resignation
faustbrian May 10, 2019
14d57b9
test: adjust tests after 1bea3ff4e
vasild May 10, 2019
17c6487
Merge branch 'develop' into feat/delegate-resignation
faustbrian May 10, 2019
eda7137
Apply suggestions from code review
faustbrian May 10, 2019
805c3d8
Update __tests__/functional/transaction-forging/delegate-resignation.…
faustbrian May 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: update and enable DelegateResignationTransaction unit tests
  • Loading branch information
vasild committed May 9, 2019
commit fc0f65c45511db924092e3fe1f90f3418e4338e5
16 changes: 10 additions & 6 deletions __tests__/unit/core-transactions/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SenderWalletMismatchError,
UnexpectedSecondSignatureError,
UnvoteMismatchError,
WalletNoUsernameError,
WalletUsernameEmptyError,
WalletUsernameNotEmptyError,
} from "../../../packages/core-transactions/src/errors";
import { TransactionHandler } from "../../../packages/core-transactions/src/handlers/transaction";
Expand Down Expand Up @@ -799,7 +799,11 @@ describe.skip("MultiPaymentTransaction", () => {
});
});

describe.skip("DelegateResignationTransaction", () => {
describe("DelegateResignationTransaction", () => {
beforeAll(() => {
Managers.configManager.setFromPreset("testnet");
});

beforeEach(() => {
transaction = transactionFixture;
senderWallet = walletFixture;
Expand All @@ -809,17 +813,17 @@ describe.skip("DelegateResignationTransaction", () => {
});

describe("canApply", () => {
it("should be truth", () => {
it("should be true if wallet has registered username", () => {
senderWallet.username = "dummy";
expect(handler.canBeApplied(instance, senderWallet, walletManager)).toBeTrue();
});

it.skip("should be false if wallet has no registered username", () => {
it("should throw if wallet has no registered username", () => {
senderWallet.username = undefined;
expect(() => handler.canBeApplied(instance, senderWallet, walletManager)).toThrow(WalletNoUsernameError);
expect(() => handler.canBeApplied(instance, senderWallet, walletManager)).toThrow(WalletUsernameEmptyError);
});

it("should be false if wallet has insufficient funds", () => {
it("should throw if wallet has insufficient funds", () => {
senderWallet.balance = Utils.BigNumber.ZERO;
expect(() => handler.canBeApplied(instance, senderWallet, walletManager)).toThrow(InsufficientBalanceError);
});
Expand Down