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 authored and evan-gray committed Dec 13, 2024
1 parent 8624e5a commit def6c33
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 153 deletions.
4 changes: 2 additions & 2 deletions aptos/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<!-- cspell:disable -->

```bash
cd .. && docker buildx build --platform linux/amd64,linux/arm64 -f aptos/Dockerfile.base -t ghcr.io/wormhole-foundation/aptos:3.1.0 .
docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile.base -t ghcr.io/wormhole-foundation/aptos:4.5.0 .
```

<!-- cspell:enable -->

# push to ghcr

```bash
docker push ghcr.io/wormhole-foundation/aptos:3.1.0
docker push ghcr.io/wormhole-foundation/aptos:4.5.0
```
2 changes: 1 addition & 1 deletion aptos/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM cli-gen AS cli-export
FROM const-gen AS const-export
FROM ghcr.io/wormhole-foundation/aptos:3.1.0@sha256:f66c2b5fea4a75050d051a5260ef643f52f5048d473877f1760be39d9e460d6b AS aptos
FROM ghcr.io/wormhole-foundation/aptos:4.5.0@sha256:27293dfbe0d5a284964c9f72a81d957abddf3b8936c060bccaa54e48db262be4 AS aptos

# Install nodejs
# todo(aki): move this into base image?
Expand Down
3 changes: 1 addition & 2 deletions aptos/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ WORKDIR /tmp
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:2cd5c8517d0640bd287b2cfb4c0e62f1a8ed86174764d88280bc2a106d6835db 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
15 changes: 13 additions & 2 deletions aptos/wormhole/sources/wormhole.move
Original file line number Diff line number Diff line change
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_framework::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
Loading

0 comments on commit def6c33

Please sign in to comment.