Skip to content

Commit caaede0

Browse files
authored
removed hardcoded nemesis epoch (#686)
Removed hardcoded nemesis epoch Added server duration handler
1 parent a0255f0 commit caaede0

File tree

94 files changed

+1295
-824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1295
-824
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { toArray, take } from 'rxjs/operators';
3838
import { deepEqual } from 'assert';
3939
import { Order } from '../../src/infrastructure/infrastructure';
4040
import { AccountOrderBy } from '../../src/infrastructure/searchCriteria/AccountOrderBy';
41+
import { Duration } from 'js-joda';
4142

4243
describe('AccountHttp', () => {
4344
const helper = new IntegrationTestHelper();
@@ -56,6 +57,8 @@ describe('AccountHttp', () => {
5657
let generationHash: string;
5758
let networkType: NetworkType;
5859

60+
const epochAdjustment = Duration.ofSeconds(1573430400);
61+
5962
before(() => {
6063
return helper.start({ openListener: true }).then(() => {
6164
account = helper.account;
@@ -87,7 +90,7 @@ describe('AccountHttp', () => {
8790
describe('Make sure test account is not virgin', () => {
8891
it('Announce TransferTransaction', () => {
8992
const transferTransaction = TransferTransaction.create(
90-
Deadline.create(),
93+
Deadline.create(epochAdjustment),
9194
account2.address,
9295
[helper.createNetworkCurrency(1, false)],
9396
PlainMessage.create('test-message'),
@@ -104,7 +107,7 @@ describe('AccountHttp', () => {
104107
it('Announce NamespaceRegistrationTransaction', () => {
105108
const namespaceName = 'root-test-namespace-' + Math.floor(Math.random() * 10000);
106109
const registerNamespaceTransaction = NamespaceRegistrationTransaction.createRootNamespace(
107-
Deadline.create(),
110+
Deadline.create(epochAdjustment),
108111
namespaceName,
109112
UInt64.fromUint(9),
110113
networkType,
@@ -119,7 +122,7 @@ describe('AccountHttp', () => {
119122
describe('Setup test AddressAlias', () => {
120123
it('Announce addressAliasTransaction', () => {
121124
const addressAliasTransaction = AddressAliasTransaction.create(
122-
Deadline.create(),
125+
Deadline.create(epochAdjustment),
123126
AliasAction.Link,
124127
namespaceId,
125128
account.address,
@@ -134,7 +137,7 @@ describe('AccountHttp', () => {
134137
describe('Setup test multisig account', () => {
135138
it('Announce MultisigAccountModificationTransaction', () => {
136139
const modifyMultisigAccountTransaction = MultisigAccountModificationTransaction.create(
137-
Deadline.create(),
140+
Deadline.create(epochAdjustment),
138141
2,
139142
1,
140143
[cosignAccount1.address, cosignAccount2.address, cosignAccount3.address],
@@ -144,7 +147,7 @@ describe('AccountHttp', () => {
144147
);
145148

146149
const aggregateTransaction = AggregateTransaction.createComplete(
147-
Deadline.create(),
150+
Deadline.create(epochAdjustment),
148151
[modifyMultisigAccountTransaction.toAggregate(multisigAccount.publicAccount)],
149152
networkType,
150153
[],
@@ -249,7 +252,7 @@ describe('AccountHttp', () => {
249252
describe('Remove test AddressAlias', () => {
250253
it('Announce addressAliasTransaction', () => {
251254
const addressAliasTransaction = AddressAliasTransaction.create(
252-
Deadline.create(),
255+
Deadline.create(epochAdjustment),
253256
AliasAction.Unlink,
254257
namespaceId,
255258
account.address,
@@ -264,7 +267,7 @@ describe('AccountHttp', () => {
264267
describe('Restore test multisig Accounts', () => {
265268
it('Announce MultisigAccountModificationTransaction', () => {
266269
const removeCosigner1 = MultisigAccountModificationTransaction.create(
267-
Deadline.create(),
270+
Deadline.create(epochAdjustment),
268271
-1,
269272
0,
270273
[],
@@ -273,7 +276,7 @@ describe('AccountHttp', () => {
273276
helper.maxFee,
274277
);
275278
const removeCosigner2 = MultisigAccountModificationTransaction.create(
276-
Deadline.create(),
279+
Deadline.create(epochAdjustment),
277280
0,
278281
0,
279282
[],
@@ -283,7 +286,7 @@ describe('AccountHttp', () => {
283286
);
284287

285288
const removeCosigner3 = MultisigAccountModificationTransaction.create(
286-
Deadline.create(),
289+
Deadline.create(epochAdjustment),
287290
-1,
288291
-1,
289292
[],
@@ -293,7 +296,7 @@ describe('AccountHttp', () => {
293296
);
294297

295298
const aggregateTransaction = AggregateTransaction.createComplete(
296-
Deadline.create(),
299+
Deadline.create(epochAdjustment),
297300
[
298301
removeCosigner1.toAggregate(multisigAccount.publicAccount),
299302
removeCosigner2.toAggregate(multisigAccount.publicAccount),

e2e/infrastructure/BlockHttp.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { take } from 'rxjs/operators';
3131
import { TransactionStatement } from '../../src/model/model';
3232
import { ReceiptPaginationStreamer } from '../../src/infrastructure/paginationStreamer/ReceiptPaginationStreamer';
3333
import { Order } from '../../src/infrastructure/infrastructure';
34+
import { Duration } from 'js-joda';
3435

3536
describe('BlockHttp', () => {
3637
const helper = new IntegrationTestHelper();
@@ -43,6 +44,8 @@ describe('BlockHttp', () => {
4344
let networkType: NetworkType;
4445
let transactionHash;
4546

47+
const epochAdjustment = Duration.ofSeconds(1573430400);
48+
4649
before(() => {
4750
return helper.start({ openListener: true }).then(() => {
4851
account = helper.account;
@@ -67,7 +70,7 @@ describe('BlockHttp', () => {
6770
describe('Setup Test Data', () => {
6871
it('Announce TransferTransaction FER', () => {
6972
const transferTransaction = TransferTransaction.create(
70-
Deadline.create(),
73+
Deadline.create(epochAdjustment),
7174
account2.address,
7275
[helper.createNetworkCurrency(1, false)],
7376
PlainMessage.create('test-message'),

e2e/infrastructure/HashLockHttp.spec.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { ChronoUnit } from 'js-joda';
3434
import { SignedTransaction } from '../../src/model/transaction/SignedTransaction';
3535
import { UnresolvedMosaicId } from '../../src/model/mosaic/UnresolvedMosaicId';
3636
import { HashLockRepository } from '../../src/infrastructure/HashLockRepository';
37+
import { Duration } from 'js-joda';
3738

3839
describe('HashLockHttp', () => {
3940
const helper = new IntegrationTestHelper();
@@ -48,6 +49,8 @@ describe('HashLockHttp', () => {
4849
let generationHash: string;
4950
let networkType: NetworkType;
5051

52+
const epochAdjustment = Duration.ofSeconds(1573430400);
53+
5154
before(() => {
5255
return helper.start({ openListener: true }).then(() => {
5356
account = helper.account;
@@ -68,7 +71,7 @@ describe('HashLockHttp', () => {
6871

6972
const createSignedAggregatedBondTransaction = (aggregatedTo: Account, signer: Account, recipient: Address): SignedTransaction => {
7073
const transferTransaction = TransferTransaction.create(
71-
Deadline.create(),
74+
Deadline.create(epochAdjustment),
7275
recipient,
7376
[],
7477
PlainMessage.create('test-message'),
@@ -77,7 +80,7 @@ describe('HashLockHttp', () => {
7780
);
7881

7982
const aggregateTransaction = AggregateTransaction.createBonded(
80-
Deadline.create(2, ChronoUnit.MINUTES),
83+
Deadline.create(epochAdjustment, 2, ChronoUnit.MINUTES),
8184
[transferTransaction.toAggregate(aggregatedTo.publicAccount)],
8285
networkType,
8386
[],
@@ -92,7 +95,7 @@ describe('HashLockHttp', () => {
9295
mosaicId: UnresolvedMosaicId,
9396
): any => {
9497
const lockFundsTransaction = LockFundsTransaction.create(
95-
Deadline.create(),
98+
Deadline.create(epochAdjustment),
9699
new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, helper.networkCurrencyDivisibility))),
97100
UInt64.fromUint(1000),
98101
signedAggregatedTransaction,
@@ -112,7 +115,7 @@ describe('HashLockHttp', () => {
112115
describe('Setup test multisig account', () => {
113116
it('Announce MultisigAccountModificationTransaction', () => {
114117
const modifyMultisigAccountTransaction = MultisigAccountModificationTransaction.create(
115-
Deadline.create(),
118+
Deadline.create(epochAdjustment),
116119
2,
117120
1,
118121
[cosignAccount1.address, cosignAccount2.address, cosignAccount3.address],
@@ -122,7 +125,7 @@ describe('HashLockHttp', () => {
122125
);
123126

124127
const aggregateTransaction = AggregateTransaction.createComplete(
125-
Deadline.create(),
128+
Deadline.create(epochAdjustment),
126129
[modifyMultisigAccountTransaction.toAggregate(multisigAccount.publicAccount)],
127130
networkType,
128131
[],
@@ -190,7 +193,7 @@ describe('HashLockHttp', () => {
190193
describe('Restore test multisig Accounts', () => {
191194
it('Announce MultisigAccountModificationTransaction', () => {
192195
const removeCosigner1 = MultisigAccountModificationTransaction.create(
193-
Deadline.create(),
196+
Deadline.create(epochAdjustment),
194197
-1,
195198
0,
196199
[],
@@ -199,7 +202,7 @@ describe('HashLockHttp', () => {
199202
helper.maxFee,
200203
);
201204
const removeCosigner2 = MultisigAccountModificationTransaction.create(
202-
Deadline.create(),
205+
Deadline.create(epochAdjustment),
203206
0,
204207
0,
205208
[],
@@ -209,7 +212,7 @@ describe('HashLockHttp', () => {
209212
);
210213

211214
const removeCosigner3 = MultisigAccountModificationTransaction.create(
212-
Deadline.create(),
215+
Deadline.create(epochAdjustment),
213216
-1,
214217
-1,
215218
[],
@@ -219,7 +222,7 @@ describe('HashLockHttp', () => {
219222
);
220223

221224
const aggregateTransaction = AggregateTransaction.createComplete(
222-
Deadline.create(),
225+
Deadline.create(epochAdjustment),
223226
[
224227
removeCosigner1.toAggregate(multisigAccount.publicAccount),
225228
removeCosigner2.toAggregate(multisigAccount.publicAccount),

e2e/infrastructure/IntegrationTestHelper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction
2929
import { Transaction } from '../../src/model/transaction/Transaction';
3030
import { UInt64 } from '../../src/model/UInt64';
3131
import { TransactionService } from '../../src/service/TransactionService';
32+
import { Duration } from 'js-joda';
3233

3334
export class IntegrationTestHelper {
3435
public apiUrl: string;
@@ -52,6 +53,7 @@ export class IntegrationTestHelper {
5253
public service = new BootstrapService();
5354
public config: StartParams;
5455
public startEachTime = true;
56+
public epochAdjustment: Duration;
5557

5658
private async startBootstrapServer(): Promise<{ accounts: string[]; apiUrl: string }> {
5759
this.config = {
@@ -112,6 +114,7 @@ export class IntegrationTestHelper {
112114

113115
this.networkType = await this.repositoryFactory.getNetworkType().toPromise();
114116
this.generationHash = await this.repositoryFactory.getGenerationHash().toPromise();
117+
this.epochAdjustment = await this.repositoryFactory.getEpochAdjustment().toPromise();
115118

116119
let index = 0;
117120
this.account = Account.createFromPrivateKey(accounts[index++], this.networkType);

0 commit comments

Comments
 (0)