Skip to content

Commit

Permalink
add back author_auth_key for legacy block header
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao committed Dec 5, 2024
1 parent 3032c1b commit 325be5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/nextest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ cargo nextest run \
-p starcoin-chain \
-p starcoin-network \
-p starcoin-storage \
-p starcoin-types \
-p starcoin-sync \
--retries 2 --build-jobs 8 --test-threads 12 --no-fail-fast --failure-output immediate-final


Expand Down
9 changes: 9 additions & 0 deletions types/src/block/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use starcoin_crypto::{
hash::{CryptoHash, CryptoHasher, PlainCryptoHash},
HashValue,
};
use starcoin_vm_types::transaction::authenticator::AuthenticationKey;

#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, CryptoHasher, CryptoHash, JsonSchema)]
#[serde(rename = "BlockHeader")]
Expand All @@ -19,6 +20,9 @@ pub struct BlockHeader {
number: BlockNumber,
/// Block author.
author: AccountAddress,
/// Block author auth key.
/// this field is deprecated
author_auth_key: Option<AuthenticationKey>,
/// The transaction accumulator root hash after executing this block.
txn_accumulator_root: HashValue,
/// The parent block info's block accumulator root hash.
Expand Down Expand Up @@ -47,6 +51,7 @@ impl BlockHeader {
timestamp: u64,
number: BlockNumber,
author: AccountAddress,
author_auth_key: Option<AuthenticationKey>,
txn_accumulator_root: HashValue,
block_accumulator_root: HashValue,
state_root: HashValue,
Expand All @@ -64,6 +69,7 @@ impl BlockHeader {
number,
timestamp,
author,
author_auth_key,
txn_accumulator_root,
state_root,
gas_used,
Expand Down Expand Up @@ -94,6 +100,7 @@ impl From<crate::block::BlockHeader> for BlockHeader {
timestamp: v.timestamp,
number: v.number,
author: v.author,
author_auth_key: None,
txn_accumulator_root: v.txn_accumulator_root,
block_accumulator_root: v.block_accumulator_root,
state_root: v.state_root,
Expand Down Expand Up @@ -141,6 +148,7 @@ impl<'de> Deserialize<'de> for BlockHeader {
timestamp: u64,
number: BlockNumber,
author: AccountAddress,
author_auth_key: Option<AuthenticationKey>,
txn_accumulator_root: HashValue,
block_accumulator_root: HashValue,
state_root: HashValue,
Expand All @@ -158,6 +166,7 @@ impl<'de> Deserialize<'de> for BlockHeader {
header_data.timestamp,
header_data.number,
header_data.author,
header_data.author_auth_key,
header_data.txn_accumulator_root,
header_data.block_accumulator_root,
header_data.state_root,
Expand Down
1 change: 1 addition & 0 deletions types/src/block/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn this_header() -> BlockHeader {
timestamp,
number,
author,
None,
txn_accumulator_root,
block_accumulator_root,
state_root,
Expand Down

0 comments on commit 325be5a

Please sign in to comment.