Skip to content

Commit 9832735

Browse files
committed
Merge branch 'master' into llm-template
2 parents b77da2c + 99a61aa commit 9832735

19 files changed

Lines changed: 240 additions & 354 deletions

.github/workflows/build_and_test.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ jobs:
2929
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
3030
rustup update
3131
cargo install wasm-tools
32-
rustup install nightly
3332
rustup target add wasm32-wasip1
34-
rustup target add wasm32-wasip1 --toolchain nightly
3533
cargo install cargo-wasi
3634
- name: Get latest release from foundry-rs/foundry
3735
id: get-latest-foundry-release
@@ -62,28 +60,10 @@ jobs:
6260
}
6361
return asset.browser_download_url;
6462
result-encoding: string
65-
#- name: Get latest release from hyperware-ai/hyperdrive
66-
# id: get-latest-hyperdrive-release
67-
# uses: actions/github-script@v6
68-
# with:
69-
# script: |
70-
# const repo = {
71-
# owner: 'hyperware-ai',
72-
# repo: 'hyperdrive',
73-
# };
74-
# const release = await github.rest.repos.getLatestRelease(repo);
75-
# const asset = release.data.assets.find(asset => asset.name.match(/hyperdrive-x86_64-unknown-linux-gnu\.zip/));
76-
# if (!asset) {
77-
# throw new Error('Asset not found');
78-
# }
79-
# return asset.browser_download_url;
80-
# result-encoding: string
81-
#- name: Download the Hyperdrive release
82-
# run: wget -q ${DOWNLOAD_URL} -O hyperdrive.zip
83-
# env:
84-
# DOWNLOAD_URL: ${{ steps.get-latest-hyperdrive-release.outputs.result }}
85-
#- name: Unzip the Hyperdrive release
86-
# run: unzip hyperdrive.zip
63+
- name: Build the release
64+
run: ./scripts/build-release.py
65+
- name: Unzip the build output
66+
run: unzip /tmp/kit-release/kit-x86_64-unknown-linux-gnu.zip
8767
- name: Run tests
8868
run: |
8969
{ ./kit t src/new/templates/tests.toml; } 2>&1

src/boot_fake_node/mod.rs

Lines changed: 36 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn extract_zip(archive_path: &Path) -> Result<()> {
7777
}
7878

