Rename delegate_signature->witness_signature #147
- changed secret hash of block headers from 224 to 160 to save 16 bytes per header which will add up to 1 MB per day in savings.
This commit is contained in:
parent
a799f064d4
commit
49937daeb8
8 changed files with 11 additions and 10 deletions
|
|
@ -90,7 +90,7 @@ vector<witness_id_type> database::get_near_witness_schedule()const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void database::update_witness_schedule(signed_block next_block)
|
void database::update_witness_schedule(const signed_block& next_block)
|
||||||
{
|
{
|
||||||
const global_property_object& gpo = get_global_properties();
|
const global_property_object& gpo = get_global_properties();
|
||||||
const witness_schedule_object& wso = get(witness_schedule_id_type());
|
const witness_schedule_object& wso = get(witness_schedule_id_type());
|
||||||
|
|
@ -109,6 +109,7 @@ void database::update_witness_schedule(signed_block next_block)
|
||||||
witness_id_type wit;
|
witness_id_type wit;
|
||||||
|
|
||||||
const dynamic_global_property_object& dpo = get_dynamic_global_properties();
|
const dynamic_global_property_object& dpo = get_dynamic_global_properties();
|
||||||
|
|
||||||
assert( dpo.random.data_size() == witness_scheduler_rng::seed_length );
|
assert( dpo.random.data_size() == witness_scheduler_rng::seed_length );
|
||||||
assert( witness_scheduler_rng::seed_length == wso.rng_seed.size() );
|
assert( witness_scheduler_rng::seed_length == wso.rng_seed.size() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
// counter used to determine bits of entropy
|
// counter used to determine bits of entropy
|
||||||
// must be less than or equal to secret_hash_type::data_length()
|
// must be less than or equal to secret_hash_type::data_length()
|
||||||
#define GRAPHENE_RNG_SEED_LENGTH (224 / 8)
|
#define GRAPHENE_RNG_SEED_LENGTH (160 / 8)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* every second, the fraction of burned core asset which cycles is
|
* every second, the fraction of burned core asset which cycles is
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ namespace graphene { namespace chain {
|
||||||
void update_withdraw_permissions();
|
void update_withdraw_permissions();
|
||||||
|
|
||||||
//////////////////// db_witness_schedule.cpp ////////////////////
|
//////////////////// db_witness_schedule.cpp ////////////////////
|
||||||
void update_witness_schedule(signed_block next_block); /// no-op except for scheduling blocks
|
void update_witness_schedule(const signed_block& next_block); /// no-op except for scheduling blocks
|
||||||
|
|
||||||
///Steps performed only at maintenance intervals
|
///Steps performed only at maintenance intervals
|
||||||
///@{
|
///@{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace graphene { namespace chain {
|
||||||
void sign( const fc::ecc::private_key& signer );
|
void sign( const fc::ecc::private_key& signer );
|
||||||
bool validate_signee( const fc::ecc::public_key& expected_signee )const;
|
bool validate_signee( const fc::ecc::public_key& expected_signee )const;
|
||||||
|
|
||||||
signature_type delegate_signature;
|
signature_type witness_signature;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct signed_block : public signed_block_header
|
struct signed_block : public signed_block_header
|
||||||
|
|
@ -55,5 +55,5 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::block_header, (previous)(timestamp)(witness)
|
FC_REFLECT( graphene::chain::block_header, (previous)(timestamp)(witness)
|
||||||
(next_secret_hash)(previous_secret)(transaction_merkle_root)(extensions) )
|
(next_secret_hash)(previous_secret)(transaction_merkle_root)(extensions) )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::signed_block_header, (graphene::chain::block_header), (delegate_signature) )
|
FC_REFLECT_DERIVED( graphene::chain::signed_block_header, (graphene::chain::block_header), (witness_signature) )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::signed_block, (graphene::chain::signed_block_header), (transactions) )
|
FC_REFLECT_DERIVED( graphene::chain::signed_block, (graphene::chain::signed_block_header), (transactions) )
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ namespace graphene { namespace chain {
|
||||||
typedef fc::sha256 digest_type;
|
typedef fc::sha256 digest_type;
|
||||||
typedef fc::ecc::compact_signature signature_type;
|
typedef fc::ecc::compact_signature signature_type;
|
||||||
typedef safe<int64_t> share_type;
|
typedef safe<int64_t> share_type;
|
||||||
typedef fc::sha224 secret_hash_type;
|
typedef fc::ripemd160 secret_hash_type;
|
||||||
typedef uint16_t weight_type;
|
typedef uint16_t weight_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class witness_schedule_object : public abstract_object<witness_schedule_object>
|
||||||
witness_scheduler scheduler;
|
witness_scheduler scheduler;
|
||||||
uint32_t last_scheduling_block;
|
uint32_t last_scheduling_block;
|
||||||
uint64_t slots_since_genesis = 0;
|
uint64_t slots_since_genesis = 0;
|
||||||
fc::array< char, GRAPHENE_RNG_SEED_LENGTH > rng_seed;
|
fc::array< char, sizeof(secret_hash_type) > rng_seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
} }
|
} }
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class nullary_rng
|
||||||
* The sha256_ctr_rng generates bits using SHA256 in counter (CTR)
|
* The sha256_ctr_rng generates bits using SHA256 in counter (CTR)
|
||||||
* mode.
|
* mode.
|
||||||
*/
|
*/
|
||||||
template< class HashClass, int SeedLength=32 >
|
template< class HashClass, int SeedLength=sizeof(secret_hash_type) >
|
||||||
class hash_ctr_rng
|
class hash_ctr_rng
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
fc::ecc::public_key signed_block_header::signee()const
|
fc::ecc::public_key signed_block_header::signee()const
|
||||||
{
|
{
|
||||||
return fc::ecc::public_key( delegate_signature, digest(), true/*enforce canonical*/ );
|
return fc::ecc::public_key( witness_signature, digest(), true/*enforce canonical*/ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void signed_block_header::sign( const fc::ecc::private_key& signer )
|
void signed_block_header::sign( const fc::ecc::private_key& signer )
|
||||||
{
|
{
|
||||||
delegate_signature = signer.sign_compact( digest() );
|
witness_signature = signer.sign_compact( digest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool signed_block_header::validate_signee( const fc::ecc::public_key& expected_signee )const
|
bool signed_block_header::validate_signee( const fc::ecc::public_key& expected_signee )const
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue