BitgesellOfficial / bitgesell

Bitgesell (BGL) is a digital currency with built-in scarcity
https://www.bitgesell.ca
MIT License
25 stars 37 forks source link

Fix rpc_fundrawtransaction functional test case #110

Closed gitcoindev closed 1 year ago

gitcoindev commented 1 year ago

Description

This pull request fixes rpc_fundrawtransaction.py functional test case.

Notes

Integrated from Bitcoin core.

$ test/functional/test_runner.py test/functional/rpc_fundrawtransaction.py
Temporary test directory at /tmp/test_runner_20221213_141307
WARNING! The following scripts are not being run: ['wallet_bumpfee_totalfee_deprecation.py', 'rpc_estimatefee.py']. Check the test lists in test_runner.py.
Running Unit Tests for Test Framework Modules
..........
----------------------------------------------------------------------
Ran 10 tests in 0.528s

OK
Remaining jobs: [rpc_fundrawtransaction.py --legacy-wallet, rpc_fundrawtransaction.py --descriptors]
1/2 - rpc_fundrawtransaction.py --descriptors passed, Duration: 17 s
Remaining jobs: [rpc_fundrawtransaction.py --legacy-wallet]
2/2 - rpc_fundrawtransaction.py --legacy-wallet passed, Duration: 80 s                                                      

TEST                                      | STATUS    | DURATION

rpc_fundrawtransaction.py --descriptors   | ✓ Passed  | 17 s
rpc_fundrawtransaction.py --legacy-wallet | ✓ Passed  | 80 s

ALL                                       | ✓ Passed  | 97 s (accumulated) 
Runtime: 80 s
gitcoindev commented 1 year ago

I see the test cases passes alone but is shaky and failing when running with other tests e.g.

TEST                                      | STATUS    | DURATION

rpc_createmultisig.py                     | ✓ Passed  | 7 s
rpc_fundrawtransaction.py --legacy-wallet | ✓ Passed  | 79 s
rpc_fundrawtransaction.py --descriptors   | ✖ Failed  | 4 s

ALL                                       | ✖ Failed  | 90 s (accumulated) 
Runtime: 79 s

still need to analyse this..

gitcoindev commented 1 year ago

It gets interesting - the rpc_fundrawtransaction test is failing in random tests (even with running just test/functional/rpc_fundrawtransaction.py --descriptors) but after adding additional logs it always fails with the same wrong feeDelta value (sometimes 0.00000011 or -0.00000011). To be continued..

Case 1

2022-12-14T09:49:42.482000Z TestFramework (INFO): Test fundrawtxn p2pkh fee
2022-12-14T09:49:42.521000Z TestFramework (INFO): 0.00000142
2022-12-14T09:49:42.521000Z TestFramework (INFO): 0.00000142
2022-12-14T09:49:42.521000Z TestFramework (INFO): feeDelta 0.00000000
2022-12-14T09:49:42.521000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:49:43.523000Z TestFramework (INFO): Test fundrawtxn p2pkh fee with multiple outputs
2022-12-14T09:49:43.573000Z TestFramework (INFO): 0.00000297
2022-12-14T09:49:43.573000Z TestFramework (INFO): 0.00000297
2022-12-14T09:49:43.574000Z TestFramework (INFO): feeDelta 0.00000000
2022-12-14T09:49:43.574000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:49:44.627000Z TestFramework (INFO): 0.00000131
2022-12-14T09:49:44.627000Z TestFramework (INFO): 0.00000131
2022-12-14T09:49:44.627000Z TestFramework (INFO): feeDelta 0.00000000
2022-12-14T09:49:44.627000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:49:45.631000Z TestFramework (INFO): Test fundrawtxn fee with 4-of-5 addresses
2022-12-14T09:49:45.681000Z TestFramework (INFO): 0.00000142
2022-12-14T09:49:45.682000Z TestFramework (INFO): 0.00000131
2022-12-14T09:49:45.682000Z TestFramework (INFO): feeDelta 0.00000011
2022-12-14T09:49:45.682000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:49:45.682000Z TestFramework (ERROR): Assertion failed

Case 2

2022-12-14T09:50:16.965000Z TestFramework (INFO): Test fundrawtxn p2pkh fee with multiple outputs
2022-12-14T09:50:17.016000Z TestFramework (INFO): 0.00000297
2022-12-14T09:50:17.017000Z TestFramework (INFO): 0.00000308
2022-12-14T09:50:17.017000Z TestFramework (INFO): feeDelta -0.00000011
2022-12-14T09:50:17.017000Z TestFramework (INFO): fee_tolerance 0.00000002

Case 3

2022-12-14T09:50:34.900000Z TestFramework (INFO): Test fundrawtxn p2pkh fee with multiple outputs
2022-12-14T09:50:34.939000Z TestFramework (INFO): 0.00000297
2022-12-14T09:50:34.939000Z TestFramework (INFO): 0.00000297
2022-12-14T09:50:34.939000Z TestFramework (INFO): feeDelta 0.00000000
2022-12-14T09:50:34.939000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:50:35.982000Z TestFramework (INFO): 0.00000131
2022-12-14T09:50:35.982000Z TestFramework (INFO): 0.00000142
2022-12-14T09:50:35.982000Z TestFramework (INFO): feeDelta -0.00000011
2022-12-14T09:50:35.982000Z TestFramework (INFO): fee_tolerance 0.00000002

Case 4

2022-12-14T09:50:59.478000Z TestFramework (INFO): Test fundrawtxn p2pkh fee
2022-12-14T09:50:59.504000Z TestFramework (INFO): 0.00000153
2022-12-14T09:50:59.504000Z TestFramework (INFO): 0.00000142
2022-12-14T09:50:59.504000Z TestFramework (INFO): feeDelta 0.00000011
2022-12-14T09:50:59.504000Z TestFramework (INFO): fee_tolerance 0.00000002

Case 5

2022-12-14T09:51:23.057000Z TestFramework (INFO): Test fundrawtxn p2pkh fee with multiple outputs
2022-12-14T09:51:23.103000Z TestFramework (INFO): 0.00000297
2022-12-14T09:51:23.103000Z TestFramework (INFO): 0.00000308
2022-12-14T09:51:23.103000Z TestFramework (INFO): feeDelta -0.00000011
2022-12-14T09:51:23.103000Z TestFramework (INFO): fee_tolerance 0.00000002
2022-12-14T09:51:23.103000Z TestFramework (ERROR): Assertion failed
gitcoindev commented 1 year ago

Another observation - after disabling previous tests in rpc_fundrawtransaction 10/10 times always PASS.

gitcoindev commented 1 year ago

Fixed by reordering the fee tests to the front. The tests them-self should depend on each other but in this case they do. With the fix 10/10 PASS rate.