Commit Graph

20 Commits

Author SHA1 Message Date
Kris Nuttycombe e7922af588 Add a clock for testing with an offset from the system clock.
This change improves clock management for zcashd by ensuring
that all clock methods (obtaining seconds, milliseconds, and
microseconds since the epoch) agree under testing conditions
using `-mocktime`, and also adds a feature that allows tests
to specify an offset to the system clock; this is useful to
allow comprehensive testing of the "timejacking attack mitigation"
consensus rules.
2022-07-14 16:33:54 -06:00
Kris Nuttycombe 71b6a59ec3 scripted-diff: Move utiltest to src/util
-BEGIN VERIFY SCRIPT-
git mv src/utiltest.h src/util/test.h
git mv src/utiltest.cpp src/util/test.cpp
sed -i -e 's/"utiltest\.h"/"util\/test\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/ZCASH_UTILTEST_H/ZCASH_UTIL_TEST_H/g' src/util/test.h
sed -i -e 's/utiltest\.\(h\|cpp\)/util\/test\.\1/g' src/Makefile.am
-END VERIFY SCRIPT-
2022-07-06 10:25:28 -06:00
Jim Posen 9a7e2c153d scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i -e 's/"util\.h"/"util\/system\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
git checkout HEAD -- src/secp256k1 # exclude secp256k1, which has its own "util.h"
sed -i -e 's/"utilmoneystr\.h"/"util\/moneystr\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utilstrencodings\.h"/"util\/strencodings\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utiltime\.h"/"util\/time\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i -e 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i -e 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i -e 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i -e 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i -e 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i -e 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i -e 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i -e 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i -e 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
-END VERIFY SCRIPT-
2022-07-01 17:50:09 -06:00
Kris Nuttycombe 733289afa3 Revert "Merge pull request #6037 from nuttycom/feature/clock_capability"
This reverts commit 93ae72c17e, reversing
changes made to f3f1f81302.
2022-07-01 10:15:41 -06:00
Kris Nuttycombe 88401bc25e Add a clock for testing with an offset from the system clock.
This change improves clock management for zcashd by ensuring
that all clock methods (obtaining seconds, milliseconds, and
microseconds since the epoch) agree under testing conditions
using `-mocktime`, and also adds a feature that allows tests
to specify an offset to the system clock; this is useful to
allow comprehensive testing of the "timejacking attack mitigation"
consensus rules.
2022-07-01 13:51:22 +01:00
sasha 902187368e gtests ordering: make Metrics.GetLocalSolPS idempotent
we use our new AtomicTimer::zeroize() to reset the miningTimer and
solutionTargetChecks.decrement() thrice to get it back to original value
2022-03-02 11:29:09 -08:00
Kris Nuttycombe e9b5d83709 Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
Daira Hopwood d9307ddd83 Add unit tests for DisplayDuration, DisplaySize, and DisplayHashRate.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-07-17 13:59:27 +01:00
Alfredo Garcia 8aac988a82 get UPGRADE_TESTDUMMY back to default at the end of the test 2019-11-07 14:28:14 -03:00
Alfredo Garcia 8649f65608 remove redundant line from test 2019-11-04 13:38:10 -03:00
Alfredo Garcia 5bea8b76ab change var and function names for clarity, refactor function 2019-11-03 08:35:10 -03:00
Alfredo Garcia 49dca2aa0b add after blossom test 2019-11-02 20:43:46 -03:00
Alfredo Garcia 383066b28e add NextUpgrade test case 2019-11-02 18:38:39 -03:00
Eirik Ogilvie-Wigley 6c1df957ba Update metrics block height estimation for shorter block times 2019-07-31 15:16:25 -06:00
Jack Grigg 92bfde0edf
Improve network height estimation 2017-07-28 10:50:07 +00:00
Jack Grigg 4a651837be
Correct and extend EstimateNetHeightInner tests
Corrections are to the median block times, which were generated by subtracting
CBlockIndex::nMedianTimeSpan / 2 from the block height and then multiplying by
the target spacing. GetMedianTimePast() takes an array sorted by std::sort() and
returns element CBlockIndex::nMedianTimeSpan / 2, meaning that if
CBlockIndex::nMedianTimeSpan is odd (which it is), there is an out-by-one error
in the subtraction.
2017-07-28 10:45:44 +00:00
Jack Grigg 047aec1e0e
Add block download progress to metrics UI 2017-07-26 00:51:12 +00:00
Jack Grigg 601f00f6fb
Add AtomicTimer tests 2017-03-25 13:06:00 +13:00
Jack Grigg 5c0d105b6b
Update LocalSolPS test 2017-03-25 12:57:22 +13:00
Jack Grigg 000499ae64
Add getlocalsolps and getnetworksolps RPC calls, show them in getmininginfo 2016-11-16 22:02:49 +13:00