Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Reference Bug #21254

Open
qxyanda opened this issue Feb 18, 2025 · 3 comments
Open

Package Reference Bug #21254

qxyanda opened this issue Feb 18, 2025 · 3 comments
Assignees

Comments

@qxyanda
Copy link

qxyanda commented Feb 18, 2025

I want to reference the latest version 21 of the Navi package, but after publishing, I found that the function being called is still from version 1. Of course, the variable types are compatible with version 1, but the functions have a version check.

here is my published package:

the function

0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::incentive_v2::entry_deposit<T0>(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);

should be

0x834a86970ae93a73faf4fff16ae40bdb72b91c47be585fff19a2af60a19ddca3::incentive_v2::entry_deposit<T0>(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);

how can i fix this problem?

this is my .toml below

[package]
name = "lending_core"
version = "0.0.1"
published-at = "0x834a86970ae93a73faf4fff16ae40bdb72b91c47be585fff19a2af60a19ddca3"

[dependencies.Sui]
git = "https://github.com/MystenLabs/sui.git"
subdir = "crates/sui-framework/packages/sui-framework"
rev = "mainnet"

[dependencies.math]
local = "../math"

[dependencies.oracle]
local = "../oracle"

[dependencies.utils]
local = "../utils"

[addresses]
sui = "0x2"
lending_core = "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca"
Copy link
Contributor

Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links!

@mdgeorge4153
Copy link
Contributor

Hi @qxyanda, thanks for your question. On sui, the original published ID of the package is used as an identifier for all versions of the package in the bytecode. Each published package also contains a linkage table that maps these original IDs to the object ID of the package that will be used at run time. This structure is designed to support dependency overriding.

So if you are using Navi Protocol version 20 that is published at 0x834a..., I would expect your bytecode to contain a call to the original ID (0xd899...), but for your published package to have a linkage table containing an entry mapping 0xd899... to 0x834a..., and this is the actual code that will be executed when you call into your package.

I don't see the link to your published package, so I'm not sure if that answers your question, but I hope it helps!

@qxyanda
Copy link
Author

qxyanda commented Feb 18, 2025

Hi @qxyanda, thanks for your question. On sui, the original published ID of the package is used as an identifier for all versions of the package in the bytecode. Each published package also contains a linkage table that maps these original IDs to the object ID of the package that will be used at run time. This structure is designed to support dependency overriding.

So if you are using Navi Protocol version 20 that is published at 0x834a..., I would expect your bytecode to contain a call to the original ID (0xd899...), but for your published package to have a linkage table containing an entry mapping 0xd899... to 0x834a..., and this is the actual code that will be executed when you call into your package.因此, 0xd899...

I don't see the link to your published package, so I'm not sure if that answers your question, but I hope it helps!我看不到

thanks for reply!
here is my package id:

0xb18735c02f8b06a273836898a495f4becff2b99b1b29cfd475041a30d587765a

this is my published code from suivison:

module 0xb18735c02f8b06a273836898a495f4becff2b99b1b29cfd475041a30d587765a::stake {
    struct NaviRouterWrapper has store, key {
        id: 0x2::object::UID,
    }
    
    public fun authorize(arg0: &0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::admin::AdminCap, arg1: &mut NaviRouterWrapper) {
        0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::admin::authorize(arg0, &mut arg1.id);
    }
    
    public fun deauthorize(arg0: &0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::admin::AdminCap, arg1: &mut NaviRouterWrapper) {
        0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::admin::deauthorize(arg0, &mut arg1.id);
    }
    
    public fun deposit<T0>(arg0: &mut NaviRouterWrapper, arg1: &mut 0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::router::RouterSwapCap<T0>, arg2: &0x2::clock::Clock, arg3: &mut 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::Storage, arg4: &mut 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::pool::Pool<T0>, arg5: u8, arg6: 0x2::coin::Coin<T0>, arg7: u64, arg8: &mut 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::incentive::Incentive, arg9: &mut 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::incentive_v2::Incentive, arg10: &mut 0x2::tx_context::TxContext) {
        0x3006e6a6435e6ec339d4aaf603d3547097efc00c00ee06ea195deba1b9ba7a78::router::update_path_metadata<T0>(b"navi-lending", arg1, &arg0.id, 0x2::coin::value<T0>(&arg6));
        0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::incentive_v2::entry_deposit<T0>(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
    }
    
    fun init(arg0: &mut 0x2::tx_context::TxContext) {
        let v0 = NaviRouterWrapper{id: 0x2::object::new(arg0)};
        0x2::transfer::share_object<NaviRouterWrapper>(v0);
    }
    
    // decompiled from Move bytecode v6
}

here in function "deposit", there is a call for 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::incentive_v2::entry_deposit

i want to call 0x834a86970ae93a73faf4fff16ae40bdb72b91c47be585fff19a2af60a19ddca3::incentive_v2::entry_deposit instead, how can i get it right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants