* [Bitcoin-development] script tests - invalid script in script_valid.json? @ 2012-07-29 16:31 Amir Taaki 2012-07-29 16:33 ` Stefan Thomas 0 siblings, 1 reply; 9+ messages in thread From: Amir Taaki @ 2012-07-29 16:31 UTC (permalink / raw) To: bitcoin-development Hi! Is this a valid script? ["1 0 1", "WITHIN NOT"] The first value (1) is tested to make sure it is between the lower (0) and upper (1) value. This evaluates to true, placing on the stack a single byte of [01]. NOT then inverses this to a 0 byte false value of []. What am I missing here? Thanks ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-29 16:31 [Bitcoin-development] script tests - invalid script in script_valid.json? Amir Taaki @ 2012-07-29 16:33 ` Stefan Thomas 2012-07-29 16:42 ` Amir Taaki 0 siblings, 1 reply; 9+ messages in thread From: Stefan Thomas @ 2012-07-29 16:33 UTC (permalink / raw) To: bitcoin-development OP_WITHIN is lower-bound-inclusive, but upper bound exclusive, so 1 0 1 WITHIN is false. bool fValue = (bn2 <= bn1 && bn1 < bn3); https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L854 On 7/29/2012 6:31 PM, Amir Taaki wrote: > Hi! > > Is this a valid script? > > ["1 0 1", "WITHIN NOT"] > > The first value (1) is tested to make sure it is between the lower (0) and upper (1) value. This evaluates to true, placing on the stack a single byte of [01]. NOT then inverses this to a 0 byte false value of []. > > What am I missing here? > > Thanks > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-29 16:33 ` Stefan Thomas @ 2012-07-29 16:42 ` Amir Taaki 2012-07-29 17:35 ` Stefan Thomas 0 siblings, 1 reply; 9+ messages in thread From: Amir Taaki @ 2012-07-29 16:42 UTC (permalink / raw) To: bitcoin-development oh, bitcoin... Thanks justmoon :D ----- Original Message ----- From: Stefan Thomas <moon@justmoon.de> To: bitcoin-development@lists.sourceforge.net Cc: Sent: Sunday, July 29, 2012 1:33 PM Subject: Re: [Bitcoin-development] script tests - invalid script in script_valid.json? OP_WITHIN is lower-bound-inclusive, but upper bound exclusive, so 1 0 1 WITHIN is false. bool fValue = (bn2 <= bn1 && bn1 < bn3); https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L854 On 7/29/2012 6:31 PM, Amir Taaki wrote: > Hi! > > Is this a valid script? > > ["1 0 1", "WITHIN NOT"] > > The first value (1) is tested to make sure it is between the lower (0) and upper (1) value. This evaluates to true, placing on the stack a single byte of [01]. NOT then inverses this to a 0 byte false value of []. > > What am I missing here? > > Thanks > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-29 16:42 ` Amir Taaki @ 2012-07-29 17:35 ` Stefan Thomas 2012-07-29 18:48 ` Jeff Garzik 2012-07-30 0:52 ` Gavin Andresen 0 siblings, 2 replies; 9+ messages in thread From: Stefan Thomas @ 2012-07-29 17:35 UTC (permalink / raw) To: bitcoin-development I was baffled by this exact script, too. :) Big props to Gavin for adding those data-driven test cases. I can't overstate how useful they are. Is there interest to port more tests (P2SH, checksig, checkmultisig, block verification, maybe even DoS rules) into data-driven format? It might be something that I'd like to help with if pull requests in that direction are welcome. On 7/29/2012 6:42 PM, Amir Taaki wrote: > oh, bitcoin... > > Thanks justmoon :D > > > > ----- Original Message ----- > From: Stefan Thomas <moon@justmoon.de> > To: bitcoin-development@lists.sourceforge.net > Cc: > Sent: Sunday, July 29, 2012 1:33 PM > Subject: Re: [Bitcoin-development] script tests - invalid script in script_valid.json? > > OP_WITHIN is lower-bound-inclusive, but upper bound exclusive, so 1 0 1 WITHIN is false. > > > bool fValue = (bn2 <= bn1 && bn1 < bn3); > > https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L854 > > On 7/29/2012 6:31 PM, Amir Taaki wrote: >> Hi! >> >> Is this a valid script? >> >> ["1 0 1", "WITHIN NOT"] >> >> The first value (1) is tested to make sure it is between the lower (0) and upper (1) value. This evaluates to true, placing on the stack a single byte of [01]. NOT then inverses this to a 0 byte false value of []. >> >> What am I missing here? >> >> Thanks >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Bitcoin-development mailing list >> Bitcoin-development@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development >> > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-29 17:35 ` Stefan Thomas @ 2012-07-29 18:48 ` Jeff Garzik 2012-07-30 0:52 ` Gavin Andresen 1 sibling, 0 replies; 9+ messages in thread From: Jeff Garzik @ 2012-07-29 18:48 UTC (permalink / raw) To: Stefan Thomas; +Cc: bitcoin-development On Sun, Jul 29, 2012 at 1:35 PM, Stefan Thomas <moon@justmoon.de> wrote: > Big props to Gavin for adding those data-driven test cases. I can't > overstate how useful they are. +1 they are a useful, cross-platform test tool. pynode will be making use of them shortly. -- Jeff Garzik exMULTI, Inc. jgarzik@exmulti.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-29 17:35 ` Stefan Thomas 2012-07-29 18:48 ` Jeff Garzik @ 2012-07-30 0:52 ` Gavin Andresen 2012-07-30 14:41 ` Amir Taaki ` (2 more replies) 1 sibling, 3 replies; 9+ messages in thread From: Gavin Andresen @ 2012-07-30 0:52 UTC (permalink / raw) To: Stefan Thomas; +Cc: bitcoin-development > Is there interest to port more tests (P2SH, checksig, checkmultisig, > block verification, maybe even DoS rules) into data-driven format? It > might be something that I'd like to help with if pull requests in that > direction are welcome. Yes, more tests are definitely welcome. check*sig tests are tricky, because they have to refer to previous unspent transactions and private keys (so require a particular block chain to test against). Brilliant ideas on a simple data-driven format welcome. block verification tests would be great; a collection of good/bad block chains, starting from a common chain (maybe the testnet3 tesnet-in-a-box chain) would be very useful for regression testing. -- -- Gavin Andresen ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-30 0:52 ` Gavin Andresen @ 2012-07-30 14:41 ` Amir Taaki 2012-07-31 14:26 ` Pieter Wuille 2012-07-31 14:39 ` Matt Corallo 2 siblings, 0 replies; 9+ messages in thread From: Amir Taaki @ 2012-07-30 14:41 UTC (permalink / raw) To: bitcoin-development Yep, I want to chip in and also express my gratitude for these useful tests. I sent a personal email to Gavin before. I plan to make some more complex tests by combining several of the simpler ones. ----- Original Message ----- From: Gavin Andresen <gavinandresen@gmail.com> To: Stefan Thomas <moon@justmoon.de> Cc: bitcoin-development@lists.sourceforge.net Sent: Sunday, July 29, 2012 9:52 PM Subject: Re: [Bitcoin-development] script tests - invalid script in script_valid.json? > Is there interest to port more tests (P2SH, checksig, checkmultisig, > block verification, maybe even DoS rules) into data-driven format? It > might be something that I'd like to help with if pull requests in that > direction are welcome. Yes, more tests are definitely welcome. check*sig tests are tricky, because they have to refer to previous unspent transactions and private keys (so require a particular block chain to test against). Brilliant ideas on a simple data-driven format welcome. block verification tests would be great; a collection of good/bad block chains, starting from a common chain (maybe the testnet3 tesnet-in-a-box chain) would be very useful for regression testing. -- -- Gavin Andresen ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-30 0:52 ` Gavin Andresen 2012-07-30 14:41 ` Amir Taaki @ 2012-07-31 14:26 ` Pieter Wuille 2012-07-31 14:39 ` Matt Corallo 2 siblings, 0 replies; 9+ messages in thread From: Pieter Wuille @ 2012-07-31 14:26 UTC (permalink / raw) To: Gavin Andresen; +Cc: bitcoin-development On Mon, Jul 30, 2012 at 2:52 AM, Gavin Andresen <gavinandresen@gmail.com> wrote: > check*sig tests are tricky, because they have to refer to previous > unspent transactions and private keys (so require a particular block > chain to test against). Brilliant ideas on a simple data-driven format > welcome. Ultraprune changes the block validation mechanism to only use a set of coins and the latest block pointer as state. This state is represented by an abstract class with several implementations. It would be easy to have a testset run with a memory-backed coin set as state, with the list of coins and blocks loaded from a file. -- Pieter ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bitcoin-development] script tests - invalid script in script_valid.json? 2012-07-30 0:52 ` Gavin Andresen 2012-07-30 14:41 ` Amir Taaki 2012-07-31 14:26 ` Pieter Wuille @ 2012-07-31 14:39 ` Matt Corallo 2 siblings, 0 replies; 9+ messages in thread From: Matt Corallo @ 2012-07-31 14:39 UTC (permalink / raw) To: bitcoin-development On Sun, 2012-07-29 at 20:52 -0400, Gavin Andresen wrote: > > Is there interest to port more tests (P2SH, checksig, checkmultisig, > > block verification, maybe even DoS rules) into data-driven format? It > > might be something that I'd like to help with if pull requests in that > > direction are welcome. > > Yes, more tests are definitely welcome. > > check*sig tests are tricky, because they have to refer to previous > unspent transactions and private keys (so require a particular block > chain to test against). Brilliant ideas on a simple data-driven format > welcome. > > block verification tests would be great; a collection of good/bad > block chains, starting from a common chain (maybe the testnet3 > tesnet-in-a-box chain) would be very useful for regression testing. > I wrote a simple block chain tester (that is capable of forking, checking invalid blocks, etc) as a part of the bitcoinj test suite. Its more targeted at testing bitcoinj directly and keeping the bitcoinj test suite light weight, so if it were to be more generic some tweaks could be done (not requiring tweaking the minimum difficulty/genesis block hash/etc would be first). It doesn't have that many test cases yet, but it is capable of sanity-testing reorgs/etc. Its mostly the first two commits listed at http://code.google.com/r/bluemattme-bitcoinj/source/list?name=fullverif Matt ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-07-31 14:39 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-07-29 16:31 [Bitcoin-development] script tests - invalid script in script_valid.json? Amir Taaki 2012-07-29 16:33 ` Stefan Thomas 2012-07-29 16:42 ` Amir Taaki 2012-07-29 17:35 ` Stefan Thomas 2012-07-29 18:48 ` Jeff Garzik 2012-07-30 0:52 ` Gavin Andresen 2012-07-30 14:41 ` Amir Taaki 2012-07-31 14:26 ` Pieter Wuille 2012-07-31 14:39 ` Matt Corallo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox