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

Set Sui package manifest to pass source verification #3731

Open
wants to merge 4 commits into
base: sui/testnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clients/js/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const OVERRIDES = {
},
TESTNET: {
sui: {
core: "0x69ae41bdef4770895eb4e7aaefee5e4673acc08f6917b4856cf55549c4573ca8",
core: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",
token_bridge:
"0x32422cb2f929b6a4e3f81b4791ea11ac2af896b310f3d9442aa1fe924ce0bab4",
"0x6fb10cdb7aa299e9a4308752dadecb049ff55a892de92992a1edbd7912b3d6da",
},
aptos: {
token_bridge:
Expand Down
4 changes: 2 additions & 2 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ const TESTNET = {
nft_bridge: undefined,
},
sui: {
core: "0x69ae41bdef4770895eb4e7aaefee5e4673acc08f6917b4856cf55549c4573ca8",
core: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",
token_bridge:
"0x32422cb2f929b6a4e3f81b4791ea11ac2af896b310f3d9442aa1fe924ce0bab4",
"0x6fb10cdb7aa299e9a4308752dadecb049ff55a892de92992a1edbd7912b3d6da",
nft_bridge: undefined,
},
moonbeam: {
Expand Down
6 changes: 3 additions & 3 deletions sui/token_bridge/Move.testnet.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "TokenBridge"
version = "0.1.1"
published-at = "0x4eb7c5bca3759ab3064b46044edb5668c9066be8a543b28b58375f041f876a80"
version = "0.2.0"
published-at = "0x562760fc51d90d4ae1835bac3e91e0e6987d3497b06f066941d3e51f6e8d76d0"

[dependencies.Sui]
git = "https://github.com/MystenLabs/sui.git"
Expand All @@ -12,4 +12,4 @@ rev = "09b2081498366df936abae26eea4b2d5cafb2788"
local = "../wormhole"

[addresses]
token_bridge = "0x92d81f28c167d90f84638c654b412fe7fa8e55bdfac7f638bdcf70306289be86"
token_bridge = "0x562760fc51d90d4ae1835bac3e91e0e6987d3497b06f066941d3e51f6e8d76d0"
11 changes: 9 additions & 2 deletions sui/wormhole/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@

[move]
version = 0
manifest_digest = "20C2ADF9411233240C3FA257B9A558910826BB5EBBCDB54F0D0816D61333B4A8"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"

dependencies = [
{ name = "Sui" },
]

[[move.package]]
name = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "09b2081498366df936abae26eea4b2d5cafb2788", subdir = "crates/sui-framework/packages/move-stdlib" }
source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be best to keep these dependencies pinned to a commit hash

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to take into account that Sui (along with MoveStdlib at "0x1"
AFAIK) is a special package which can be upgraded onchain 'in-place'
(unlike regular Move package upgrades on Sui that in effect create a new
package with a new address.)

The advantage of using framework/testnet is that the compiler will
automatically fetch the Sui package that's currently on testnet, hence
source verification will succeed.

$ sui client verify-source --verify-deps
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING Wormhole
// ...
Source verification succeeded!

However, let's say we published the package in the past and set Sui
to testnet-v1.17.1 in the manifest. Verification could fail in the
future to to upgrades to the Sui package.

$ sui client verify-source --verify-deps
FETCHING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING Wormhole
// ...
Multiple source verification errors found:

- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::bls12381
- Local version of dependency 0000000000000000000000000000000000000000000000000000000000000002::group_ops was not found.

For all other packages, it definitely makes sense to pin them to a
commit/tag.


[[move.package]]
name = "Sui"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "09b2081498366df936abae26eea4b2d5cafb2788", subdir = "crates/sui-framework/packages/sui-framework" }
source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" }

dependencies = [
{ name = "MoveStdlib" },
]

[move.toolchain-version]
compiler-version = "1.16.1"
edition = "legacy"
flavor = "sui"
6 changes: 3 additions & 3 deletions sui/wormhole/Move.testnet.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "Wormhole"
version = "0.1.2"
published-at = "0x3542d705ec6a7e05045288ec99a6c4b4e3ded999b6feab720fab535b08fa51f8"
version = "0.2.0"
published-at = "0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94"

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

[addresses]
wormhole = "0x15e1e51cb59fe1f987b037da12745a278855c8ac73050f4f194466096a0ca05b"
wormhole = "0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94"
8 changes: 3 additions & 5 deletions sui/wormhole/Move.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[package]
name = "Wormhole"
version = "0.2.0"
published-at = "0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address I see in the testnet branch is 0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. Indeed, I changed published-at and wormhole to
0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94
in Move.toml and source verification passed too. Begs the question of
why there are two different deployments with the exact same source code.

In fact, at Aftermath we've been using 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e
to verify Wormhole messages (and there's more activity in the contract
than just ours looking at the txs.)

Would be good to clarify what's the official version.


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

[addresses]
wormhole = "_"

[dev-addresses]
wormhole = "0x100"
wormhole = "0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e"
8 changes: 8 additions & 0 deletions sui/wormhole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ TODO: up to date notes on where and how we use dynamic fields.

Sui currently does not have fine-grained timestamps, so we use
`tx_context::epoch(ctx)` in place of on-chain time in seconds.

# Source verification

Verify that the Move sources here match the package published on-chain by running
`sui client verify-source --verify-deps`

Make sure that `sui client active-env` is connected to a Sui RPC for the
network the contract is deployed to (`mainnet/testnet`).