Skip to content

Commit

Permalink
hack: restore JSON API compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed May 20, 2022
1 parent 0b5b31b commit 8e96650
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/primitives-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,15 @@ pub struct ExtCostsConfig {
/// Cost of calling `validator_total_stake`.
pub validator_total_stake_base: Gas,

// Workaround to keep JSON serialization backwards-compatible
// <https://github.com/near/nearcore/pull/6587#discussion_r876113324>.
//
// Remove once #5516 is fixed.
#[serde(default, rename = "contract_compile_base")]
pub _unused1: Gas,
#[serde(default, rename = "contract_compile_bytes")]
pub _unused2: Gas,

// #############
// # Alt BN128 #
// #############
Expand Down Expand Up @@ -477,6 +486,8 @@ impl ExtCostsConfig {
promise_return: SAFETY_MULTIPLIER * 186717462,
validator_stake_base: SAFETY_MULTIPLIER * 303944908800,
validator_total_stake_base: SAFETY_MULTIPLIER * 303944908800,
_unused1: 0,
_unused2: 0,
#[cfg(feature = "protocol_feature_alt_bn128")]
alt_bn128_g1_multiexp_base: 713_000_000_000,
#[cfg(feature = "protocol_feature_alt_bn128")]
Expand Down Expand Up @@ -547,6 +558,8 @@ impl ExtCostsConfig {
promise_return: 0,
validator_stake_base: 0,
validator_total_stake_base: 0,
_unused1: 0,
_unused2: 0,
#[cfg(feature = "protocol_feature_alt_bn128")]
alt_bn128_g1_multiexp_base: 0,
#[cfg(feature = "protocol_feature_alt_bn128")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ fn ext_costs_config(cost_table: &CostTable) -> anyhow::Result<ExtCostsConfig> {
// TODO: accurately price host functions that expose validator information.
validator_stake_base: 303944908800,
validator_total_stake_base: 303944908800,
_unused1: 0,
_unused2: 0,
#[cfg(feature = "protocol_feature_alt_bn128")]
alt_bn128_g1_sum_base: get(Cost::AltBn128G1SumBase)?,
#[cfg(feature = "protocol_feature_alt_bn128")]
Expand Down

0 comments on commit 8e96650

Please sign in to comment.