pub struct CardanoTransactionsSigningConfig {
pub security_parameter: BlockNumber,
pub step: BlockNumber,
}
Expand description
Configuration for the signing of Cardano transactions
Allow to compute the block number to be signed based on the chain tip block number.
Fields§
§security_parameter: BlockNumber
Number of blocks to discard from the tip of the chain when importing transactions.
step: BlockNumber
The number of blocks between signature of the transactions.
Note: The step is adjusted to be a multiple of the block range length in order to guarantee that the block number signed in a certificate is effectively signed.
Implementations§
source§impl CardanoTransactionsSigningConfig
impl CardanoTransactionsSigningConfig
sourcepub fn new(security_parameter: BlockNumber, step: BlockNumber) -> Self
pub fn new(security_parameter: BlockNumber, step: BlockNumber) -> Self
Create a new CardanoTransactionsSigningConfig
sourcepub fn compute_block_number_to_be_signed(
&self,
block_number: BlockNumber,
) -> BlockNumber
pub fn compute_block_number_to_be_signed( &self, block_number: BlockNumber, ) -> BlockNumber
Compute the block number to be signed based on the chain tip block number.
The latest block number to be signed is the highest multiple of the step less or equal than the block number minus the security parameter.
The formula is as follows:
block_number = ⌊(tip.block_number - security_parameter) / step⌋ × step - 1
where ⌊x⌋
is the floor function which rounds to the greatest integer less than or equal to x
.
Notes:
- The step is adjusted to be a multiple of the block range length in order to guarantee that the block number signed in a certificate is effectively signed.
- 1 is subtracted to the result because block range end is exclusive (ie: a BlockRange over
30..45
finish at 44 included, 45 is included in the next block range).
Trait Implementations§
source§impl Clone for CardanoTransactionsSigningConfig
impl Clone for CardanoTransactionsSigningConfig
source§fn clone(&self) -> CardanoTransactionsSigningConfig
fn clone(&self) -> CardanoTransactionsSigningConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'de> Deserialize<'de> for CardanoTransactionsSigningConfig
impl<'de> Deserialize<'de> for CardanoTransactionsSigningConfig
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for CardanoTransactionsSigningConfig
impl PartialEq for CardanoTransactionsSigningConfig
source§fn eq(&self, other: &CardanoTransactionsSigningConfig) -> bool
fn eq(&self, other: &CardanoTransactionsSigningConfig) -> bool
self
and other
values to be equal, and is used by ==
.impl Eq for CardanoTransactionsSigningConfig
impl StructuralPartialEq for CardanoTransactionsSigningConfig
Auto Trait Implementations§
impl Freeze for CardanoTransactionsSigningConfig
impl RefUnwindSafe for CardanoTransactionsSigningConfig
impl Send for CardanoTransactionsSigningConfig
impl Sync for CardanoTransactionsSigningConfig
impl Unpin for CardanoTransactionsSigningConfig
impl UnwindSafe for CardanoTransactionsSigningConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more