So the purpose of this script is not to ensure that secret b2 length must always be 1, it is actually using the OP_SIZE opcode to check the length of the secret. That pops the length of the secret to the stack, and then pushes secret b2 length to the stack, which is compared with OP_EQUALVERIFY.
Example: The next item on the stack is a secret of length 32 bytes. OP_SIZE is called, which pushes 20 to the stack. <secret b2 length> is 20, which pushes 20 to the stack. OP_EQUALVERIFY succeeds.
So an example of items pushed to the stack would be
1. 01
2. 6443b923b04a21839c44c8f5e54c360af7b5a4541f11511584b6e413a358aa80
3. 02dbf5bf2e114c5e778c904cf8569c77cc18bb32df27bd3d3c539d898ea7150f15
4. 3045022100b302c7fb9cab9978df85ab25be7f8705367e8168c3a6c5c40014acca150c1f6d0220776a0a595b3cec56fe5452a272729cc1215b029c61a2f49a8dffc6ddb96a90a6
Where
- is OPCODE
51
- is the secret
- is the pubkey
- is the signature
within btcdeb this would look like this
btcdeb --txin=0100000001899afa569a843d13bb5b1002f1ba1e9122db5ae7a6a8d913d6cb32cad698e85b010000006b483045022100e408b398b2850c8c8130964fbd4c596aa450ecb5e4c063893b1db49847ac9fea02204d35647416be8a9d2a25484361c5d190afdcab3d79673eade297d207a274427b012102068b045421cc93a1100fa8bfbd81d5edb82c70b44f92666742e4edd46af847bbffffffff02a08601000000000017a914536f6b5a66eb7db8d729c30954da27a1ba748f3187a23fd211000000001976a9140bb2fc4ea28987e8138420c07c95c40b3433e48f88ac00000000 --tx=0100000001c23f56ede1d633789055cf3e862ea902e0dd2564d7d98fb77fe781a782d238fb00000000fd8d01483045022100b302c7fb9cab9978df85ab25be7f8705367e8168c3a6c5c40014acca150c1f6d0220776a0a595b3cec56fe5452a272729cc1215b029c61a2f49a8dffc6ddb96a90a6012102dbf5bf2e114c5e778c904cf8569c77cc18bb32df27bd3d3c539d898ea7150f15206443b923b04a21839c44c8f5e54c360af7b5a4541f11511584b6e413a358aa80514cfe6382012088a82028f71373c8b55f533f5620f838b87d3a1311ac55f571dc7f820416ea1350140d8876a914cbc6adb577679303b91eb69d44fa46ba9c367f2f88ac676382012088a82071f2c5b20684aeb4515068cecc22262fc12cc6b5875cd19377c539d48b8cec1c8882012088a820a9294a6754739dc61a0d49d4ec898f41be27cd7c6c42a0c84d7190605848b2ed880431bf785db175522102dbf5bf2e114c5e778c904cf8569c77cc18bb32df27bd3d3c539d898ea7150f152102dbf5bf2e114c5e778c904cf8569c77cc18bb32df27bd3d3c539d898ea7150f1552ae6700b17576a914cbc6adb577679303b91eb69d44fa46ba9c367f2f88ac6868000000000160840100000000001976a914cbc6adb577679303b91eb69d44fa46ba9c367f2f88ac00000000
Let me know if that makes sense @luke-jr and if this requires more documentation for the BIP