Skip to content

Commit

Permalink
aptos: upgrade to 4.5.0 (libs + toolchain)
Browse files Browse the repository at this point in the history
This change bumps libraries and toolchain of Aptos to the Aptos CLI
v4.5.0 version. The tests are slightly changed to accommodate the
recent changes in the coin library that disallows coin operations
on unitialized coins.
  • Loading branch information
ali-bahjati committed Nov 29, 2024
1 parent 02cdf9e commit 25b9213
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aptos/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN git clone https://github.com/aptos-labs/aptos-core.git
WORKDIR /tmp/aptos-core

# Build aptos 2.0.3
RUN git reset --hard 6f83bc6d02207298b2dee91133d75538789bf582
RUN git reset --hard 47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3
RUN cargo build -p aptos --profile cli

FROM rust:1.62@sha256:5777f201f507075309c4d2d1c1e8d8219e654ae1de154c844341050016a64a0c as export-stage
Expand Down
2 changes: 1 addition & 1 deletion aptos/coin/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.1"
upgrade_policy = "compatible"

[dependencies]
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }

[dev-addresses]
wrapped_coin = "0xBEEF"
Expand Down
2 changes: 1 addition & 1 deletion aptos/deployer/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = '1.0.0'

[dependencies.AptosFramework]
git = 'https://github.com/aptos-labs/aptos-core.git'
rev = '6f83bc6d02207298b2dee91133d75538789bf582'
rev = '47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3'
subdir = 'aptos-move/framework/aptos-framework'

[dev-addresses]
Expand Down
4 changes: 2 additions & 2 deletions aptos/examples/core_messages/sources/sender.move
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ module core_messages::sender_test {
public fun test_send_message(aptos_framework: &signer, user: &signer) {
let message_fee = 100;
timestamp::set_time_has_started_for_testing(aptos_framework);
let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(aptos_framework);

wormhole::init_test(
22,
1,
Expand All @@ -69,8 +71,6 @@ module core_messages::sender_test {
);
sender::init_module_test();

let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(aptos_framework);

// create user account and airdrop coins
account::create_account_for_test(signer::address_of(user));
coin::register<AptosCoin>(user);
Expand Down
8 changes: 4 additions & 4 deletions aptos/nft_bridge/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name = "NFTBridge"
version = "0.0.1"

[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
Wormhole = { local = "../wormhole/" }
TokenBridge = { local = "../token_bridge/" }
Deployer = { local = "../deployer/" }
Expand Down
8 changes: 4 additions & 4 deletions aptos/token_bridge/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name = "TokenBridge"
version = "0.0.1"

[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
Wormhole = { local = "../wormhole/" }
Deployer = { local = "../deployer/" }

Expand Down
8 changes: 4 additions & 4 deletions aptos/wormhole/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ version = "0.0.1"
upgrade_policy = "compatible"

[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "6f83bc6d02207298b2dee91133d75538789bf582" }
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
MoveStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/move-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosStdlib = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-stdlib/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
AptosToken = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-token/", rev = "47f0bf397eb5ca43257bfa775a6b28e7b7faf8b3" }
Deployer = { local = "../deployer/" }
# U256 = { git = "https://github.com/pontem-network/u256", rev = "main" }

Expand Down
17 changes: 14 additions & 3 deletions aptos/wormhole/sources/wormhole.move
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module wormhole::wormhole {
use std::vector;
use aptos_framework::account;
use aptos_framework::coin::{Self, Coin};
use aptos_framework::aptos_coin::{AptosCoin};
use aptos_framework::aptos_coin::{Self, AptosCoin};
use wormhole::structs::{create_guardian, create_guardian_set, Guardian};
use wormhole::state;
use deployer::deployer;
Expand Down Expand Up @@ -128,6 +128,17 @@ module wormhole::wormhole {
initial_guardian: vector<u8>,
message_fee: u64,
): signer {
// Wormhole requires AptosCoin to be initialized; so we iniatilize it
// if it's not initialized already. If you need AptosCoin in the tests
// initialize it before calling this function because AptosCoin can be
// initialized only once.
if (!coin::is_coin_initialized<AptosCoin>()) {
let aptos_framework = std::account::create_account_for_test(@aptos_framework);
let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(&aptos_framework);
coin::destroy_mint_cap(mint_cap);
coin::destroy_burn_cap(burn_cap);
};

let deployer = account::create_account_for_test(@deployer);
let (wormhole, signer_cap) = account::create_resource_account(&deployer, b"wormhole");
init_internal(
Expand Down Expand Up @@ -172,9 +183,9 @@ module wormhole::wormhole_test {

#[test(aptos_framework = @aptos_framework)]
public fun test_publish_message(aptos_framework: &signer) {
setup(100);

let (burn_cap, mint_cap) = aptos_coin::initialize_for_test(aptos_framework);

setup(100);
let fees = coin::mint(100, &mint_cap);

let emitter_cap = wormhole::register_emitter();
Expand Down

0 comments on commit 25b9213

Please sign in to comment.