Skip to content

Test prioritisetransaction#2014

Merged
zkbot merged 2 commits intozcash:masterfrom
arcalinea:test-prioritisetransaction
Mar 2, 2017
Merged

Test prioritisetransaction#2014
zkbot merged 2 commits intozcash:masterfrom
arcalinea:test-prioritisetransaction

Conversation

@arcalinea
Copy link
Copy Markdown
Contributor

@arcalinea arcalinea commented Jan 11, 2017

After talking with @str4d about #1884 , I wrote a test for prioritisetransaction. It uses small blocks (11kb), and checks whether a transaction makes it into the next block after being prioritized by that node.

Should this be improved with a larger number of txs in the mempool, or by testing over multiple runs?

As for getblocktemplate(), it seems to return the prioritized transaction within the block size set by the node (about 50 txs fit in an 11kb block), but the block "sizelimit" it displays is set at 2 MB in rpcmining.cpp line 690:

result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));

This was quite confusing, I didn't think the -blockmaxsize parameter I was setting was working for awhile.

@arcalinea arcalinea requested a review from str4d January 11, 2017 14:05
@arcalinea arcalinea self-assigned this Jan 11, 2017
@arcalinea arcalinea added A-rpc-interface Area: RPC interface A-testing Area: Tests and testing infrastructure A-pow Area: Proof-of-Work and mining labels Jan 11, 2017
@arcalinea arcalinea added this to the 1.0.5 milestone Jan 11, 2017
Copy link
Copy Markdown
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

Looks good overall! See comments.

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should also call getblocktemplate() before the prioritisetransaction() call, and assert that priority_tx_0 is not in the block template.

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

        found = False
        for tx in block_template['transactions']:
            if tx['hash'] == priority_tx_0:
                print "\nPrioritized tx found in getblocktemplate\n"
                found = True
                break
        assert(found)

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After this, you could mine a block on node 1 and sync, after which you could then check on node 0 again to see that priority_tx_1 was now in a block.

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove.

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

# Copyright (c) 2017 The Zcash developers

@ebfull
Copy link
Copy Markdown
Contributor

ebfull commented Jan 17, 2017

@arcalinea If you update your PR before Thursday we can get it into the release. :)

@ebfull ebfull modified the milestones: 1.0.6, 1.0.5 Jan 19, 2017
@bitcartel bitcartel added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2017
@daira daira modified the milestones: 1.0.7, 1.0.6 Feb 9, 2017
@arcalinea arcalinea force-pushed the test-prioritisetransaction branch from 9152d74 to cc64e2c Compare February 12, 2017 19:03
@arcalinea
Copy link
Copy Markdown
Contributor Author

arcalinea commented Feb 12, 2017

Incorporated str4d's changes and squashed the commits

Copy link
Copy Markdown
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

Looking good, but see comments.

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated

# Check that priority_tx_0 is not in block_template() prior to prioritisation
block_template = self.nodes[0].getblocktemplate()
in_mempool = True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: in_block_template would make more sense here (and assert(!in_block_template) below).

Comment thread qa/rpc-tests/prioritisetransaction.py Outdated
break
# NOTE: getblocktemplate() should return prioritized transaction, but is not
# Noted by user in issue #1884
assert_equal(prioritized, False)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed that the test fails if this is set to True. Excellent!

# Check to see if priority_tx_1 is now mined
mempool_1 = self.nodes[1].getrawmempool()
assert_equal(priority_tx_1 in mempool_1, False)
assert_equal(priority_tx_1 in block_1['tx'], True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This, however, is not. If prioritisation is failing, then why does this prioritisation work when the earlier one doesn't? I assume because there aren't enough other transactions in the mempool at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Prioritisation works when blocks are actually mined--what's not working is "getblocktemplate()" returning prioritised transactions

@daira
Copy link
Copy Markdown
Contributor

daira commented Mar 2, 2017

utACK.

@arcalinea
Copy link
Copy Markdown
Contributor Author

Discussed with daira and str4d and clarified scope of #1884, merging this test now because it demonstrates the issue and can help us fix the behavior of getblocktemplate

@zkbot r+

@zkbot
Copy link
Copy Markdown
Contributor

zkbot commented Mar 2, 2017

📌 Commit 8d2dac6 has been approved by arcalinea

@zkbot
Copy link
Copy Markdown
Contributor

zkbot commented Mar 2, 2017

⌛ Testing commit 8d2dac6 with merge 6ee75b3...

zkbot added a commit that referenced this pull request Mar 2, 2017
Test prioritisetransaction

After talking with @str4d about #1884 , I wrote a test for prioritisetransaction. It uses small blocks (11kb), and checks whether a transaction makes it into the next block after being prioritized by that node.

Should this be improved with a larger number of txs in the mempool, or by testing over multiple runs?

As for getblocktemplate(), it seems to return the prioritized transaction within the block size set by the node (about 50 txs fit in an 11kb block), but the block "sizelimit" it displays is set at 2 MB in `rpcmining.cpp` line 690:
```
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
```

This was quite confusing, I didn't think the `-blockmaxsize` parameter I was setting was working for awhile.
@zkbot
Copy link
Copy Markdown
Contributor

zkbot commented Mar 2, 2017

☀️ Test successful - zcash

@zkbot zkbot merged commit 8d2dac6 into zcash:master Mar 2, 2017
@str4d str4d added A-block-creation Area: Block creation and submission by miners and removed A-pow Area: Proof-of-Work and mining labels Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-block-creation Area: Block creation and submission by miners A-rpc-interface Area: RPC interface A-testing Area: Tests and testing infrastructure S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants