-
Notifications
You must be signed in to change notification settings - Fork 178
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
Implement a hard fork to normalize claim names #159
Conversation
8a3c999
to
5b6dfe0
Compare
2a7ba31
to
41921dd
Compare
Addresses #65
Updated. |
1f8358c
to
f32b48d
Compare
@bvbfan , excellent analysis. With our work on #44 it appears that we achieved independence from methods taking a name in rpc/claimtrie.cpp. I think that is critical to your suggestion that we don't do string normalization in the CClaimTrie (instead, we do it all in the "cache"). I really like the suggestion! I think that puts a high priority on getting #44 merged and rebasing our normalization on top of that. |
b88e679
to
24ca2a9
Compare
return removeClaim(newName, outPoint, nHeight, throwaway, false); | ||
} | ||
|
||
bool CClaimTrieCache::spendClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight) const | ||
bool CClaimTrieCache::spendClaim(std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight) const |
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.
I don't see a reason to make param in/out.
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.
The out parameter is used in mining.cpp and main.cpp (to avoid duplicate work on that name). Out parameter usage is not very obvious, though. I'm open to other suggestions.
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.
Yeah, i see now. The right approach, to me, is to call normalize before spend, we can prevent double work if we have function like isNormlized before real normalization. But i don't think double call will slow down significantly.
Apply (self) review feedback Clean deps required for boost to rebuild with icu support (for now) Normalization bug fixes and improvements Clang-formatting
where normalization is enabled and the claim no longer exists (due to normalization related narrowing)
also includes code to validate incoming utf8
also fixed a few post-merge issues
also rearranged unit test code to avoid some spurious errors
65867d5
to
d9de9e4
Compare
@@ -2819,3 +2859,49 @@ bool CClaimTrieCache::forkForExpirationChange(bool increment) const | |||
return true; | |||
} | |||
|
|||
bool CClaimTrieCache::shouldNormalize() const { |
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.
Function opening brace goes to the new line, that's tidy expectation.
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.
I haven't ran the formatter on this yet. I assume that would pick this up?
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.
Yes, it will.
return nCurrentHeight > Params().GetConsensus().nNormalizedNameForkHeight; | ||
} | ||
|
||
std::string CClaimTrieCache::normalizeClaimName(const std::string& name, bool force) const { |
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.
Opening brace on new line.
also fixed early exit in reproducible_build script
I did finally get a green on the Linux compilation again. Some notes on my issues with the reproducible_build.sh:
The advantage of Docker is that you don't have to recompile the dependencies every time. We can stop wasting time on that. I feel strongly like we need to move that direction. |
#235 supersedes this PR. |
This is a complete re-write of #102 and replaces it since it's much more complete and handles situations that the other does not handle.
This PR contains a lot of changes and I expect a detailed review will take some time to ensure correctness. I also expect the reproducible_build script will need further modification (likely won't work as-is again due to the added ICU dependency).
@kaykurokawa The "claimtriebranching_hardfork_disktest" unit test does not seem to work with this PR, if you have a second to see what's going on there, it would help. It came up after things were working and then I rebased to latest, so it's commented out for now.
EDIT: @kaykurokawa This last comment is no longer true, so can be ignored now.