Skip to content

Custom selector not working #2620

@Subway2023

Description

@Subway2023

Description: Even though I used #[ink(message, selector = 0xc0defafe)] to set the selector, it didn’t take effect—I still have to use the original selector to successfully call the function.

#![cfg_attr(not(feature = "std"), no_std, no_main)] #[ink::contract] mod flipper { #[ink(storage)] pub struct Flipper { /// Stores a single `bool` value on the storage.  value: bool, } impl Flipper { #[ink(constructor)] pub fn new(init_value: bool) -> Self { Self { value: init_value } } #[ink(message, selector = 0xc0defafe)] pub fn gettest(&self) -> i32 { 100 } } }
cargo contract build --generate code-only --metadata solidity 

Execute with c0defafe

revive/target/release/revive-runner -f inkTester/target/ink/flipper.polkavm -c c0defafe 
thread 'main' panicked at crates/runner/src/lib.rs:163:9: assertion `left == right` failed: contract execution result mismatch: Exec { result: ContractResult { gas_consumed: Weight { ref_time: 43382986, proof_size: 11909 }, gas_required: Weight { ref_time: 43382986, proof_size: 11909 }, storage_deposit: StorageDeposit::Charge(0), result: Ok(ExecReturnValue { flags: REVERT, data: [1, 1] }) }, wall_time: 689.4µs } left: true right: false note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 

Execute with a941ae43 (default of gettest())

revive/target/release/revive-runner -f inkTester/target/ink/flipper.polkavm -c a941ae43 
Call #0 raw return bytes: 0x Call #1 raw return bytes: 0x0000000000000000000000000000000000000000000000000000000000000064 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions