Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/aptos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: aptos

on:
pull_request:

jobs:
test:
name: Aptos Test
runs-on: ubuntu-latest
# https://github.com/aptos-labs/aptos-core/releases/tag/aptos-cli-v7.2.0
# https://github.com/aptos-labs/aptos-core/commit/35102f5f33c69b8e48e030243a09edad80cbd946
container: aptoslabs/tools:devnet_35102f5f33c69b8e48e030243a09edad80cbd946@sha256:06503b21b53ad904c7d689c47a78259b4891fa0d1c6932550c784bddc0d3cda0
defaults:
run:
working-directory: aptos
steps:
- uses: actions/checkout@v4
- run: sh ci.sh
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Provide an execution framework and proof-of-concept (PoC) service for [Wormhole]

- [x] [EVM](./evm/)
- [x] [SVM](./svm/)
- [x] Sui Move
- [ ] Aptos Move
- [x] [Sui Move](./sui/)
- [x] [Aptos Move](./aptos/)

## Background

Expand Down
4 changes: 4 additions & 0 deletions aptos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*/.aptos
*/.coverage_map.mvcov
*/.trace
*/build
9 changes: 9 additions & 0 deletions aptos/DEPLOYMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Executor EVM Deployments

## Testnet

### April 24, 2025

Executor: [0x139717c339f08af674be77143507a905aa28cbc67a0e53e7095c07b630d73815](https://explorer.aptoslabs.com/account/0x139717c339f08af674be77143507a905aa28cbc67a0e53e7095c07b630d73815/modules/packages/executor?network=testnet)

Executor Requests: [0xf6cc46a85f8cac9852c62904f09ec7fc9d3fe41ff646913853bed2a992c1d6d7](https://explorer.aptoslabs.com/account/0xf6cc46a85f8cac9852c62904f09ec7fc9d3fe41ff646913853bed2a992c1d6d7/modules/packages/executor_requests?network=testnet)
60 changes: 60 additions & 0 deletions aptos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Aptos

The executor folder was generated with `aptos move init --name executor`.

This module was developed with aptos CLI `7.2.0`. It should generally match the Sui implementation with minor changes necessary for Aptos-specific implementation details.

> 💡 Note: The `payeeAddress` on the signed quote must be registered for `AptosCoin` before being able to receive payments.

## Development

[Move IDE Plugins](https://aptos.dev/en/build/smart-contracts#move-ide-plugins)

### Compile

```bash
aptos move compile --named-addresses executor=default
```

### Test

```bash
aptos move test --named-addresses executor=default
```

For coverage, add the `--coverage` flag.

```bash
aptos move test --coverage --named-addresses executor=default
```

### Deploy

First initialize the config, setting the desired network and deployment private key.

```bash
cd executor
aptos init
```

Then, publish the module immutably via a resource account.

<!-- cspell:disable -->

```bash
aptos move create-resource-account-and-publish-package --address-name executor --seed-encoding Utf8 --seed executorv1
```

<!-- cspell:enable -->

Repeat this with the `executor_requests` module.

<!-- cspell:disable -->

```bash
cd executor
aptos init
aptos move create-resource-account-and-publish-package --address-name executor_requests --named-addresses executor=<ADDRESS_FROM_PREVIOUS_STEP> --seed-encoding Utf8 --seed executor_requestsv1
```

<!-- cspell:enable -->
11 changes: 11 additions & 0 deletions aptos/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

cd executor
aptos init --skip-faucet
sh -c "aptos move test --coverage --named-addresses executor=default"
sh -c "aptos move coverage summary --named-addresses executor=default | grep \"Move Coverage: 100.00\""
cd ../executor_requests
aptos init --skip-faucet
sh -c "aptos move test --coverage --named-addresses executor=default,executor_requests=default"
sh -c "aptos move coverage summary --named-addresses executor=default,executor_requests=default | grep \"Move Coverage: 100.00\""
cd ..
2 changes: 2 additions & 0 deletions aptos/executor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.aptos/
build/
17 changes: 17 additions & 0 deletions aptos/executor/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "executor"
version = "1.0.0"
license = "Apache 2.0"
authors = ["Wormhole Labs"]

[addresses]
executor = "_"

[dev-addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-framework.git"
rev = "mainnet"
subdir = "aptos-framework"

[dev-dependencies]
62 changes: 62 additions & 0 deletions aptos/executor/sources/executor.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: Apache-2.0

module executor::executor {
use aptos_framework::aptos_coin::{AptosCoin};
use aptos_framework::coin::{Self, Coin};
use aptos_framework::event;
use aptos_std::from_bcs;
use executor::bytes;
use executor::cursor;

const CHAIN_ID: u16 = 22;

const E_QUOTE_SRC_CHAIN_MISMATCH: u64 = 0;
const E_QUOTE_DST_CHAIN_MISMATCH: u64 = 1;
const E_QUOTE_EXPIRED: u64 = 2;

#[event]
struct RequestForExecution has drop, store {
quoter_address: vector<u8>,
amt_paid: u64,
dst_chain: u16,
dst_addr: address,
refund_addr: address,
signed_quote: vector<u8>,
request_bytes: vector<u8>,
relay_instructions: vector<u8>,
}

public fun request_execution(
amount: Coin<AptosCoin>,
dst_chain: u16,
dst_addr: address, // akin to bytes32
refund_addr: address,
signed_quote_bytes: vector<u8>,
request_bytes: vector<u8>,
relay_instructions: vector<u8>
) {
let cursor = cursor::new(signed_quote_bytes);
bytes::take_bytes(&mut cursor, 4); // prefix
let quoter_address = bytes::take_bytes(&mut cursor, 20);
let payee_address = from_bcs::to_address(bytes::take_bytes(&mut cursor, 32));
let quote_src_chain = bytes::take_u16_be(&mut cursor);
assert!(quote_src_chain == CHAIN_ID, E_QUOTE_SRC_CHAIN_MISMATCH);
let quote_dst_chain = bytes::take_u16_be(&mut cursor);
assert!(quote_dst_chain == dst_chain, E_QUOTE_DST_CHAIN_MISMATCH);
let expiry_time = bytes::take_u64_be(&mut cursor);
assert!(expiry_time > aptos_framework::timestamp::now_seconds(), E_QUOTE_EXPIRED);
cursor::take_rest(cursor);
let amt_paid = coin::value<AptosCoin>(&amount);
coin::deposit(payee_address, amount);
event::emit(RequestForExecution {
quoter_address,
amt_paid,
dst_chain,
dst_addr,
refund_addr,
signed_quote: signed_quote_bytes,
request_bytes,
relay_instructions
});
}
}
Loading
Loading