Substrate 3.0 "on_runtime_upgrade" 功能不起作用

Substrate 3.0 "on_runtime_upgrade" function does not work

我想尝试“运行时升级”和“存储迁移”。 我尝试了以下步骤,但“on_runtime_upgrade”功能不起作用。 无法验证是否调用了“on_runtime_upgrade”函数。 实现的调试日志不输出。

  1. 下载“substrate-node-template 3.0”。
  2. 编译它。
  3. I 运行 使用以下命令的节点。 “target/release/node-template --dev -l runtime = debug”。
  4. 在“palet-template”中实现“on_runtime_upgrade”。列出我试过的程序“substrate-node-template/pallets/template/lib.rs” 下面。
  5. 通过“cargo build --release -p node-template-runtime”命令编译。
  6. 使用“sudo”和“setcode”命令上传“node_template_runtime.compact.wasm”。
  7. 我查看了节点的执行日志,但是我无法查看设置为“on_runtime_upgrade”的日志。

--lib.rs--

#![cfg_attr(not(feature = "std"), no_std)]

/// Edit this file to define custom logic or remove it if it is not needed.
/// Learn more about FRAME and the core library of Substrate FRAME pallets:
/// https://substrate.dev/docs/en/knowledgebase/runtime/frame

use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch, traits::Get, debug, weights::Weight};
use frame_system::ensure_signed;

#[cfg(test)]
mod mock;

#[cfg(test)]
mod tests;

/// Configure the pallet by specifying the parameters and types on which it depends.
pub trait Config: frame_system::Config {
    /// Because this pallet emits events, it depends on the runtime's definition of an event.
    type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
}

// The pallet's runtime storage items.
// https://substrate.dev/docs/en/knowledgebase/runtime/storage
decl_storage! {
    // A unique name is used to ensure that the pallet's storage items are isolated.
    // This name may be updated, but each pallet in the runtime must use a unique name.
    // ---------------------------------vvvvvvvvvvvvvv
    trait Store for Module<T: Config> as TemplateModule {
        // Learn more about declaring storage items:
        // https://substrate.dev/docs/en/knowledgebase/runtime/storage#declaring-storage-items
        Something get(fn something): Option<u32>;
    }
}

// Pallets use events to inform users when important changes are made.
// https://substrate.dev/docs/en/knowledgebase/runtime/events
decl_event!(
    pub enum Event<T> where AccountId = <T as frame_system::Config>::AccountId {
        /// Event documentation should end with an array that provides descriptive names for event
        /// parameters. [something, who]
        SomethingStored(u32, AccountId),
    }
);

// Errors inform users that something went wrong.
decl_error! {
    pub enum Error for Module<T: Config> {
        /// Error names should be descriptive.
        NoneValue,
        /// Errors should have helpful documentation associated with them.
        StorageOverflow,
    }
}

// Dispatchable functions allows users to interact with the pallet and invoke state changes.
// These functions materialize as "extrinsics", which are often compared to transactions.
// Dispatchable functions must be annotated with a weight and must return a DispatchResult.

decl_module! {
    pub struct Module<T: Config> for enum Call where origin: T::Origin {
        // Errors must be initialized if they are used by the pallet.
        type Error = Error<T>;
    // Events must be initialized if they are used by the pallet.
    fn deposit_event() = default;

    /// An example dispatchable that takes a singles value as a parameter, writes the value to
    /// storage and emits an event. This function must be dispatched by a signed extrinsic.
    #[weight = 10_000 + T::DbWeight::get().writes(1)]
    pub fn do_something(origin, something: u32) -> dispatch::DispatchResult {
        // Check that the extrinsic was signed and get the signer.
        // This function will return an error if the extrinsic is not signed.
        // https://substrate.dev/docs/en/knowledgebase/runtime/origin
        let who = ensure_signed(origin)?;

        // Update storage.
        Something::put(something);

        // Emit an event.
        Self::deposit_event(RawEvent::SomethingStored(something, who));
        // Return a successful DispatchResult
        Ok(())
    }

    /// An example dispatchable that may throw a custom error.
    #[weight = 10_000 + T::DbWeight::get().reads_writes(1,1)]
    pub fn cause_error(origin) -> dispatch::DispatchResult {
        let _who = ensure_signed(origin)?;

        // Read a value from storage.
        match Something::get() {
            // Return an error if the value has not been set.
            None => Err(Error::<T>::NoneValue)?,
            Some(old) => {
                // Increment the value read from storage; will error in the event of overflow.
                let new = old.checked_add(1).ok_or(Error::<T>::StorageOverflow)?;
                // Update the value in storage with the incremented result.
                Something::put(new);
                Ok(())
            },
        }
    }

    fn on_runtime_upgrade() -> Weight {
        debug::info!("############################ storage poorly updated");
        0
    }

}

}

