pub enum ProtocolFeature {
Show 46 variants
ImplicitAccountCreation,
RectifyInflation,
AccessKeyNonceRange,
FixApplyChunks,
LowerStorageCost,
DeleteActionRestriction,
AccountVersions,
TransactionSizeLimit,
FixStorageUsage,
CapMaxGasPrice,
CountRefundReceiptsInGasLimit,
MathExtension,
RestoreReceiptsAfterFixApplyChunks,
Wasmer2,
SimpleNightshade,
LowerDataReceiptAndEcrecoverBaseCost,
LowerRegularOpCost,
LowerRegularOpCost2,
LimitContractFunctionsNumber,
BlockHeaderV3,
AliasValidatorSelectionAlgorithm,
SynchronizeBlockChunkProduction,
CorrectStackLimit,
AccessKeyNonceForImplicitAccounts,
IncreaseDeploymentCost,
FunctionCallWeight,
LimitContractLocals,
ChunkNodesCache,
LowerStorageKeyLimit,
AltBn128,
ChunkOnlyProducers,
MaxKickoutStake,
AccountIdInFunctionCallPermission,
ZeroBalanceAccount,
DelegateAction,
Ed25519Verify,
ComputeCosts,
FlatStorageReads,
PreparationV2,
NearVmRuntime,
BlockHeaderV4,
SimpleNightshadeV2,
RestrictTla,
TestnetFewerBlockProducers,
ChunkValidation,
EthImplicitAccounts,
}
Expand description
New Protocol features should go here. Features are guarded by their corresponding feature flag.
For example, if we have ProtocolFeature::EVM
and a corresponding feature flag evm
, it will look
like
#[cfg(feature = “protocol_feature_evm”)] EVM code
Variants§
ImplicitAccountCreation
RectifyInflation
AccessKeyNonceRange
Add AccessKey
nonce range by setting nonce to (block_height - 1) * 1e6
, see
https://github.com/utnet-org/utility/issues/3779.
FixApplyChunks
Don’t process any receipts for shard when chunk is not present. Always use gas price computed in the previous block.
LowerStorageCost
DeleteActionRestriction
AccountVersions
Add versions to Account
data structure
TransactionSizeLimit
FixStorageUsage
Fix a bug in storage_usage
for account caused by #3824
CapMaxGasPrice
Cap maximum gas price to 2,000,000,000 yoctoNEAR
CountRefundReceiptsInGasLimit
MathExtension
Add ripemd60
and ecrecover
host function
RestoreReceiptsAfterFixApplyChunks
Restore receipts that were previously stuck because of https://github.com/utnet-org/utility/pull/4228.
Wasmer2
This feature switch our WASM engine implementation from wasmer 0.* to wasmer 2.*, bringing better performance and reliability.
The implementations should be sufficiently similar for this to not be a protocol upgrade, but we conservatively do a protocol upgrade to be on the safe side.
Although wasmer2 is faster, we don’t change fees with this protocol version – we can safely do that in a separate step.
SimpleNightshade
LowerDataReceiptAndEcrecoverBaseCost
LowerRegularOpCost
Lowers the cost of wasm instruction due to switch to wasmer2.
LowerRegularOpCost2
Lowers the cost of wasm instruction due to switch to faster, compiler-intrinsics based gas counter.
LimitContractFunctionsNumber
Limit number of wasm functions in one contract. See https://github.com/utnet-org/utility/pull/4954 for more details.
BlockHeaderV3
AliasValidatorSelectionAlgorithm
Changes how we select validators for epoch and how we select validators within epoch. See https://github.com/near/NEPs/pull/167 for general description, note that we would not introduce chunk-only validators with this feature
SynchronizeBlockChunkProduction
Make block producers produce chunks for the same block they would later produce to avoid network delays
CorrectStackLimit
Change the algorithm to count WASM stack usage to avoid undercounting in some cases.
AccessKeyNonceForImplicitAccounts
Add AccessKey
nonce range for implicit accounts, as in AccessKeyNonceRange
feature.
IncreaseDeploymentCost
Increase cost per deployed code byte to cover for the compilation steps that a deployment triggers. Only affects the action execution cost.
FunctionCallWeight
LimitContractLocals
This feature enforces a global limit on the function local declarations in a WebAssembly contract. See <…> for more information.
ChunkNodesCache
Ensure caching all nodes in the chunk for which touching trie node cost was charged. Charge for each such node only once per chunk at the first access time.
LowerStorageKeyLimit
Lower max_length_storage_key
limit, which itself limits trie node sizes.
AltBn128
ChunkOnlyProducers
MaxKickoutStake
Ensure the total stake of validators that are kicked out does not exceed a percentage of total stakes
AccountIdInFunctionCallPermission
Validate account id for function call access keys.
ZeroBalanceAccount
Zero Balance Account NEP 448: https://github.com/near/NEPs/pull/448
DelegateAction
Execute a set of actions on behalf of another account.
Meta Transaction NEP-366: https://github.com/near/NEPs/blob/master/neps/nep-0366.md
Ed25519Verify
ComputeCosts
Decouple compute and gas costs of operations to safely limit the compute time it takes to process the chunk.
Compute Costs NEP-455: https://github.com/near/NEPs/blob/master/neps/nep-0455.md
FlatStorageReads
Enable flat storage for reads, reducing number of DB accesses from 2 * key.len()
in
the worst case to 2.
Flat Storage NEP-399: https://github.com/near/NEPs/blob/master/neps/nep-0399.md
PreparationV2
Enables preparation V2. Note that this setting is not supported in production settings without NearVmRuntime enabled alongside it, as the VM runner would be too slow.
NearVmRuntime
Enables unc-Vm. Note that this setting is not at all supported without PreparationV2, as it hardcodes preparation v2 code into the generated assembly.
BlockHeaderV4
SimpleNightshadeV2
Resharding V2. A new implementation for resharding and a new shard layout for the production networks.
RestrictTla
TestnetFewerBlockProducers
Increases the number of chunk producers.
ChunkValidation
Enables chunk validation which is introduced with stateless validation. NEP: https://github.com/near/NEPs/pull/509
EthImplicitAccounts
Implementations§
source§impl ProtocolFeature
impl ProtocolFeature
pub const fn protocol_version(self) -> ProtocolVersion
Trait Implementations§
source§impl Clone for ProtocolFeature
impl Clone for ProtocolFeature
source§fn clone(&self) -> ProtocolFeature
fn clone(&self) -> ProtocolFeature
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ProtocolFeature
impl Debug for ProtocolFeature
source§impl Hash for ProtocolFeature
impl Hash for ProtocolFeature
source§impl PartialEq for ProtocolFeature
impl PartialEq for ProtocolFeature
source§fn eq(&self, other: &ProtocolFeature) -> bool
fn eq(&self, other: &ProtocolFeature) -> bool
self
and other
values to be equal, and is used
by ==
.