mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-08-27 07:31:12 +00:00
Selfdestruct gas and set (#947)
* Add new segment and global metadata * Insert into self-destruct set * Implement sys_selfdestruct * PR feedback * Fix stack underflow * Forgot that NOT 1 ≠ 0. Added %not_bit macro for that.
This commit is contained in:
@@ -48,10 +48,12 @@ pub enum Segment {
|
||||
AccessedAddresses = 23,
|
||||
/// List of storage keys that have been accessed in the current transaction.
|
||||
AccessedStorageKeys = 24,
|
||||
/// List of addresses that have called SELFDESTRUCT in the current transaction.
|
||||
SelfDestructSet = 25,
|
||||
}
|
||||
|
||||
impl Segment {
|
||||
pub(crate) const COUNT: usize = 25;
|
||||
pub(crate) const COUNT: usize = 26;
|
||||
|
||||
pub(crate) fn all() -> [Self; Self::COUNT] {
|
||||
[
|
||||
@@ -80,6 +82,7 @@ impl Segment {
|
||||
Self::BnPairing,
|
||||
Self::AccessedAddresses,
|
||||
Self::AccessedStorageKeys,
|
||||
Self::SelfDestructSet,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -111,6 +114,7 @@ impl Segment {
|
||||
Segment::BnPairing => "SEGMENT_KERNEL_BN_PAIRING",
|
||||
Segment::AccessedAddresses => "SEGMENT_ACCESSED_ADDRESSES",
|
||||
Segment::AccessedStorageKeys => "SEGMENT_ACCESSED_STORAGE_KEYS",
|
||||
Segment::SelfDestructSet => "SEGMENT_SELFDESTRUCT_SET",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +146,7 @@ impl Segment {
|
||||
Segment::BnPairing => 256,
|
||||
Segment::AccessedAddresses => 256,
|
||||
Segment::AccessedStorageKeys => 256,
|
||||
Segment::SelfDestructSet => 256,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user