Skip to content

Commit

Permalink
fix: resolve build issues after core-kernel introduction
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Faust committed Aug 22, 2019
1 parent 0c55ea1 commit e8a2d6b
Show file tree
Hide file tree
Showing 175 changed files with 1,125 additions and 835 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { delegates } = require("../../../../lib/utils/testnet");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Creates a transaction to a new wallet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Send A => B and B => C transactions
Expand All @@ -20,7 +20,6 @@ module.exports = async options => {
.withPassphrase(utils.a.passphrase)
.createOne();


// B => C
let transaction2 = TransactionFactory.transfer(utils.c.address, 250 * Math.pow(10, 8), "transfer B => C")
.withFee(0.1 * Math.pow(10, 8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Re-send B => C transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const { delegates } = require("../../../../lib/utils/testnet");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Creates a transaction to a new wallet
Expand All @@ -24,13 +24,21 @@ module.exports = async options => {
const wallets = secondTxsTypes[secondTxType];
const transferAmount = _balanceNeededFromTxMix(firstTxType, secondTxType);
transactions.push(
TransactionFactory.transfer(wallets[0].address, transferAmount, `init double spend ${firstTxType} - ${secondTxType}`)
TransactionFactory.transfer(
wallets[0].address,
transferAmount,
`init double spend ${firstTxType} - ${secondTxType}`,
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(1))
.createOne(),

TransactionFactory.transfer(wallets[2].address, utils.fees.secondSignRegistration + transferAmount, `init double spend ${firstTxType} - ${secondTxType}`)
TransactionFactory.transfer(
wallets[2].address,
utils.fees.secondSignRegistration + transferAmount,
`init double spend ${firstTxType} - ${secondTxType}`,
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Identities, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Init 2nd signature wallets
Expand All @@ -25,7 +25,7 @@ module.exports = async options => {
TransactionFactory.secondSignature(wallets[3].passphrase)
.withFee(utils.fees.secondSignRegistration)
.withPassphrase(wallets[2].passphrase)
.createOne()
.createOne(),
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Identities, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { delegates } = require("../../../../lib/utils/testnet");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand All @@ -22,10 +22,7 @@ module.exports = async options => {

Object.keys(secondTxsTypes).forEach(secondTxType => {
const wallets = secondTxsTypes[secondTxType];
transactions.push(
_genTransaction(firstTxType, wallets),
_genTransaction(secondTxType, wallets)
);
transactions.push(_genTransaction(firstTxType, wallets), _genTransaction(secondTxType, wallets));
});
});

Expand All @@ -39,7 +36,7 @@ module.exports = async options => {
let transaction;
switch (type) {
case "transfer":
transaction = TransactionFactory.transfer(wallets[1].address, utils.transferAmount)
transaction = TransactionFactory.transfer(wallets[1].address, utils.transferAmount);
break;
case "vote":
transaction = TransactionFactory.vote(delegates[2].publicKey);
Expand All @@ -48,15 +45,14 @@ module.exports = async options => {
transaction = TransactionFactory.secondSignature(wallets[1].passphrase);
break;
case "delegateRegistration":
transaction = TransactionFactory.delegateRegistration(wallets[0].address.slice(0, 10).toLowerCase(),
);
transaction = TransactionFactory.delegateRegistration(wallets[0].address.slice(0, 10).toLowerCase());
break;
}

return transaction
.withFee(utils.fees[type])
.withPassphrase(wallets[0].passphrase)
.withNonce(noncesByAddress[wallets[0].address])
.createOne()
.createOne();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Identities, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { delegates } = require("../../../../lib/utils/testnet");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand All @@ -25,10 +25,7 @@ module.exports = async options => {
if ([firstTxType, secondTxType].indexOf("secondSignRegistration") < 0) {
const wallets = secondTxsTypes[secondTxType];

transactions.push(
_genTransaction(firstTxType, wallets),
_genTransaction(secondTxType, wallets)
);
transactions.push(_genTransaction(firstTxType, wallets), _genTransaction(secondTxType, wallets));
}
});
});
Expand All @@ -43,24 +40,21 @@ module.exports = async options => {
let transaction;
switch (type) {
case "transfer":
transaction = TransactionFactory.transfer(wallets[1].address, utils.transferAmount)
transaction = TransactionFactory.transfer(wallets[1].address, utils.transferAmount);
break;
case "vote":
transaction = TransactionFactory.vote(delegates[2].publicKey);
break;
case "delegateRegistration":
transaction = TransactionFactory.delegateRegistration(
wallets[2].address.slice(0, 10).toLowerCase(),
);
transaction = TransactionFactory.delegateRegistration(wallets[2].address.slice(0, 10).toLowerCase());
break;
}


return transaction
.withFee(utils.fees[type])
.withNonce(noncesByAddress[wallets[2].address])
.withPassphrase(wallets[2].passphrase)
.withSecondPassphrase(wallets[3].passphrase)
.createOne()
.createOne();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { delegates } = require("../../../../lib/utils/testnet");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Creates a transaction to a new wallet
Expand All @@ -18,27 +18,47 @@ module.exports = async options => {
let nonce = Utils.BigNumber.make(1);

const transactions = [
TransactionFactory.transfer(utils.doubleTransferSender.address, 1000 * Math.pow(10, 8), "send coins for double spend - transfer")
TransactionFactory.transfer(
utils.doubleTransferSender.address,
1000 * Math.pow(10, 8),
"send coins for double spend - transfer",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(1))
.createOne(),
TransactionFactory.transfer(utils.doubleTransfer2ndsigSender.address, 1000 * Math.pow(10, 8), "send coins for double spend - transfer with 2nd sig")
TransactionFactory.transfer(
utils.doubleTransfer2ndsigSender.address,
1000 * Math.pow(10, 8),
"send coins for double spend - transfer with 2nd sig",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(2))
.createOne(),
TransactionFactory.transfer(utils.doubleVoteSender.address, 1.5 * Math.pow(10, 8), "send coins for double spend - vote")
TransactionFactory.transfer(
utils.doubleVoteSender.address,
1.5 * Math.pow(10, 8),
"send coins for double spend - vote",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(3))
.createOne(),
TransactionFactory.transfer(utils.doubleDelRegSender.address, 35 * Math.pow(10, 8), "send coins for double spend - delegate registration")
TransactionFactory.transfer(
utils.doubleDelRegSender.address,
35 * Math.pow(10, 8),
"send coins for double spend - delegate registration",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(4))
.createOne(),
TransactionFactory.transfer(utils.double2ndsigRegSender.address, 7 * Math.pow(10, 8), "send coins for double spend - 2nd signature registration")
TransactionFactory.transfer(
utils.double2ndsigRegSender.address,
7 * Math.pow(10, 8),
"send coins for double spend - 2nd signature registration",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(5))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* 2nd signature registration for double spend with 2nd signature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand All @@ -14,11 +14,19 @@ module.exports = async options => {
Managers.configManager.setFromPreset("testnet");

const transactions = [
TransactionFactory.transfer(utils.doubleTransferRecipient.address, 600 * Math.pow(10, 8), "first part of double spend")
TransactionFactory.transfer(
utils.doubleTransferRecipient.address,
600 * Math.pow(10, 8),
"first part of double spend",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(utils.doubleTransferSender.passphrase)
.createOne(),
TransactionFactory.transfer(utils.doubleTransferRecipient.address, 600 * Math.pow(10, 8), "second part of double spend")
TransactionFactory.transfer(
utils.doubleTransferRecipient.address,
600 * Math.pow(10, 8),
"second part of double spend",
)
.withFee(0.1 * Math.pow(10, 8))
.withNonce(Utils.BigNumber.make(1))
.withPassphrase(utils.doubleTransferSender.passphrase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand All @@ -14,13 +14,21 @@ module.exports = async options => {
Managers.configManager.setFromPreset("testnet");

const transactions = [
TransactionFactory.transfer(utils.doubleTransfer2ndsigRecipient.address, 600 * Math.pow(10, 8), "first part of double spend")
TransactionFactory.transfer(
utils.doubleTransfer2ndsigRecipient.address,
600 * Math.pow(10, 8),
"first part of double spend",
)
.withFee(0.1 * Math.pow(10, 8))
.withNonce(Utils.BigNumber.make(1))
.withPassphrase(utils.doubleTransfer2ndsigSender.passphrase)
.withSecondPassphrase(utils.doubleTransfer2ndsigSender2.passphrase)
.createOne(),
TransactionFactory.transfer(utils.doubleTransfer2ndsigRecipient.address, 600 * Math.pow(10, 8), "second part of double spend")
TransactionFactory.transfer(
utils.doubleTransfer2ndsigRecipient.address,
600 * Math.pow(10, 8),
"second part of double spend",
)
.withFee(0.1 * Math.pow(10, 8))
.withNonce(Utils.BigNumber.make(2))
.withPassphrase(utils.doubleTransfer2ndsigSender.passphrase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const { delegates } = require("../../../../lib/utils/testnet");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Attempt to double spend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const { delegates } = require("../../../../lib/utils/testnet");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* Creates a transaction to a new wallet
Expand All @@ -24,7 +24,11 @@ module.exports = async options => {
.withNonce(nonce.plus(1))
.createOne(),

TransactionFactory.transfer(utils.transfer2ndsigSender.address, 1000 * Math.pow(10, 8), "init for transfer with 2nd sig")
TransactionFactory.transfer(
utils.transfer2ndsigSender.address,
1000 * Math.pow(10, 8),
"init for transfer with 2nd sig",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(2))
Expand All @@ -42,7 +46,11 @@ module.exports = async options => {
.withNonce(nonce.plus(4))
.createOne(),

TransactionFactory.transfer(utils.secondsigRegSender.address, 3 * Math.pow(10, 8), "init for 2nd signature registration")
TransactionFactory.transfer(
utils.secondsigRegSender.address,
3 * Math.pow(10, 8),
"init for 2nd signature registration",
)
.withFee(0.1 * Math.pow(10, 8))
.withPassphrase(senderWallet.passphrase)
.withNonce(nonce.plus(5))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Managers } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
const { TransactionFactory } = require("../../../../../helpers/transaction-factory");

/**
* 2nd signature registration for future transfer with 2nd signature
Expand Down
Loading

0 comments on commit e8a2d6b

Please sign in to comment.