Skip to content

合约方法的签名ID计算缺少了参数和返回值的信息 #24

@ethan75

Description

@ethan75

下面的合约应该是合法的(参考https://liquid-doc.readthedocs.io/zh_CN/latest/docs/contract/method.html):
image

实际编译报错:
error[E0428]: the name __LIQUID_EXTERNAL_INPUT_CHECKER_1746386959 is defined multiple times
--> E:\101_code\hello_world\src\lib.rs:6:1
|
6 | #[liquid::contract]
| ^^^^^^^^^^^^^^^^^^^ __LIQUID_EXTERNAL_INPUT_CHECKER_1746386959 redefined here
|
= note: __LIQUID_EXTERNAL_INPUT_CHECKER_1746386959 must be defined only once in the type namespace of this block
= note: this error originates in the attribute macro liquid::contract (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait FnOutput for type FnMarker<[(); 1746386959]>
--> E:\101_code\hello_world\src\lib.rs:28:30
|
23 | pub fn get(&self) -> String {
| ------ first implementation here
...
28 | pub fn get(&self) -> Address {
| ^^^^^^^ conflicting implementation for FnMarker<[(); 1746386959]>

error[E0119]: conflicting implementations of trait FnSelector for type FnMarker<[(); 1746386959]>
--> E:\101_code\hello_world\src\lib.rs:6:1

合约方法的签名ID不应该对方法名称“get”进行hash取前4字节来计算,应该调整为“get()->String"或者”get()->Address"。

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