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

test: abstract some mining heights #865

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 17 additions & 17 deletions test/auction-reorg-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ describe('Auction Reorg', function() {
assert(await chain.add(block));
});

it('should mine 10 blocks', async () => {
for (let i = 0; i < 10; i++) {
it('should mine through the bidding period', async () => {
for (let i = 0; i < network.names.biddingPeriod; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand All @@ -161,8 +161,8 @@ describe('Auction Reorg', function() {
assert(await chain.add(block));
});

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine through the reveal period', async () => {
for (let i = 0; i < network.names.revealPeriod; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand All @@ -186,14 +186,6 @@ describe('Auction Reorg', function() {
assert(await chain.add(block));
});

it('should mine 10 blocks', async () => {
for (let i = 0; i < 10; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
}
});

it('should register again and update tree', async () => {
const mtx = await winner.createUpdate(NAME1, Buffer.from([1,2,4]));

Expand All @@ -218,6 +210,14 @@ describe('Auction Reorg', function() {
assert(await chain.add(block));
});

it('should mine past tree interval', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
}
});

it('should renew', async () => {
const mtx = await winner.createRenewal(NAME1);

Expand Down Expand Up @@ -251,7 +251,7 @@ describe('Auction Reorg', function() {
assert.strictEqual(err.reason, 'bad-renewal-premature');
});

it('should mine 10 blocks', async () => {
it('should mine through tree txn commitment', async () => {
const left = treeInterval - (chain.height % treeInterval);

for (let i = 0; i < left; i++) {
Expand Down Expand Up @@ -546,8 +546,8 @@ describe('Auction Reorg', function() {
});
*/

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine a tree interval blocks', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down Expand Up @@ -620,8 +620,8 @@ describe('Auction Reorg', function() {
assert.strictEqual(err.reason, 'bad-finalize-maturity');
});

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine through the transfer lock period', async () => {
for (let i = 0; i < network.names.transferLockup; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down
28 changes: 14 additions & 14 deletions test/auction-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ describe('Auction', function() {
assert(await chain.add(block));
});

it('should mine 10 blocks', async () => {
for (let i = 0; i < 10; i++) {
it('should mine through the bidding period', async () => {
for (let i = 0; i < network.names.biddingPeriod; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand All @@ -159,8 +159,8 @@ describe('Auction', function() {
assert(await chain.add(block));
});

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine through the reveal period', async () => {
for (let i = 0; i < network.names.revealPeriod; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand All @@ -184,8 +184,8 @@ describe('Auction', function() {
assert(await chain.add(block));
});

it('should mine 10 blocks', async () => {
for (let i = 0; i < 10; i++) {
it('should mine a tree interval', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down Expand Up @@ -249,8 +249,8 @@ describe('Auction', function() {
assert.strictEqual(err.reason, 'bad-renewal-premature');
});

it('should mine 10 blocks', async () => {
for (let i = 0; i < 10; i++) {
it('should mine a tree interval', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down Expand Up @@ -500,8 +500,8 @@ describe('Auction', function() {
miner.addAddress(wallet.getReceive());
});

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine a tree interval', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down Expand Up @@ -725,8 +725,8 @@ describe('Auction', function() {
});
*/

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine a tree interval', async () => {
for (let i = 0; i < network.names.treeInterval; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down Expand Up @@ -799,8 +799,8 @@ describe('Auction', function() {
assert.strictEqual(err.reason, 'bad-finalize-maturity');
});

it('should mine 20 blocks', async () => {
for (let i = 0; i < 20; i++) {
it('should mine through the transfer lockup period', async () => {
for (let i = 0; i < network.names.transferLockup; i++) {
const block = await cpu.mineBlock();
assert(block);
assert(await chain.add(block));
Expand Down