-
Notifications
You must be signed in to change notification settings - Fork 41
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
RTA Flow: Implement Auth Sample Validation on Graftnode (GNRTA-283) #290
base: feature/disqual-lookup
Are you sure you want to change the base?
Conversation
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.
- Please fix PR title - Gntra 283 means nothing for someone who doesn't have an access to internal issue tracker, this is open source project
- Any tests?
why target branch is feature/disqual-lookup ? |
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.
General notes:
it make sense to introduce a library (say librta
) and move implementation of belongs_to_auth_sample
and check_rta_signatures
there. Not sure there should be any other "check_" functions as public interface
src/cryptonote_core/tx_pool.cpp
Outdated
|
||
//--------------------------------------------------------------------------------- | ||
|
||
uint32_t get_rta_hdr_supernode_public_key_offset(const rta_header& rta_hdr) |
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.
- name is wrong - all signatures belongs to supernodes - some of these supernodes are auth sample
- at least 6 signatures required as auth sample
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.
You can see that it's not about signatures.
Signatures live in another container - "std::vector<rta_signature> rta_signs".
Here we get offset to 8 supernode pub-keys inside of rta_header.keys.
Does it make sense now?
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.
sorry, I meant keys
of course. all the keys (except POS_KEY_INDEX) belongs to supernodes (pos proxy and wallet proxy are supernodes as well)
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.
Then ok. You're rather right. Will fix it. But all this about p1. Not p.2. P.2 - is not related to the matter.
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.
Fixed
src/cryptonote_core/tx_pool.cpp
Outdated
if(!check_rta_keys_count(rta_hdr, txid)) | ||
return false; | ||
|
||
const auto sn_pkeys_off = get_rta_hdr_supernode_public_key_offset(rta_hdr); |
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.
s/sn_pkeys_off/auth_sample_keys_offset/
?
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.
Will do.
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.
Fixed
src/cryptonote_core/tx_pool.cpp
Outdated
@@ -1137,14 +1241,15 @@ namespace cryptonote | |||
return stake ? stake->amount >= config::graft::TIER1_STAKE_AMOUNT : false; | |||
}; | |||
|
|||
bool tx_memory_pool::belongs_to_auth_sample(const rta_header& rta_hdr) const | |||
bool tx_memory_pool::belongs_to_auth_sample(const rta_header& rta_hdr, const uint32_t sn_pkeys_off) 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 would change it so it accepts two sets of public keys - one set from tx and another set is auth sample. This way it doesn't need to be a tx_memory_pool
member and can be covered with unit test
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.
Will do, thanks.
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.
Fixed
@@ -0,0 +1,161 @@ | |||
// Copyright (c) 2017, The Graft Project |
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.
copyright year should be 2019
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.
Thank you! Will fix it.
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.
Fixed
#include <string> | ||
|
||
#include <cstdint> | ||
using u32 = std::uint32_t; |
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.
any reasons for introducing such type aliases?
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 only reason for most of aliases - convenience.
What's wrong in this case?
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.
can't see any "convenience" by introducing alias for standard type here
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.
len(std::uint32_t) = 13
len(u32) = 3
10 char - is WIN
EVERY time you are writing this. But what is more important - every time when you READ this.
Without any loss.
Weak point?
It was started from 'feature/disqual-lookup'. |
No any special objections. |
Agree with it. |
Reasons:
|
No description provided.