--终端日志--

shin.takahashi@shintakahashinoMacBook-Pro substrate-node-template % ./target/release/node-template --dev -lruntime=debug
2021-04-03 07:33:03.580   WARN main sc_cli::commands::run_cmd: Running in --dev mode, RPC CORS has been disabled.    
2021-04-03 07:33:03.580   INFO main sc_cli::runner: Substrate Node    
2021-04-03 07:33:03.580   INFO main sc_cli::runner: ✌️  version 3.0.0-8370ddd-x86_64-macos    
2021-04-03 07:33:03.580   INFO main sc_cli::runner: ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2021    
2021-04-03 07:33:03.580   INFO main sc_cli::runner:  Chain specification: Development    
2021-04-03 07:33:03.580   INFO main sc_cli::runner:  Node name: zonked-woman-7834    
2021-04-03 07:33:03.580   INFO main sc_cli::runner:  Role: AUTHORITY    
2021-04-03 07:33:03.580   INFO main sc_cli::runner:  Database: RocksDb at /Users/shin.takahashi/Library/Application Support/node-template/chains/dev/db    
2021-04-03 07:33:03.580   INFO main sc_cli::runner: ⛓  Native runtime: node-template-100 (node-template-1.tx1.au1)    
2021-04-03 07:33:03.727   INFO main sc_service::client::client:  Initializing Genesis block/state (state: 0x8d93…a7e0, header-hash: 0xa18d…9547)    
2021-04-03 07:33:03.728   INFO main afg:  Loading GRANDPA authority set from genesis on what appears to be first startup.    
2021-04-03 07:33:03.748   INFO main sc_consensus_slots: ⏱  Loaded block-time = 6000 milliseconds from genesis on first-launch    
2021-04-03 07:33:03.748   WARN main sc_service::config: Using default protocol ID "sup" because none is configured in the chain specs    
2021-04-03 07:33:03.749   INFO main sub-libp2p:  Local node identity is: 12D3KooWGF1RF4K4gsNzRL7ssKUKSRLceWQcUr75pJrue7Tge4Cq    
2021-04-03 07:33:04.232   INFO main sc_service::builder:  Highest known block at #0    
2021-04-03 07:33:04.233   INFO tokio-runtime-worker substrate_prometheus_endpoint::known_os: 〽️ Prometheus server started at 127.0.0.1:9615    
2021-04-03 07:33:04.234   INFO                 main parity_ws: Listening for new connections on 127.0.0.1:9944.    
2021-04-03 07:33:04.929   INFO ThreadId(33) parity_ws::io: Accepted a new tcp connection from 127.0.0.1:56641.    
2021-04-03 07:33:06.005   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0xa18d299078fee1c04c0b3aabecbb794b3da3bcc23c6e6b079581d7480f689547    
2021-04-03 07:33:06.014   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 1 [hash: 0xc9f4b73282f6c0accf43277cc449eee7d9f34ca686fbc55b5afa5b35a406008f; parent_hash: 0xa18d…9547; extrinsics (1): [0x54ea…9482]]    
2021-04-03 07:33:06.018   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 1. Hash now 0x4f0af9928094bb7251ed78c8b2ca2b08e62886552e6b9ecf00e9818ec6c74e0f, previously 0xc9f4b73282f6c0accf43277cc449eee7d9f34ca686fbc55b5afa5b35a406008f.    
2021-04-03 07:33:06.018   INFO tokio-runtime-worker substrate: ✨ Imported #1 (0x4f0a…4e0f)    
2021-04-03 07:33:06.018   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x4f0af9928094bb7251ed78c8b2ca2b08e62886552e6b9ecf00e9818ec6c74e0f    
2021-04-03 07:33:06.019   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 2 [hash: 0xc6216cda459dfebab7edd82666aa5217611a6777f00b4484e24380385436f500; parent_hash: 0x4f0a…4e0f; extrinsics (1): [0x9a3a…dd4c]]    
2021-04-03 07:33:06.023   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 2. Hash now 0x15a92eafa1aa165596509425006ef312c6a2197ed7043ce3dbc4c9424ee9e266, previously 0xc6216cda459dfebab7edd82666aa5217611a6777f00b4484e24380385436f500.    
2021-04-03 07:33:06.023   INFO tokio-runtime-worker substrate: ✨ Imported #2 (0x15a9…e266)    
2021-04-03 07:33:06.614   INFO ThreadId(33) parity_ws::io: Accepted a new tcp connection from 127.0.0.1:56642.    
2021-04-03 07:33:09.235   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #2 (0x15a9…e266), finalized #0 (0xa18d…9547), ⬇ 0 ⬆ 0    
2021-04-03 07:33:12.004   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x15a92eafa1aa165596509425006ef312c6a2197ed7043ce3dbc4c9424ee9e266    
2021-04-03 07:33:12.006   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 3 [hash: 0xa69e3a90af4cc5c4a18a470867e9322cc2d4849d80ec1889498356430a9f2c41; parent_hash: 0x15a9…e266; extrinsics (1): [0xec69…7d0d]]    
2021-04-03 07:33:12.012   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 3. Hash now 0x83078c6578a357b330148c38375c8bc33262d1cd7caa07f76e5017ee8709c1d5, previously 0xa69e3a90af4cc5c4a18a470867e9322cc2d4849d80ec1889498356430a9f2c41.    
2021-04-03 07:33:12.013   INFO tokio-runtime-worker substrate: ✨ Imported #3 (0x8307…c1d5)    
2021-04-03 07:33:14.236   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #3 (0x8307…c1d5), finalized #1 (0x4f0a…4e0f), ⬇ 0 ⬆ 0    
2021-04-03 07:33:18.000   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x83078c6578a357b330148c38375c8bc33262d1cd7caa07f76e5017ee8709c1d5    
2021-04-03 07:33:18.000   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 4 [hash: 0x9c2b02c4c3add90a9e71e16ff430895d9ddd99d4b1f661fd7dc85af57affff28; parent_hash: 0x8307…c1d5; extrinsics (1): [0x85e6…60ef]]    
2021-04-03 07:33:18.003   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 4. Hash now 0x013cfa6a5df24a042232563affcc3fa3b9c8ac4c34a165e92d2399572d31659c, previously 0x9c2b02c4c3add90a9e71e16ff430895d9ddd99d4b1f661fd7dc85af57affff28.    
2021-04-03 07:33:18.004   INFO tokio-runtime-worker substrate: ✨ Imported #4 (0x013c…659c)    
2021-04-03 07:33:19.240   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #4 (0x013c…659c), finalized #2 (0x15a9…e266), ⬇ 0 ⬆ 0    
2021-04-03 07:33:24.003   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x013cfa6a5df24a042232563affcc3fa3b9c8ac4c34a165e92d2399572d31659c    
2021-04-03 07:33:24.005   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 5 [hash: 0x3191bb44c37ec64fe55f13effc83cf81faa63932701f9c53e3fbdf0b62207411; parent_hash: 0x013c…659c; extrinsics (1): [0x6cd0…5fe0]]    
2021-04-03 07:33:24.011   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 5. Hash now 0xb5481b446663db1837b9e6e97b1ba90b78f83b7375b63281a619cab2fad14a7e, previously 0x3191bb44c37ec64fe55f13effc83cf81faa63932701f9c53e3fbdf0b62207411.    
2021-04-03 07:33:24.011   INFO tokio-runtime-worker substrate: ✨ Imported #5 (0xb548…4a7e)    
2021-04-03 07:33:24.240   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #5 (0xb548…4a7e), finalized #2 (0x15a9…e266), ⬇ 0 ⬆ 0    
2021-04-03 07:33:29.246   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #5 (0xb548…4a7e), finalized #3 (0x8307…c1d5), ⬇ 0 ⬆ 0    
2021-04-03 07:33:30.002   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0xb5481b446663db1837b9e6e97b1ba90b78f83b7375b63281a619cab2fad14a7e    
2021-04-03 07:33:30.003   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 6 [hash: 0x3cd0f4ce01046987269ba3d49f9c2a6cf183f501afe41aa497949914f52f9721; parent_hash: 0xb548…4a7e; extrinsics (1): [0x5375…d8ef]]    
2021-04-03 07:33:30.007   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 6. Hash now 0x7e060bc35305721cfe2262d993befdad2d71993b344496a8a6a79b326d5b58c4, previously 0x3cd0f4ce01046987269ba3d49f9c2a6cf183f501afe41aa497949914f52f9721.    
2021-04-03 07:33:30.007   INFO tokio-runtime-worker substrate: ✨ Imported #6 (0x7e06…58c4)    
2021-04-03 07:33:34.248   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #6 (0x7e06…58c4), finalized #4 (0x013c…659c), ⬇ 0 ⬆ 0    
2021-04-03 07:33:36.005   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x7e060bc35305721cfe2262d993befdad2d71993b344496a8a6a79b326d5b58c4    
2021-04-03 07:33:36.006   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 7 [hash: 0xd42883a6a51c3eb4a4e041b393209a40453449cb3fb3ad9b116dc8fd56e34a46; parent_hash: 0x7e06…58c4; extrinsics (1): [0xf575…ca3e]]    
2021-04-03 07:33:36.012   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 7. Hash now 0x39e2a33eb585f309b0c37dbfc9f14a51b9bdc65635cd87c3492aff410a307010, previously 0xd42883a6a51c3eb4a4e041b393209a40453449cb3fb3ad9b116dc8fd56e34a46.    
2021-04-03 07:33:36.013   INFO tokio-runtime-worker substrate: ✨ Imported #7 (0x39e2…7010)    
2021-04-03 07:33:39.251   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #7 (0x39e2…7010), finalized #5 (0xb548…4a7e), ⬇ 0 ⬆ 0    
2021-04-03 07:33:42.001   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x39e2a33eb585f309b0c37dbfc9f14a51b9bdc65635cd87c3492aff410a307010    
2021-04-03 07:33:42.002   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 8 [hash: 0xeaf6a8d40392030ae86e567b3c2ef946db47721d5ea1b01f7cfd04bc6c192145; parent_hash: 0x39e2…7010; extrinsics (1): [0xed82…2539]]    
2021-04-03 07:33:42.008   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 8. Hash now 0x934c7179130ee58e9796f3c5e185ff5fc948b8b90498872d76958808d43f90ea, previously 0xeaf6a8d40392030ae86e567b3c2ef946db47721d5ea1b01f7cfd04bc6c192145.    
2021-04-03 07:33:42.009   INFO tokio-runtime-worker substrate: ✨ Imported #8 (0x934c…90ea)    
2021-04-03 07:33:44.253   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #8 (0x934c…90ea), finalized #6 (0x7e06…58c4), ⬇ 0 ⬆ 0    
2021-04-03 07:33:48.004   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x934c7179130ee58e9796f3c5e185ff5fc948b8b90498872d76958808d43f90ea    
2021-04-03 07:33:48.005   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 9 [hash: 0xf4c3c64fc1c19d74a869ed31c4ac80f732626563f9fbd7c8224f93bb8d54e891; parent_hash: 0x934c…90ea; extrinsics (1): [0x9ddc…c0d8]]    
2021-04-03 07:33:48.007   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 9. Hash now 0x06f235029fcbf1dfb4c08409dd6221ab3a58937c322b9e35ea8f328d9795e52c, previously 0xf4c3c64fc1c19d74a869ed31c4ac80f732626563f9fbd7c8224f93bb8d54e891.    
2021-04-03 07:33:48.008   INFO tokio-runtime-worker substrate: ✨ Imported #9 (0x06f2…e52c)    
2021-04-03 07:33:49.257   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #9 (0x06f2…e52c), finalized #6 (0x7e06…58c4), ⬇ 0 ⬆ 0    
2021-04-03 07:33:54.000   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x06f235029fcbf1dfb4c08409dd6221ab3a58937c322b9e35ea8f328d9795e52c    
2021-04-03 07:33:54.001   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 10 [hash: 0x477c98069a931dce508a87ffd20e7ca05432c2bfb3e3421ecdc48f893cabe142; parent_hash: 0x06f2…e52c; extrinsics (1): [0xa920…147e]]    
2021-04-03 07:33:54.006   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 10. Hash now 0x2cb890472d0a1ee3c984c2e58c1d14788337a669d485d52b91fe10d32b19646e, previously 0x477c98069a931dce508a87ffd20e7ca05432c2bfb3e3421ecdc48f893cabe142.    
2021-04-03 07:33:54.006   INFO tokio-runtime-worker substrate: ✨ Imported #10 (0x2cb8…646e)    
2021-04-03 07:33:54.257   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #10 (0x2cb8…646e), finalized #7 (0x39e2…7010), ⬇ 0 ⬆ 0    
2021-04-03 07:33:59.257   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #10 (0x2cb8…646e), finalized #8 (0x934c…90ea), ⬇ 0 ⬆ 0    
2021-04-03 07:34:00.004   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x2cb890472d0a1ee3c984c2e58c1d14788337a669d485d52b91fe10d32b19646e    
2021-04-03 07:34:00.005   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 11 [hash: 0x0e0d7d59185222e5f6cc5470af17830a9b8d5119d7f5fd225d4c3312d7dc9b80; parent_hash: 0x2cb8…646e; extrinsics (1): [0xc575…d9e3]]    
2021-04-03 07:34:00.011   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 11. Hash now 0x60a28c64bc9788334d8eb073c944e497dbc1ef9c544027acd8a1eb9c8c389f38, previously 0x0e0d7d59185222e5f6cc5470af17830a9b8d5119d7f5fd225d4c3312d7dc9b80.    
2021-04-03 07:34:00.012   INFO tokio-runtime-worker substrate: ✨ Imported #11 (0x60a2…9f38)    
2021-04-03 07:34:04.257   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #11 (0x60a2…9f38), finalized #9 (0x06f2…e52c), ⬇ 0 ⬆ 0    
2021-04-03 07:34:06.001   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x60a28c64bc9788334d8eb073c944e497dbc1ef9c544027acd8a1eb9c8c389f38    
2021-04-03 07:34:06.041   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 12 [hash: 0x52a8d5b45be406e92a6313d01e698da8e9f3c25b686de1b9da17ac5ed1be15f8; parent_hash: 0x60a2…9f38; extrinsics (2): [0xd60c…93db, 0xb99f…9061]]    
2021-04-03 07:34:06.043   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 12. Hash now 0x868d7904bfe7fd00894789da5198a34236a8d2eaf73b50b2870908f5fecd2516, previously 0x52a8d5b45be406e92a6313d01e698da8e9f3c25b686de1b9da17ac5ed1be15f8.    
2021-04-03 07:34:06.044   INFO tokio-runtime-worker substrate: ✨ Imported #12 (0x868d…2516)    
2021-04-03 07:34:09.260   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #12 (0x868d…2516), finalized #10 (0x2cb8…646e), ⬇ 0 ⬆ 0    
2021-04-03 07:34:12.000   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0x868d7904bfe7fd00894789da5198a34236a8d2eaf73b50b2870908f5fecd2516    
2021-04-03 07:34:12.001   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 13 [hash: 0x73e1a13a573324b497f1e8bb80cf9b044f06552a2be64149afa5d2823daacafc; parent_hash: 0x868d…2516; extrinsics (1): [0x784e…1478]]    
2021-04-03 07:34:12.007   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 13. Hash now 0xa17517d0d752e1a65293d9edead6f3d8e5f77c141cbfcce2aa43987eb3ae5e71, previously 0x73e1a13a573324b497f1e8bb80cf9b044f06552a2be64149afa5d2823daacafc.    
2021-04-03 07:34:12.008   INFO tokio-runtime-worker substrate: ✨ Imported #13 (0xa175…5e71)    
2021-04-03 07:34:14.263   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #13 (0xa175…5e71), finalized #11 (0x60a2…9f38), ⬇ 0 ⬆ 0    
2021-04-03 07:34:18.000   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Starting consensus session on top of parent 0xa17517d0d752e1a65293d9edead6f3d8e5f77c141cbfcce2aa43987eb3ae5e71    
2021-04-03 07:34:18.001   INFO tokio-runtime-worker sc_basic_authorship::basic_authorship:  Prepared block for proposing at 14 [hash: 0x0b1f20f6e17fb8a1729af601675dbef46412d22d4d12ed4a5a27ee34580b7ecf; parent_hash: 0xa175…5e71; extrinsics (1): [0x664e…ff45]]    
2021-04-03 07:34:18.008   INFO tokio-runtime-worker sc_consensus_slots:  Pre-sealed block for proposal at 14. Hash now 0xe753a25482052b126951d823cd9ec922a919aaa11ef5fc8751a8c20587935195, previously 0x0b1f20f6e17fb8a1729af601675dbef46412d22d4d12ed4a5a27ee34580b7ecf.    
2021-04-03 07:34:18.008   INFO tokio-runtime-worker substrate: ✨ Imported #14 (0xe753…5195)    
2021-04-03 07:34:19.263   INFO tokio-runtime-worker substrate:  Idle (0 peers), best: #14 (0xe753…5195), finalized #11 (0x60a2…9f38), ⬇ 0 ⬆ 0 

此代码有效。 但是“调试::信息!”不起作用。 “Something”的值为“32”。

fn on_runtime_upgrade() -> Weight {
    debug::info!("############################ storage poorly updated");
    Something::put(32);
    0
}