v2.5.8-stable (#11041)
* add more tx tests (#11038) * Fix parallel transactions race-condition (#10995) * Add blake2_f precompile (#11017) * [trace] introduce trace failed to Ext (#11019) * Edit publish-onchain.sh to use https (#11016) * Fix deadlock in network-devp2p (#11013) * EIP 1108: Reduce alt_bn128 precompile gas costs (#11008) * xDai chain support and nodes list update (#10989) * EIP 2028: transaction gas lowered from 68 to 16 (#10987) * EIP-1344 Add CHAINID op-code (#10983) * manual publish jobs for releases, no changes for nightlies (#10977) * [blooms-db] Fix benchmarks (#10974) * Verify transaction against its block during import (#10954) * Better error message for rpc gas price errors (#10931) * tx-pool: accept local tx with higher gas price when pool full (#10901) * Fix fork choice (#10837) * Cleanup unused vm dependencies (#10787) * Fix compilation on recent nightlies (#10991)
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
|
||||
use uint::Uint;
|
||||
|
||||
/// Price per round of Blake2 compression.
|
||||
pub type Blake2F = u64;
|
||||
|
||||
/// Linear pricing.
|
||||
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -36,6 +39,16 @@ pub struct Modexp {
|
||||
pub divisor: usize,
|
||||
}
|
||||
|
||||
/// Pricing for constant alt_bn128 operations (ECADD and ECMUL)
|
||||
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct AltBn128ConstOperations {
|
||||
/// price
|
||||
pub price: usize,
|
||||
/// EIP 1108 transition price
|
||||
pub eip1108_transition_price: usize,
|
||||
}
|
||||
|
||||
/// Pricing for alt_bn128_pairing.
|
||||
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -44,6 +57,10 @@ pub struct AltBn128Pairing {
|
||||
pub base: usize,
|
||||
/// Price per point pair.
|
||||
pub pair: usize,
|
||||
/// EIP 1108 transition base price
|
||||
pub eip1108_transition_base: usize,
|
||||
/// EIP 1108 transition price per point pair
|
||||
pub eip1108_transition_pair: usize,
|
||||
}
|
||||
|
||||
/// Pricing variants.
|
||||
@@ -51,12 +68,16 @@ pub struct AltBn128Pairing {
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Pricing {
|
||||
/// Pricing for Blake2 compression function: each call costs the same amount per round.
|
||||
Blake2F(Blake2F),
|
||||
/// Linear pricing.
|
||||
Linear(Linear),
|
||||
/// Pricing for modular exponentiation.
|
||||
Modexp(Modexp),
|
||||
/// Pricing for alt_bn128_pairing exponentiation.
|
||||
AltBn128Pairing(AltBn128Pairing),
|
||||
/// Pricing for constant alt_bn128 operations
|
||||
AltBn128ConstOperations(AltBn128ConstOperations),
|
||||
}
|
||||
|
||||
/// Spec builtin.
|
||||
@@ -69,6 +90,8 @@ pub struct Builtin {
|
||||
pub pricing: Pricing,
|
||||
/// Activation block.
|
||||
pub activate_at: Option<Uint>,
|
||||
/// EIP 1108
|
||||
pub eip1108_transition: Option<Uint>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -89,6 +112,19 @@ mod tests {
|
||||
assert!(deserialized.activate_at.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deserialization_blake2_f_builtin() {
|
||||
let s = r#"{
|
||||
"name": "blake2_f",
|
||||
"activate_at": "0xffffff",
|
||||
"pricing": { "blake2_f": 123 }
|
||||
}"#;
|
||||
let deserialized: Builtin = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(deserialized.name, "blake2_f");
|
||||
assert_eq!(deserialized.pricing, Pricing::Blake2F(123));
|
||||
assert!(deserialized.activate_at.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn activate_at() {
|
||||
let s = r#"{
|
||||
|
||||
@@ -94,6 +94,10 @@ pub struct Params {
|
||||
/// See `CommonParams` docs.
|
||||
pub eip1014_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
pub eip1344_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
pub eip2028_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
pub dust_protection_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
pub nonce_cap_increment: Option<Uint>,
|
||||
|
||||
Reference in New Issue
Block a user