Skip to content

Commit

Permalink
Remove math extension feature from primitives core
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajbouw committed Jun 25, 2021
1 parent 43aa88b commit ac53dcb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion core/primitives-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ protocol_feature_evm = []
protocol_feature_add_account_versions = []
protocol_feature_alt_bn128 = []
protocol_feature_tx_size_limit = []
protocol_feature_math_extension = []
15 changes: 0 additions & 15 deletions core/primitives-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,11 @@ pub struct ExtCostsConfig {
/// Cost of getting sha256 per byte
pub keccak512_byte: Gas,

#[cfg(feature = "protocol_feature_math_extension")]
/// Cost of getting ripemd160 base
pub ripemd160_base: Gas,
#[cfg(feature = "protocol_feature_math_extension")]
/// Cost of getting ripemd160 per message block
pub ripemd160_block: Gas,

#[cfg(feature = "protocol_feature_math_extension")]
/// Cost of calling ecrecover
pub ecrecover_base: Gas,

Expand Down Expand Up @@ -364,11 +361,8 @@ impl Default for ExtCostsConfig {
keccak256_byte: SAFETY_MULTIPLIER * 7157035,
keccak512_base: SAFETY_MULTIPLIER * 1937129412,
keccak512_byte: SAFETY_MULTIPLIER * 12216567,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_base: SAFETY_MULTIPLIER * 15136567500, // 10 x sha256_base
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_block: SAFETY_MULTIPLIER * 80391170 * 8, // 10 x sha256_byte x 8 bytes
#[cfg(feature = "protocol_feature_math_extension")]
ecrecover_base: SAFETY_MULTIPLIER * 75682837500, // 50 x sha256_base
log_base: SAFETY_MULTIPLIER * 1181104350,
log_byte: SAFETY_MULTIPLIER * 4399597,
Expand Down Expand Up @@ -440,11 +434,8 @@ impl ExtCostsConfig {
keccak256_byte: 0,
keccak512_base: 0,
keccak512_byte: 0,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_base: 0,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_block: 0,
#[cfg(feature = "protocol_feature_math_extension")]
ecrecover_base: 0,
log_base: 0,
log_byte: 0,
Expand Down Expand Up @@ -517,11 +508,8 @@ pub enum ExtCosts {
keccak256_byte,
keccak512_base,
keccak512_byte,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_base,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_block,
#[cfg(feature = "protocol_feature_math_extension")]
ecrecover_base,
log_base,
log_byte,
Expand Down Expand Up @@ -647,11 +635,8 @@ impl ExtCosts {
keccak256_byte => config.keccak256_byte,
keccak512_base => config.keccak512_base,
keccak512_byte => config.keccak512_byte,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_base => config.ripemd160_base,
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_block => config.ripemd160_block,
#[cfg(feature = "protocol_feature_math_extension")]
ecrecover_base => config.ecrecover_base,
log_base => config.log_base,
log_byte => config.log_byte,
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protocol_feature_allow_create_account_on_delete = []
protocol_feature_fix_storage_usage = []
protocol_feature_restore_receipts_after_fix = []
protocol_feature_cap_max_gas_price = []
protocol_feature_math_extension = ["near-primitives-core/protocol_feature_math_extension"]
protocol_feature_math_extension = []
nightly_protocol_features = ["nightly_protocol", "protocol_feature_evm", "protocol_feature_block_header_v3", "protocol_feature_alt_bn128", "protocol_feature_add_account_versions", "protocol_feature_tx_size_limit", "protocol_feature_allow_create_account_on_delete", "protocol_feature_fix_storage_usage", "protocol_feature_restore_receipts_after_fix", "protocol_feature_cap_max_gas_price", "protocol_feature_math_extension"]
nightly_protocol = []

Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protocol_feature_alt_bn128 = [
]
protocol_feature_math_extension = [
"near-vm-logic/protocol_feature_math_extension",
"near-primitives/protocol_feature_math_extension"
"near-primitives/protocol_feature_math_extension",
]

[package.metadata.cargo-udeps.ignore]
Expand Down
3 changes: 0 additions & 3 deletions runtime/runtime-params-estimator/src/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,8 @@ fn get_ext_costs_config(measurement: &Measurements, config: &Config) -> ExtCosts
keccak256_byte: measured_to_gas(metric, &measured, keccak256_byte),
keccak512_base: measured_to_gas(metric, &measured, keccak512_base),
keccak512_byte: measured_to_gas(metric, &measured, keccak512_byte),
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_base: measured_to_gas(metric, &measured, ripemd160_base),
#[cfg(feature = "protocol_feature_math_extension")]
ripemd160_block: measured_to_gas(metric, &measured, ripemd160_block),
#[cfg(feature = "protocol_feature_math_extension")]
ecrecover_base: measured_to_gas(metric, &measured, ecrecover_base),
log_base: measured_to_gas(metric, &measured, log_base),
log_byte: measured_to_gas(metric, &measured, log_byte),
Expand Down

0 comments on commit ac53dcb

Please sign in to comment.