github near/nearcore 2.15.0-rc.1

latest release: crates-0.39.0-rc.1
pre-releaseone hour ago
CODE_COLOR: CODE_YELLOW_TESTNET
RELEASE_VERSION: 2.15.0-rc.1
PROTOCOL_UPGRADE: TRUE
DATABASE_UPGRADE: TRUE
SECURITY_UPGRADE: FALSE

External contract calls

2.15 adds external contract calls (NEP-667). An external call is a new kind of transaction that carries a contract's name and a payload. The contract decides in its __external_call method whether to accept the call. It then pays for the call from its own balance. Checking a signature, a nonce and an expiry, which the protocol does for a signed transaction, becomes the contract's responsibility. A wallet can therefore be a contract that checks a passkey or any other signature scheme that access keys do not support. Its owner needs no access key and no relayer to use it.

The call is accepted if __external_call finishes without an error within 20 Tgas and the contract's balance covers the cost. Otherwise the call is rolled back and nobody pays. A call can also carry a state init, so a new wallet needs only a plain transfer to its universal account, and its first call installs the code. A chunk takes at most one external call per contract. A view call of __external_call simulates a call and returns its result or error. Clients send a call through send_tx.

Protocol Changes

  • External contract calls (NEP-667): a new kind of transaction with no signer, key or nonce, which the called contract authorizes in its reserved method __external_call and pays for from its own balance. A refused call is rolled back and nobody pays, and its outcome keeps the error and the run's logs.
    • A call may carry a universal account's state init, installed before the run when the account is not initialized yet and ignored otherwise.
    • Limits: 20 Tgas, 20 KiB of size and 50 KiB of recorded state per call; per chunk, at most 100 calls, one per contract, and shares of the chunk's compute, storage proof and transaction bytes. New errors: ContractNotFound, ExternalCallChunkShareReached, ProhibitedInExternalCall, DepositInExternalCall, RecordedStorageExceeded and ReservedMethodName.
    • In the run, predecessor_account_id, prepaid_gas, random_seed, signer_account_pk, promise_yield_create and promise_yield_create_with_id fail. In the receipts an accepted call starts, signer_account_pk fails and gas refunds go to the contract.
    • Clients send a call through send_tx in the field external_call_base64 and look it up through tx by the copy's unique id. Transaction views carry kind, "signed" or "external_call"; action receipt views carry authorization_context, beside signer_public_key for a receipt a signed transaction started; an accepted call's state changes carry the cause ExternalCallProcessing. The indexer streams external calls with their outcomes. A view call of __external_call runs the call as the chunk producer would and returns its value and logs, or why the contract refuses it.
  • A new access key starts at nonce h * 1e6 - 1, where h is the height of the block that creates it, instead of (h - 1) * 1e6. This applies to keys added with AddKey, gas key nonces, NEAR implicit account keys and the universal account bootstrap nonce. A transaction or delegate action executed at or before the creation height is not valid for the new key, so a transaction that deletes and re-adds its own key cannot execute again with the same hash. Clients that read the key nonce and add 1 are not affected; clients that compute the nonce from the creation height must use the new value.
  • A FunctionCall to an account whose contract is a global contract that was never deployed on the chain now fails with CodeDoesNotExist, the same error as calling an account with no contract, on chunk producers and chunk validators alike. Only ETH implicit (0x) accounts can reach this state: they are created with a hardcoded wallet contract hash and no existence check, so on a chain whose wallet contract has not been deployed the first such call stalled the shard (the producer's apply job panicked in builds with debug assertions, and chunk validators rejected the state witness with MissingTrieValue). When the code is missing the runtime now looks up the global contract key, so the proof of absence is part of the state witness and validators reach the same outcome. Behavior is unchanged whenever the contract exists.
  • Limit the number of allowed globals per WASM contract to 65,536. #16422
  • Fixed a bandwidth request over-reservation for shards that were not split in the most recent resharding. Such shards requested roughly double the bandwidth they needed, and the scheduler reserved sender bandwidth for receipts that did not exist. (#16432)
  • Stabilized early contract-loading gas charging. A FunctionCall now charges contract_loading_base before resolving and loading contract code, then charges contract_loading_bytes before compilation. Calls that cannot afford loading abort before the work is performed, and calls to a missing contract burn the base cost. No gas cost changes for successful calls. #16632
  • Raised per_receipt_storage_proof_size_limit from 4,000,000 to 4,500,000 bytes. Reading, writing or removing a key records the whole value in the storage proof. With a 4 MB limit, a receipt can't touch a value of max_length_storage_value (4 MiB) and its trie path within the budget. 4.5 MB leaves room for both. The worst-case state witness grows by 0.5 MB. (#16704)
  • Action receipts now record the protocol version they were created at, and the runtime charges and refunds their static fees (the receipt fee, the execution fees of their actions and the send fees a meta transaction forwards) with the fees of that version, also when they execute after a fee change. Previously the refund was computed with the current fees, so a receipt created before a fee increase and executed after it could be refunded gas it never purchased. Receipts created before this upgrade don't record a version and are priced with the current fees, as before. New action receipts use the new ReceiptEnum::ActionV3 and ReceiptEnum::PromiseYieldV3 variants, which carry creation_protocol_version; tools that decode receipts from Borsh should expect them. The RPC view of such a receipt has two new optional fields, authorization_context and creation_protocol_version; the view of an older receipt is unchanged. (#16758, #16847)
  • Host functions bls12381_p1_sum, bls12381_p2_sum, bls12381_g1_multiexp, bls12381_g2_multiexp, bls12381_map_fp_to_g1, bls12381_map_fp2_to_g2, bls12381_p1_decompress, bls12381_p2_decompress, promise_yield_resume and promise_yield_resume_with_yield_id now accept input from a register (len == u64::MAX). Before, they charged gas for u64::MAX input bytes before they read the register and failed with IntegerOverflow. They now charge from the length of the input they read, as all other host functions do. Gas costs for memory input do not change, except that a call that fails while it reads its inputs (for example, an out-of-bounds memory input) no longer pays the per-element or per-byte cost.
  • Host functions bls12381_p1_sum, bls12381_p2_sum, bls12381_p1_decompress and bls12381_p2_decompress now accept the points (0, ±2), which are on the curve but outside the subgroup. Before, they returned an error for these points, which NEP-488 requires them to accept. (#14550)
  • Capped the number of gas key nonces one receipt may add or remove at 1_024, which is MAX_NONCES_FOR_GAS_KEY, the most one gas key can have. Nonces added by AddKey actions are counted across the receipt and into nested delegate actions, and a new receipt over the limit is rejected at action validation with the new ActionsValidationError::TotalNumberOfGasKeyNoncesAddedExceeded error. Nonces removed by DeleteKey and DeleteAccount actions are counted when the receipt runs, and a receipt that removes more fails with the new ActionErrorKind::TotalNumberOfGasKeyNoncesRemovedExceeded error, with all of its changes reverted. Deleting several gas keys that have many nonces now takes one receipt per key. Clients that decode ActionsValidationError or ActionErrorKind should expect the new variants.
  • A DeleteKey of a gas key now reads each of the key's nonces before removing it, so the per-receipt and per-chunk storage proof limits count the trie nodes of the removed nonces. Before, those nodes were recorded only when the chunk's state changes were finalized, after the limits were checked. A receipt that deletes a gas key can now fail with ActionErrorKind::ReceiptStorageProofSizeExceeded, and a chunk can stop taking receipts sooner.
  • An action receipt that arrives before its input data now reads each PostponedReceiptId, PendingDataCount and PostponedReceipt key before it writes it, a yielded receipt reads its PromiseYieldReceipt key before it is stored, and arriving data reads its ReceivedData key before it is stored, so the per-chunk storage proof limit counts the trie nodes of these inserts. Before, those nodes were recorded only when the chunk's state changes were finalized, after the limits were checked. A chunk can now stop taking receipts sooner.
  • Each receipt now counts at least min_receipt_congestion_size (1_000 bytes) for bandwidth and congestion, so a shard receives at most about 4_500 receipts per height.
  • A chunk now skips a transaction whose signer, or for an external contract call whose contract, is in another shard. The skipped transaction gets no execution outcome. Before, it failed with InvalidSignerId or SignerDoesNotExist.
  • Blocks whose body carries a non-empty deprecated challenges field are now invalid. Honest block producers always leave it empty. Before, the field was decoded and hashed but never checked, so a block producer could fill it with content that releases decode differently, and nodes on different releases would disagree on the block's validity. (#16808)
  • Contract storage operations charge every trie node and value they visit as touching_trie_node, in one charge. Before, nodes the chunk had already visited were charged separately as read_cached_trie_node, at the same cost. The total charge does not change, but a call that created a promise and runs out of gas in this charge now burns up to the gas of those cached nodes more, and its error can change from GasExceeded to GasLimitExceeded. Gas profiles show this gas only under TOUCHING_TRIE_NODE. (#16859)
  • A receipt with a single DeleteAccount action now runs instantly, in the same chunk as the receipt that created it, only when it deletes its predecessor's own account. A receipt that deletes another account is forwarded to the receiver's shard and fails there the same way as a transaction that deletes another account: with ActorNoPermission, or with AccountDoesNotExist when the account does not exist. Before, it ran on the sender's shard and failed with AccountDoesNotExist when the account existed on another shard.
  • A push to an outgoing receipt buffer or to the PromiseYield timeout queue now reads the key it writes before the push, so the per-chunk storage proof limit counts the trie nodes of the insert. Before, those nodes were recorded only when the chunk's state changes were finalized, after the limits were checked. A chunk can now stop taking receipts sooner.

Non-protocol Changes

  • The ExternalCallTransactions database column, which maps an external call's unique id and block to the call's hash, raises DB_VERSION from 52 to 53. A node migrates on startup by creating the column; no data is rewritten. (#16791)

  • Two node settings for external contract calls: ecc_pool_size_share, the share of transaction_pool_size_limit external calls may fill (1/10 by default), and ecc_time_share, the share of produce_chunk_add_transactions_time_limit they may take (1/2 by default). Zero keeps them out of the pool or out of chunks.

  • A node no longer takes its Tier 3 state sync address, which it puts in its state requests and snapshot host advertisements, from whichever peer reports it first. Each Tier 2 peer reports the IP at which it sees the node, and the node uses the IP reported from the most network groups of peers (/16 for IPv4, /32 for IPv6), together with its own listen port. The address is re-evaluated as peers connect and disconnect, and the near_tier3_public_addr metric follows it. The new near_tier3_public_addr_groups and near_tier3_public_addr_runner_up_groups metrics show how many network groups report the chosen IP and the runner-up. Loopback, private, link-local, carrier-grade NAT and unique local IPs are ignored unless network.allow_private_ip_in_public_addrs is set, so a node whose peers reach it only over a private network needs that option or network.experimental.tier3_public_addr. Reported IPs in the other address family than the listen address are ignored too, unless the node listens on [::].

  • Removed the deprecated AnnounceAccount mechanism. Validators no longer broadcast AnnounceAccounts, and the accounts field is removed from the SyncRoutingTable network message; messages from older nodes that still set it are accepted and the field is ignored. Routing to a validator now relies only on the AccountData it broadcasts, which covers every validator of the current and next epoch. The known_producers field of the network_info RPC is now built from AccountData. The AccountAnnouncements database column is no longer used, and a migration that raises DB_VERSION from 51 to 52 deletes its rows on startup. The rows were a cache that older releases rebuild, so a node can roll back to a release at version 51 after running neard database set-version --version 51. neard ping now pings only the node it connects to, and its --account-filter-file option is removed. The near_account_announcement_dropped metric is removed, and near_account_to_peer_lookups no longer has a source label. Config change: network.ttl_account_id_router and network.experimental.network_config_overrides.routing_graph_max_accounts_per_message are removed, and ttl_account_id_router is no longer part of the client_config RPC response. A config.json that still sets either field keeps loading; the field is ignored with a warning.

  • Removed the obsolete top-level neard state-parts testing tool and the direct Tier 2 state header/part requests that only it sent. Node-to-node state sync and neard view-state state-parts are unaffected. Breaking config change: network.experimental.network_config_overrides.received_messages_rate_limits.rate_limits no longer accepts the StateRequestHeader, StateRequestPart and StateResponse keys; a node whose config.json still lists any of them will fail to start. Remove those entries before upgrading. (#16482)

  • Fixed the cold store loop on archival nodes stalling or stopping after the RocksDB 10 upgrade: RocksDB's default compaction-debt write stall thresholds (64 GiB soft / 256 GiB hard) were exceeded while the engine reshaped the multi-TB cold State column, and 30-day TTL compactions rewrote gigabytes of cold data to relocate megabytes. The cold store now disables TTL/periodic compactions and uses new cold_store.rocksdb defaults: soft_pending_compaction_bytes_limit 512 GiB, hard_pending_compaction_bytes_limit 2 TiB, compaction_readahead_size 32 MiB (a DB-level option; the previous per-tier compaction_readahead_size under cf_*_load_overrides never had any effect and is removed) and use_direct_io_for_flush_and_compaction enabled. All four are new optional rocksdb config fields for both store and cold_store; the hot store keeps RocksDB's defaults unless set. Direct I/O requires a filesystem with O_DIRECT support (ext4, xfs): if the cold store fails to open with "Direct I/O is not supported", set cold_store.rocksdb.use_direct_io_for_flush_and_compaction to false. After the first restart on this version each archival node drains its accumulated compaction backlog, throttled but no longer stopped. (#16502)

  • Added the opt-in EXPERIMENTAL_indexer_block RPC to fetch indexer messages by block hash. Enable it with rpc.enable_indexer_rpc; rpc.indexer_max_concurrent_requests controls request concurrency.

  • Added an experimental enable_compiler_daemon node setting for compiling Wasmtime contracts in isolated, memory-limited subprocesses. It is disabled by default. On Linux, enabling it requires Landlock support and causes startup to fail if the sandbox cannot be activated. (#16067)

  • View queries on a funded but uninitialized universal (0u) account now fail with the new UNINITIALIZED_ACCOUNT error. This covers call_function, view_code, view_state, view_access_key, view_access_key_list and view_gas_key_nonces, which used to answer as if the account had no contract, keys or data. view_account is unchanged and still reports state: "uninitialized".

  • call_function queries (query and EXPERIMENTAL_call_function) take an optional state_init for a deterministic or universal account: {"universal": "<base64>"} or {"deterministic": {"code": ..., "data": {...}}}. Unless the account already has its state, the call runs as if state_init were installed; otherwise state_init is only validated. An invalid state_init fails with the new INVALID_STATE_INIT error, and one whose global contract is missing with NO_GLOBAL_CONTRACT_CODE.

  • When a transaction or receipt has execution outcomes in several blocks, the node now returns the one that changed state, or the earliest one if none did. Before, it returned the first one in block hash order.

Rollback from 2.15 to 2.14

If a node has problems on 2.15, it can go back to 2.14.1 before the network upgrades to protocol version 89. Stop the node, then:

  1. Run neard database drop-column --column ExternalCallTransactions with the 2.15 binary. On an archival node it drops the column from both the hot and the cold store.
  2. Run neard database set-version --version 51 with the 2.14.1 binary.
  3. Delete the state_snapshot directory in the hot store directory, <home>/data by default.
  4. Start 2.14.1.

Both commands ask for confirmation: answer y. If drop-column refuses a database still at version 51, run neard database set-version --version 53 with the 2.15 binary first.

Protocol upgrade voting

This release upgrades the protocol version from 88 to 89.
Voting for protocol version 89 will start on Tuesday December 1st 00:00 UTC.
To continue participating in consensus, you need to upgrade your node before this time.

If voting succeeds in one epoch, the protocol upgrade to version 89 is expected to happen 7-14 hours after the voting epoch ends.

Don't miss a new nearcore release

NewReleases is sending notifications on new releases.