-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement/2004 add patch timestamp debug api #2077
Open
PropzSaladaz
wants to merge
10
commits into
v4.0.0
Choose a base branch
from
enhancement/2004-add-patch-timestamp-debug-api
base: v4.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+80
−1
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5d7939d
add debug api for patchTimestamps; #2004
PropzSaladaz 704e63c
refactor; add test; #2004
PropzSaladaz 6610b5d
refactor; #2004
PropzSaladaz 76fc3ae
refactor test; fix missing SchainPatch enum variant; #2004
PropzSaladaz 12408a1
refactor test; set different values for each patch; custom config fil…
PropzSaladaz 6482291
change int to size_t; fix test config file; #2004
PropzSaladaz b102255
change int to size_t; #2004
PropzSaladaz c6825d9
#2004 format
olehnikolaiev 3904978
change int to size_t; #2004
PropzSaladaz 746b719
SSL git build errors workaround; #2004
PropzSaladaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2790,6 +2790,43 @@ BOOST_AUTO_TEST_CASE( doDbCompactionDebugCall ) { | |
fixture.rpcClient->debug_doBlocksDbCompaction(); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( debugGetPatchTimestamps ) { | ||
Json::Value configJson; | ||
Json::Reader().parse(c_genesisConfigString, configJson); | ||
|
||
// indexed by enum int value | ||
std::vector< int > patchTimestamps; | ||
|
||
// Set custom config file & create timestamps for each patch | ||
size_t numPatches = static_cast< size_t >( SchainPatchEnum::PatchesCount ); | ||
for (size_t patch = 0; patch < numPatches ; patch++ ) { | ||
SchainPatchEnum patchEnum = static_cast< SchainPatchEnum >( patch ); | ||
int ts = patch + 1000; // just to offset from the default values (0, 1) | ||
patchTimestamps.push_back(ts); | ||
|
||
std::string patchName = getPatchNameForEnum(patchEnum) + "Timestamp"; | ||
patchName[0] = tolower( patchName[0] ); | ||
configJson["skaleConfig"]["sChain"][patchName] = ts; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to use |
||
|
||
Json::FastWriter fastWriter; | ||
std::string customConfigFile = fastWriter.write( configJson ); | ||
|
||
JsonRpcFixture fixture(customConfigFile, false, false, false, false); | ||
Json::Value returnedPatchTimestamps = fixture.rpcClient->debug_getPatchTimestamps(); | ||
|
||
// compare returned timestamps to actual timestamps | ||
for( size_t patchIdx = 0; patchIdx < numPatches; patchIdx++ ) { | ||
SchainPatchEnum patchEnum = static_cast< SchainPatchEnum >( patchIdx ); | ||
|
||
std::string patchName = getPatchNameForEnum(patchEnum) + "Timestamp"; | ||
patchName[0] = tolower( patchName[0] ); | ||
|
||
BOOST_REQUIRE_EQUAL(returnedPatchTimestamps[patchName], | ||
patchTimestamps[patchIdx]); | ||
} | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE( powTxnGasLimit ) { | ||
JsonRpcFixture fixture(c_genesisConfigString, false, false, true, false); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was missing in the original code. We had the
SchainPatchEnum::SelfdestructStorageLimitPatch
enum variant defined, but not the convertion from its string value to the enum variant in this function (which converts a string to the correspondingSchainPatchEnum
variant. So I added the missing conversion.