Bitcoin Forum
June 17, 2024, 03:00:20 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is there any test data for SigOpCount?  (Read 131 times)
Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
April 12, 2020, 09:58:41 AM
 #1

I'm trying to make sense of how sigops are supposed to be counted and although I think I've figured it out but since it makes little sense I'd like to see some test vectors. Hopefully something like SignatureScript:Foo SigOpCount:m; PubkeyScript:Bar SigOpCount:n.

PS. Is there any limit (consensus-wise not standard-wise) per transaction or is the limit only per block?

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
lucasholder
Jr. Member
*
Offline Offline

Activity: 38
Merit: 19


View Profile WWW
April 12, 2020, 11:13:28 AM
 #2

Those are the only tests I could find in bitcoin-core: https://github.com/bitcoin/bitcoin/blob/0.20/test/functional/feature_block.py#L250

Here's the sigop calculation function: https://github.com/bitcoin/bitcoin/blob/0.20/src/consensus/tx_verify.cpp#L138

Maybe you can try asking in the bitcoin core IRC channel.
Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
April 12, 2020, 11:31:24 AM
 #3

Those are the only tests I could find in bitcoin-core: https://github.com/bitcoin/bitcoin/blob/0.20/test/functional/feature_block.py#L250

That is only testing the case where number of SigOps exceeds the maximum with a very simple mock script.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
lucasholder
Jr. Member
*
Offline Offline

Activity: 38
Merit: 19


View Profile WWW
April 12, 2020, 11:41:17 AM
 #4

Indeed, unfortunately Bitcoin core's tests aren't that extensive but it has improved greatly over time (there used to be very few). I just found another test for segwit: https://github.com/bitcoin/bitcoin/blob/0.20/test/functional/p2p_segwit.py#L1918

Why are you looking for that if you don't mind?
Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
April 12, 2020, 12:39:51 PM
 #5

Why are you looking for that if you don't mind?

I'm currently refactoring the Script part of Bitcoin.Net library and writing a BlockVerifier + TransactionVerifier classes and the SigOpCount method needs testing.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3430
Merit: 6705


Just writing some code


View Profile WWW
April 12, 2020, 04:40:44 PM
Merited by Coding Enthusiast (2), ABCbits (1)
 #6

While not explicitly test vectors, there are some SigOp count tests in https://github.com/bitcoin/bitcoin/blob/master/src/test/sigopcount_tests.cpp

PS. Is there any limit (consensus-wise not standard-wise) per transaction or is the limit only per block?
There are limits per script.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!