Add incinerator sysvar (#9815)

This commit is contained in:
Michael Vines
2020-04-30 22:04:08 -07:00
committed by GitHub
parent 450f1d2867
commit 8dfe0affd4
6 changed files with 62 additions and 9 deletions

View File

@@ -21,8 +21,12 @@ impl Parse for Id {
let id_vec = bs58::decode(id_literal.value())
.into_vec()
.map_err(|_| syn::Error::new_spanned(&id_literal, "failed to decode base58 id"))?;
let id_array = <[u8; 32]>::try_from(<&[u8]>::clone(&&id_vec[..]))
.map_err(|_| syn::Error::new_spanned(&id_literal, "id is not 32 bytes long"))?;
let id_array = <[u8; 32]>::try_from(<&[u8]>::clone(&&id_vec[..])).map_err(|_| {
syn::Error::new_spanned(
&id_literal,
format!("id is not 32 bytes long: len={}", id_vec.len()),
)
})?;
let bytes = id_array.iter().map(|b| LitByte::new(*b, Span::call_site()));
quote! {
::solana_sdk::pubkey::Pubkey::new_from_array(

4
sdk/src/incinerator.rs Normal file
View File

@@ -0,0 +1,4 @@
//! Lamports credited to this address will be removed from the total supply (burned) at the end of
//! the current block.
crate::declare_id!("1nc1nerator11111111111111111111111111111111");

View File

@@ -10,6 +10,7 @@ pub mod entrypoint_native;
pub mod epoch_schedule;
pub mod fee_calculator;
pub mod hash;
pub mod incinerator;
pub mod inflation;
pub mod instruction;
pub mod loader_instruction;