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_calland 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,RecordedStorageExceededandReservedMethodName. - In the run,
predecessor_account_id,prepaid_gas,random_seed,signer_account_pk,promise_yield_createandpromise_yield_create_with_idfail. In the receipts an accepted call starts,signer_account_pkfails and gas refunds go to the contract. - Clients send a call through
send_txin the fieldexternal_call_base64and look it up throughtxby the copy's unique id. Transaction views carrykind,"signed"or"external_call"; action receipt views carryauthorization_context, besidesigner_public_keyfor a receipt a signed transaction started; an accepted call's state changes carry the causeExternalCallProcessing. The indexer streams external calls with their outcomes. A view call of__external_callruns 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, wherehis the height of the block that creates it, instead of(h - 1) * 1e6. This applies to keys added withAddKey, 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
FunctionCallto an account whose contract is a global contract that was never deployed on the chain now fails withCodeDoesNotExist, 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 withMissingTrieValue). 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
FunctionCallnow chargescontract_loading_basebefore resolving and loading contract code, then chargescontract_loading_bytesbefore 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_limitfrom 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 ofmax_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::ActionV3andReceiptEnum::PromiseYieldV3variants, which carrycreation_protocol_version; tools that decode receipts from Borsh should expect them. The RPC view of such a receipt has two new optional fields,authorization_contextandcreation_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_resumeandpromise_yield_resume_with_yield_idnow accept input from a register (len == u64::MAX). Before, they charged gas foru64::MAXinput bytes before they read the register and failed withIntegerOverflow. 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_decompressandbls12381_p2_decompressnow 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 byAddKeyactions are counted across the receipt and into nested delegate actions, and a new receipt over the limit is rejected at action validation with the newActionsValidationError::TotalNumberOfGasKeyNoncesAddedExceedederror. Nonces removed byDeleteKeyandDeleteAccountactions are counted when the receipt runs, and a receipt that removes more fails with the newActionErrorKind::TotalNumberOfGasKeyNoncesRemovedExceedederror, with all of its changes reverted. Deleting several gas keys that have many nonces now takes one receipt per key. Clients that decodeActionsValidationErrororActionErrorKindshould expect the new variants. - A
DeleteKeyof 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 withActionErrorKind::ReceiptStorageProofSizeExceeded, and a chunk can stop taking receipts sooner. - An action receipt that arrives before its input data now reads each
PostponedReceiptId,PendingDataCountandPostponedReceiptkey before it writes it, a yielded receipt reads itsPromiseYieldReceiptkey before it is stored, and arriving data reads itsReceivedDatakey 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
InvalidSignerIdorSignerDoesNotExist. - Blocks whose body carries a non-empty deprecated
challengesfield 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 asread_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 fromGasExceededtoGasLimitExceeded. Gas profiles show this gas only underTOUCHING_TRIE_NODE. (#16859) - A receipt with a single
DeleteAccountaction 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: withActorNoPermission, or withAccountDoesNotExistwhen the account does not exist. Before, it ran on the sender's shard and failed withAccountDoesNotExistwhen the account existed on another shard. - A push to an outgoing receipt buffer or to the
PromiseYieldtimeout 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
ExternalCallTransactionsdatabase column, which maps an external call's unique id and block to the call's hash, raisesDB_VERSIONfrom 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 oftransaction_pool_size_limitexternal calls may fill (1/10 by default), andecc_time_share, the share ofproduce_chunk_add_transactions_time_limitthey 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_addrmetric follows it. The newnear_tier3_public_addr_groupsandnear_tier3_public_addr_runner_up_groupsmetrics 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 unlessnetwork.allow_private_ip_in_public_addrsis set, so a node whose peers reach it only over a private network needs that option ornetwork.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
AnnounceAccountmechanism. Validators no longer broadcastAnnounceAccounts, and theaccountsfield is removed from theSyncRoutingTablenetwork message; messages from older nodes that still set it are accepted and the field is ignored. Routing to a validator now relies only on theAccountDatait broadcasts, which covers every validator of the current and next epoch. Theknown_producersfield of thenetwork_infoRPC is now built fromAccountData. TheAccountAnnouncementsdatabase column is no longer used, and a migration that raisesDB_VERSIONfrom 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 runningneard database set-version --version 51.neard pingnow pings only the node it connects to, and its--account-filter-fileoption is removed. Thenear_account_announcement_droppedmetric is removed, andnear_account_to_peer_lookupsno longer has asourcelabel. Config change:network.ttl_account_id_routerandnetwork.experimental.network_config_overrides.routing_graph_max_accounts_per_messageare removed, andttl_account_id_routeris no longer part of theclient_configRPC response. Aconfig.jsonthat still sets either field keeps loading; the field is ignored with a warning. -
Removed the obsolete top-level
neard state-partstesting tool and the direct Tier 2 state header/part requests that only it sent. Node-to-node state sync andneard view-state state-partsare unaffected. Breaking config change:network.experimental.network_config_overrides.received_messages_rate_limits.rate_limitsno longer accepts theStateRequestHeader,StateRequestPartandStateResponsekeys; a node whoseconfig.jsonstill 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
Statecolumn, and 30-day TTL compactions rewrote gigabytes of cold data to relocate megabytes. The cold store now disables TTL/periodic compactions and uses newcold_store.rocksdbdefaults:soft_pending_compaction_bytes_limit512 GiB,hard_pending_compaction_bytes_limit2 TiB,compaction_readahead_size32 MiB (a DB-level option; the previous per-tiercompaction_readahead_sizeundercf_*_load_overridesnever had any effect and is removed) anduse_direct_io_for_flush_and_compactionenabled. All four are new optionalrocksdbconfig fields for bothstoreandcold_store; the hot store keeps RocksDB's defaults unless set. Direct I/O requires a filesystem withO_DIRECTsupport (ext4, xfs): if the cold store fails to open with "Direct I/O is not supported", setcold_store.rocksdb.use_direct_io_for_flush_and_compactiontofalse. 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_blockRPC to fetch indexer messages by block hash. Enable it withrpc.enable_indexer_rpc;rpc.indexer_max_concurrent_requestscontrols request concurrency. -
Added an experimental
enable_compiler_daemonnode 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 newUNINITIALIZED_ACCOUNTerror. This coverscall_function,view_code,view_state,view_access_key,view_access_key_listandview_gas_key_nonces, which used to answer as if the account had no contract, keys or data.view_accountis unchanged and still reportsstate: "uninitialized". -
call_functionqueries (queryandEXPERIMENTAL_call_function) take an optionalstate_initfor a deterministic or universal account:{"universal": "<base64>"}or{"deterministic": {"code": ..., "data": {...}}}. Unless the account already has its state, the call runs as ifstate_initwere installed; otherwisestate_initis only validated. An invalidstate_initfails with the newINVALID_STATE_INITerror, and one whose global contract is missing withNO_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:
- Run
neard database drop-column --column ExternalCallTransactionswith the 2.15 binary. On an archival node it drops the column from both the hot and the cold store. - Run
neard database set-version --version 51with the 2.14.1 binary. - Delete the
state_snapshotdirectory in the hot store directory,<home>/databy default. - 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.