Skip to content

Commit fe82b8a

Browse files
author
Naohiro Yoshida
committed
fix conflict
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
2 parents 9b424f1 + 518d5d6 commit fe82b8a

File tree

11 files changed

+502
-73
lines changed

11 files changed

+502
-73
lines changed

light-client/src/client.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,9 @@ mod test {
858858
mock_consensus_state.insert(Height::new(0, input.trusted_height), trusted_cs.clone());
859859

860860
// Set fork spec boundary timestamp is all[1]
861+
// This indicates that target is the HEADER immediately before the HF occurs.
862+
// By setting the height of the HF to ClientState here, the next update_client will be able to validate headers after the HF.
863+
// In order to validate the header after HF, it is necessary to set the height at which HF occurs in ClientState in advance.
861864
let mut boundary_fs = fork_spec_after_lorentz();
862865
boundary_fs.height_or_timestamp =
863866
HeightOrTimestamp::Time(header.eth_header().all[1].milli_timestamp());
@@ -1369,6 +1372,8 @@ mod test {
13691372
additional_header_item_count: 0,
13701373
epoch_length: 200,
13711374
max_turn_length: 9,
1375+
enable_header_msec: false,
1376+
gas_limit_bound_divider: 256,
13721377
}];
13731378
(client_state, cons_state)
13741379
}));
@@ -1382,6 +1387,8 @@ mod test {
13821387
additional_header_item_count: 0,
13831388
epoch_length: 200,
13841389
max_turn_length: 9,
1390+
enable_header_msec: false,
1391+
gas_limit_bound_divider: 256,
13851392
}];
13861393
(client_state, cons_state)
13871394
}));
@@ -1396,6 +1403,8 @@ mod test {
13961403
additional_header_item_count: 0,
13971404
epoch_length: 200,
13981405
max_turn_length: 9,
1406+
enable_header_msec: false,
1407+
gas_limit_bound_divider: 256,
13991408
}];
14001409
(client_state, cons_state)
14011410
}))

light-client/src/client_state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ mod test {
325325
additional_header_item_count: 1, // requestsHash
326326
epoch_length: 200,
327327
max_turn_length: 9,
328+
enable_header_msec: false,
329+
gas_limit_bound_divider: 256,
328330
}
329331
}
330332

light-client/src/consensus_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct ConsensusState {
1818
/// the storage root of the IBC contract
1919
pub state_root: Hash,
2020
/// timestamp from execution payload
21+
/// After Lorentz HF, the unit is millisecond. Before that, it was seconds.
2122
pub timestamp: Time,
2223
pub current_validators_hash: Hash,
2324
pub previous_validators_hash: Hash,

light-client/src/errors.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ pub enum Error {
7373
MissingVanityInExtraData(BlockNumber, usize, usize),
7474
MissingSignatureInExtraData(BlockNumber, usize, usize),
7575
UnexpectedMixHash(BlockNumber, Vec<u8>),
76+
UnexpectedNotEmptyMixHash(BlockNumber, Vec<u8>),
77+
UnexpectedMilliSecondValue(BlockNumber, u64),
7678
UnexpectedUncleHash(BlockNumber),
7779
UnexpectedDifficulty(BlockNumber, u64),
7880
UnexpectedNonce(BlockNumber),
@@ -82,6 +84,7 @@ pub enum Error {
8284
MissingSignerInValidator(BlockNumber, Address),
8385
UnexpectedGasDiff(BlockNumber, u64, u64),
8486
UnexpectedGasUsed(BlockNumber, u64, u64),
87+
UnexpectedGasLimitDivider(BlockNumber),
8588
UnexpectedHeaderRelation(BlockNumber, BlockNumber, Hash, Vec<u8>, u64, u64),
8689
ProofRLPError(rlp::DecoderError),
8790
InvalidProofFormatError(Vec<u8>),
@@ -142,6 +145,9 @@ pub enum Error {
142145
UnexpectedMissingForkSpecInPreviousEpochCalculation(BlockNumber, alloc::boxed::Box<Error>),
143146
UnexpectedPreviousEpochInCalculatingNextEpoch(BlockNumber, BlockNumber, BlockNumber),
144147
EmptyPreviousForkSpecs,
148+
UnexpectedEpochLength(u64, u64),
149+
MustBeEpoch(BlockNumber, ForkSpec),
150+
MustNotBeEpoch(BlockNumber, ForkSpec),
145151

146152
// Misbehaviour
147153
MissingHeader1,
@@ -510,6 +516,24 @@ impl core::fmt::Display for Error {
510516
Error::EmptyPreviousForkSpecs => {
511517
write!(f, "EmptyPreviousForkSpecs")
512518
}
519+
Error::UnexpectedNotEmptyMixHash(e1, e2) => {
520+
write!(f, "UnexpectedNotEmptyMixHash : {} {:?}", e1, e2)
521+
}
522+
Error::UnexpectedMilliSecondValue(e1, e2) => {
523+
write!(f, "UnexpectedMilliSecondValue : {} {}", e1, e2)
524+
}
525+
Error::UnexpectedGasLimitDivider(e1) => {
526+
write!(f, "UnexpectedGasLimitDivider : {}", e1)
527+
}
528+
Error::UnexpectedEpochLength(e1, e2) => {
529+
write!(f, "UnexpectedEpochLength : {} {}", e1, e2)
530+
}
531+
Error::MustBeEpoch(e1, e2) => {
532+
write!(f, "MustBeEpoch : {} {:?}", e1, e2)
533+
}
534+
Error::MustNotBeEpoch(e1, e2) => {
535+
write!(f, "MustNotBeEpoch : {} {:?}", e1, e2)
536+
}
513537
}
514538
}
515539
}

light-client/src/fixture/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ pub fn fork_spec_after_pascal() -> ForkSpec {
7575
additional_header_item_count: 1,
7676
epoch_length: 200,
7777
max_turn_length: 64,
78+
enable_header_msec: false,
79+
gas_limit_bound_divider: 256,
7880
}
7981
}
8082

@@ -84,6 +86,8 @@ pub fn fork_spec_after_lorentz() -> ForkSpec {
8486
additional_header_item_count: 1,
8587
epoch_length: 500,
8688
max_turn_length: 64,
89+
enable_header_msec: true,
90+
gas_limit_bound_divider: 1024,
8791
}
8892
}
8993

@@ -93,6 +97,8 @@ pub fn fork_spec_after_maxwell() -> ForkSpec {
9397
additional_header_item_count: 1,
9498
epoch_length: 1000,
9599
max_turn_length: 64,
100+
enable_header_msec: true,
101+
gas_limit_bound_divider: 1024,
96102
}
97103
}
98104

@@ -102,6 +108,8 @@ pub fn fork_spec_after_post_maxwell_1() -> ForkSpec {
102108
additional_header_item_count: 1,
103109
epoch_length: 1000,
104110
max_turn_length: 64,
111+
enable_header_msec: true,
112+
gas_limit_bound_divider: 1024,
105113
}
106114
}
107115

@@ -111,5 +119,7 @@ pub fn fork_spec_after_post_maxwell_2() -> ForkSpec {
111119
additional_header_item_count: 1,
112120
epoch_length: 2000,
113121
max_turn_length: 64,
122+
enable_header_msec: true,
123+
gas_limit_bound_divider: 1024,
114124
}
115125
}

0 commit comments

Comments
 (0)