7979
#[instrument(level = "trace", skip_all)]
80-
pub fn compile_runtime(path: &Path, release: bool, is_simulation_mode: bool) -> Result<()> {
80+
fn compile_runtime(path: &Path, release: bool, is_simulation_mode: bool) -> Result<()> {
8181
info!("Compiling Hyperdrive...");
8282

8383
// build the packages
@@ -174,10 +174,7 @@ pub fn get_platform_runtime_name(is_simulation_mode: bool) -> Result<String> {
174174
}
175175

176176
#[instrument(level = "trace", skip_all)]
177-
pub async fn get_runtime_binary(
178-
version: &str,
179-
is_simulation_mode: bool,
180-
) -> Result<(PathBuf, String)> {
177+
async fn get_runtime_binary(version: &str, is_simulation_mode: bool) -> Result<PathBuf> {
181178
let zip_name = get_platform_runtime_name(is_simulation_mode)?;
182179

183180
let version = if version != "latest" {
@@ -214,7 +211,36 @@ pub async fn get_runtime_binary(
214211
get_runtime_binary_inner(&version, &zip_name, &runtime_dir).await?;
215212
}
216213

217-
Ok((runtime_path, version))
214+
Ok(runtime_path)
215+
}
216+
217+
#[instrument(level = "trace", skip_all)]
218+
pub async fn get_or_build_runtime_binary(
219+
version: &str,
220+
is_simulation_mode: bool,
221+
runtime_path: Option<PathBuf>,
222+
is_release: bool,
223+
) -> Result<PathBuf> {
224+
let runtime_path = match runtime_path {
225+
None => get_runtime_binary(&version, is_simulation_mode).await?,
226+
Some(runtime_path) => {
227+
if !runtime_path.exists() {
228+
return Err(eyre!("--runtime-path {:?} does not exist.", runtime_path));
229+
}
230+
let runtime_path = if runtime_path.is_dir() {
231+
// Compile the runtime binary
232+
compile_runtime(&runtime_path, is_release, is_simulation_mode)?;
233+
runtime_path
234+
.join("target")
235+
.join(if is_release { "release" } else { "debug" })
236+
.join("hyperdrive")
237+
} else {
238+
runtime_path
239+
};
240+
runtime_path
241+
}
242+
};
243+
Ok(runtime_path)
218244
}
219245

220246
#[instrument(level = "trace", skip_all)]
@@ -425,46 +451,8 @@ pub async fn execute(
425451
verbosity: u8,
426452
mut args: Vec<String>,
427453
) -> Result<()> {
428-
println!("a");
429454
let detached = false; // TODO: to argument?
430-
// TODO: factor out with run_tests?
431-
let (runtime_path, version) = match runtime_path {
432-
None => get_runtime_binary(&version, true).await?,
433-
Some(runtime_path) => {
434-
println!("b");
435-
if !runtime_path.exists() {
436-
return Err(eyre!("--runtime-path {:?} does not exist.", runtime_path));
437-
}
438-
let runtime_path = if runtime_path.is_dir() {
439-
// Compile the runtime binary
440-
compile_runtime(&runtime_path, release, true)?;
441-
runtime_path
442-
.join("target")
443-
.join(if release { "release" } else { "debug" })
444-
.join("hyperdrive")
445-
} else {
446-
runtime_path
447-
};
448-
let Some((output, _)) = build::run_command(
449-
Command::new("bash").args(["-c", &format!("{} --version", runtime_path.display())]),
450-
false,
451-
)?
452-
else {
453-
return Err(eyre!("couldn't get Hyperdrive version"));
454-
};
455-
let version = output
456-
.split('\n')
457-
.nth(0)
458-
//.rev()
459-
//.nth(1)
460-
.unwrap()
461-
.split(' ')
462-
.last()
463-
.unwrap();
464-
(runtime_path, version.to_string())
465-
}
466-
};
467-
let version = version.strip_prefix("v").unwrap_or_else(|| &version);
455+
let runtime_path = get_or_build_runtime_binary(&version, true, runtime_path, release).await?;
468456

469457
let mut task_handles = Vec::new();
470458

@@ -495,18 +483,12 @@ pub async fn execute(
495483
let _cleanup_context = CleanupContext::new(send_to_cleanup_for_cleanup);
496484

497485
if !fake_node_name.contains(".") {
498-
fake_node_name.push_str(".dev");
486+
fake_node_name.push_str(".os");
499487
}
500488

501489
// boot fakechain
502-
let version = version.parse()?;
503-
let anvil_process = chain::start_chain(
504-
fakechain_port,
505-
recv_kill_in_start_chain,
506-
Some(version),
507-
false,
508-
)
509-
.await?;
490+
let anvil_process =
491+
chain::start_chain(fakechain_port, recv_kill_in_start_chain, false, false).await?;
510492

511493
if let Some(rpc) = rpc {
512494
args.extend_from_slice(&["--rpc".into(), rpc.into()]);

src/boot_real_node/mod.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::path::PathBuf;
22
use std::sync::Arc;
33

4-
use color_eyre::eyre::{eyre, Result};
4+
use color_eyre::eyre::Result;
55
use tokio::sync::Mutex;
66
use tracing::instrument;
77

8-
use crate::boot_fake_node::{compile_runtime, get_runtime_binary, run_runtime};
8+
use crate::boot_fake_node::{get_or_build_runtime_binary, run_runtime};
99
use crate::run_tests::cleanup::{cleanup, cleanup_on_signal};
1010
use crate::run_tests::types::*;
1111

@@ -22,28 +22,7 @@ pub async fn execute(
2222
mut args: Vec<String>,
2323
) -> Result<()> {
2424
let detached = false; // TODO: to argument?
25-
// TODO: factor out with run_tests?
26-
let runtime_path = match runtime_path {
27-
None => {
28-
let (runtime_path, _) = get_runtime_binary(&version, false).await?;
29-
runtime_path
30-
}
31-
Some(runtime_path) => {
32-
if !runtime_path.exists() {
33-
return Err(eyre!("--runtime-path {:?} does not exist.", runtime_path));
34-
}
35-
if runtime_path.is_dir() {
36-
// Compile the runtime binary
37-
compile_runtime(&runtime_path, release, false)?;
38-
runtime_path
39-
.join("target")
40-
.join(if release { "release" } else { "debug" })
41-
.join("hyperdrive")
42-
} else {
43-
runtime_path
44-
}
45-
}
46-
};
25+
let runtime_path = get_or_build_runtime_binary(&version, false, runtime_path, release).await?;
4726

4827
let mut task_handles = Vec::new();
4928

src/build/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ async fn compile_rust_wasm_process(
930930

931931
// Build the module using Cargo
932932
let mut args = vec![
933+
"+stable",
933934
"build",
934935
"--release",
935936
"--no-default-features",

src/chain/bytecode/deploy-hyperaccount-9char-commit-minter.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/chain/bytecode/deploy-hyperaccount-minter.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/chain/bytecode/deploy-hyperaccount-permissioned-minter.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/chain/bytecode/deploykinoaccountminter.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)