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 bffcbeb
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 22 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
1 change: 0 additions & 1 deletion nearcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ nightly_protocol = ["near-primitives/nightly_protocol", "near-jsonrpc/nightly_pr
protocol_feature_restore_receipts_after_fix = ["near-primitives/protocol_feature_restore_receipts_after_fix", "near-chain/protocol_feature_restore_receipts_after_fix", "node-runtime/protocol_feature_restore_receipts_after_fix"]
protocol_feature_cap_max_gas_price = ["near-primitives/protocol_feature_cap_max_gas_price", "near-chain/protocol_feature_cap_max_gas_price"]
protocol_feature_math_extension = [
"near-primitives/protocol_feature_math_extension",
"node-runtime/protocol_feature_math_extension"
]

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

# Use this feature to enable counting of fees and costs applied.
costs_counting = []
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ protocol_feature_alt_bn128 = [
]
protocol_feature_math_extension = [
"near-vm-logic/protocol_feature_math_extension",
"near-primitives/protocol_feature_math_extension"
]

[package.metadata.cargo-udeps.ignore]
Expand Down
1 change: 0 additions & 1 deletion runtime/runtime-params-estimator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ protocol_feature_evm = [
]
sandbox = ["node-runtime/sandbox", "state-viewer/sandbox"]
protocol_feature_math_extension = [
"near-primitives/protocol_feature_math_extension",
"near-vm-logic/protocol_feature_math_extension",
"near-vm-runner/protocol_feature_math_extension",
"nearcore/protocol_feature_math_extension",
Expand Down
1 change: 0 additions & 1 deletion runtime/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protocol_feature_allow_create_account_on_delete = ["near-primitives/protocol_fea
protocol_feature_fix_storage_usage = ["near-primitives/protocol_feature_fix_storage_usage"]
protocol_feature_restore_receipts_after_fix = []
protocol_feature_math_extension = [
"near-primitives/protocol_feature_math_extension",
"near-vm-logic/protocol_feature_math_extension",
"near-vm-runner/protocol_feature_math_extension",
"near-vm-errors/protocol_feature_math_extension"
Expand Down

0 comments on commit bffcbeb

Please sign in to comment.