Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions light-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,7 @@ mod test {
additional_header_item_count: 0,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
}];
(client_state, cons_state)
Expand All @@ -1386,6 +1387,7 @@ mod test {
additional_header_item_count: 0,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
}];
(client_state, cons_state)
Expand All @@ -1401,6 +1403,7 @@ mod test {
additional_header_item_count: 0,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
}];
(client_state, cons_state)
Expand Down
1 change: 1 addition & 0 deletions light-client/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ mod test {
additional_header_item_count: 1, // requestsHash
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
}
}
Expand Down
8 changes: 8 additions & 0 deletions light-client/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub enum Error {
MissingVanityInExtraData(BlockNumber, usize, usize),
MissingSignatureInExtraData(BlockNumber, usize, usize),
UnexpectedMixHash(BlockNumber, Vec<u8>),
UnexpectedNotEmptyMixHash(BlockNumber, Vec<u8>),
UnexpectedMilliSecondValue(BlockNumber, u64),
UnexpectedUncleHash(BlockNumber),
UnexpectedDifficulty(BlockNumber, u64),
UnexpectedNonce(BlockNumber),
Expand Down Expand Up @@ -510,6 +512,12 @@ impl core::fmt::Display for Error {
Error::UnexpectedEpochInfo(e1, e2) => {
write!(f, "UnexpectedEpochInfo : {} {}", e1, e2)
}
Error::UnexpectedNotEmptyMixHash(e1, e2) => {
write!(f, "UnexpectedNotEmptyMixHash : {} {:?}", e1, e2)
}
Error::UnexpectedMilliSecondValue(e1, e2) => {
write!(f, "UnexpectedMilliSecondValue : {} {}", e1, e2)
}
Error::UnexpectedGasLimitDivider(e1) => {
write!(f, "UnexpectedGasLimitDivider : {}", e1)
}
Expand Down
3 changes: 3 additions & 0 deletions light-client/src/fixture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn fork_spec_after_pascal() -> ForkSpec {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 64,
enable_header_msec: false,
gas_limit_bound_divider: 256,
}
}
Expand All @@ -85,6 +86,7 @@ pub fn fork_spec_after_lorentz() -> ForkSpec {
additional_header_item_count: 1,
epoch_length: 500,
max_turn_length: 64,
enable_header_msec: true,
gas_limit_bound_divider: 1024,
}
}
Expand All @@ -95,6 +97,7 @@ pub fn fork_spec_after_maxwell() -> ForkSpec {
additional_header_item_count: 1,
epoch_length: 1000,
max_turn_length: 64,
enable_header_msec: true,
gas_limit_bound_divider: 1024,
}
}
35 changes: 35 additions & 0 deletions light-client/src/fork_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct ForkSpec {
pub epoch_length: u64,
/// Max turn length
pub max_turn_length: u64,
/// true: header has msec in mix_digest
pub enable_header_msec: bool,
/// Gas Limit bound diriver
pub gas_limit_bound_divider: u64,
}
Expand Down Expand Up @@ -203,6 +205,7 @@ impl TryFrom<RawForkSpec> for ForkSpec {
additional_header_item_count: value.additional_header_item_count,
epoch_length: value.epoch_length,
max_turn_length: value.max_turn_length,
enable_header_msec: value.enable_header_msec,
gas_limit_bound_divider: value.gas_limit_bound_divider,
})
}
Expand All @@ -220,6 +223,7 @@ impl From<ForkSpec> for RawForkSpec {
additional_header_item_count: value.additional_header_item_count,
epoch_length: value.epoch_length,
max_turn_length: value.max_turn_length,
enable_header_msec: value.enable_header_msec,
gas_limit_bound_divider: value.gas_limit_bound_divider,
}
}
Expand Down Expand Up @@ -312,13 +316,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(20),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: true,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -340,13 +346,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(20),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -368,13 +376,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(10),
additional_header_item_count: 20,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -397,13 +407,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(20),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -425,13 +437,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(20),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -453,13 +467,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(10),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -481,13 +497,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(11),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -502,13 +520,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(11),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -523,13 +543,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(10),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -548,13 +570,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(10),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -576,13 +600,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(10),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -601,13 +627,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Time(10),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -628,6 +656,7 @@ mod test {
additional_header_item_count: 1,
epoch_length: 500,
max_turn_length: 64,
enable_header_msec: true,
gas_limit_bound_divider: 256,
};
match current
Expand All @@ -648,6 +677,7 @@ mod test {
additional_header_item_count: 1,
epoch_length: 0,
max_turn_length: 64,
enable_header_msec: false,
gas_limit_bound_divider: 256,
};
match current
Expand All @@ -669,6 +699,7 @@ mod test {
additional_header_item_count: 1,
epoch_length: 0,
max_turn_length: 64,
enable_header_msec: false,
gas_limit_bound_divider: 256,
};
match fork_spec_after_pascal()
Expand Down Expand Up @@ -794,13 +825,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(20),
additional_header_item_count: 2,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand All @@ -821,13 +854,15 @@ mod test {
additional_header_item_count: 1,
epoch_length: 200,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
ForkSpec {
height_or_timestamp: HeightOrTimestamp::Height(20),
additional_header_item_count: 2,
epoch_length: 500,
max_turn_length: 9,
enable_header_msec: false,
gas_limit_bound_divider: 256,
},
];
Expand Down
Loading
Loading