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

[forge] Framework upgrade test all proposals #14023

Merged
merged 1 commit into from
Jul 17, 2024
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
!**/*.errmap
!config/src/config/test_data
!aptos-move/aptos-gas-profiling/templates/
!aptos-move/aptos-release-builder/data/release.yaml
!aptos-move/aptos-release-builder/data/*.yaml
!aptos-move/aptos-release-builder/data/proposals/*
!aptos-move/framework/
!aptos-move/move-examples/hello_blockchain/
Expand Down
7 changes: 6 additions & 1 deletion crates/aptos-build-info/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ fn main() -> shadow_rs::SdResult<()> {
std::env::var("CARGO_CFG_TOKIO_UNSTABLE").is_ok()
);
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=../../.git/HEAD");
// Check for this path first, otherwise it will force a rebuild every time
// https://github.com/rust-lang/cargo/issues/4213
let git_head = std::path::Path::new("../../.git/HEAD");
if git_head.exists() {
println!("cargo:rerun-if-changed=../../.git/HEAD");
}
shadow_rs::new()
}
1 change: 1 addition & 0 deletions docker/builder/forge.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ENV PATH "$PATH:/root/bin"

WORKDIR /aptos
COPY --link --from=node-builder /aptos/dist/forge /usr/local/bin/forge

### Get Aptos Framework Release for forge framework upgrade testing
COPY --link --from=tools-builder /aptos/aptos-move/framework/ /aptos/aptos-move/framework/
COPY --link --from=tools-builder /aptos/aptos-move/aptos-release-builder/ /aptos/aptos-move/aptos-release-builder/
Expand Down
37 changes: 33 additions & 4 deletions testsuite/testcases/src/framework_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ use aptos_forge::{
};
use aptos_keygen::KeyGen;
use aptos_logger::info;
use aptos_release_builder::ReleaseConfig;
use aptos_sdk::crypto::{ed25519::Ed25519PrivateKey, PrivateKey};
use aptos_temppath::TempPath;
use aptos_types::transaction::authenticator::AuthenticationKey;
use async_trait::async_trait;
use std::ops::DerefMut;
use tokio::time::Duration;
use std::{ops::DerefMut, path::Path};
use tokio::{fs, time::Duration};

pub struct FrameworkUpgrade;

Expand All @@ -28,6 +29,16 @@ impl Test for FrameworkUpgrade {
}
}

const RELEASE_YAML_PATH: &str = "aptos-move/aptos-release-builder/data";
const IGNORED_YAMLS: [&str; 2] = ["release.yaml", "example.yaml"];

fn is_release_yaml(path: &Path) -> bool {
let basename = path.file_name().unwrap().to_str().unwrap();
path.is_file()
&& path.extension().unwrap_or_default() == "yaml"
&& !IGNORED_YAMLS.contains(&basename)
}

#[async_trait]
impl NetworkTest for FrameworkUpgrade {
async fn run<'a>(&self, ctx: NetworkContextSynchronizer<'a>) -> Result<()> {
Expand Down Expand Up @@ -126,8 +137,26 @@ impl NetworkTest for FrameworkUpgrade {

let release_config = aptos_release_builder::current_release_config();

aptos_release_builder::validate::validate_config(release_config.clone(), network_info)
.await?;
aptos_release_builder::validate::validate_config(
release_config.clone(),
network_info.clone(),
)
.await?;

// Execute all the release yaml files
let mut entries = fs::read_dir(RELEASE_YAML_PATH).await?;
while let Some(entry) = entries.next_entry().await? {
let path = entry.path();
if is_release_yaml(&path) {
let release_config = ReleaseConfig::parse(&fs::read_to_string(&path).await?)?;
info!("Executing release yaml: {}", path.to_string_lossy());
aptos_release_builder::validate::validate_config(
release_config.clone(),
network_info.clone(),
)
.await?;
}
}

// Update the sequence number for the root account
let root_account = { ctx.swarm.read().await.chain_info().root_account().address() };
Expand Down
Loading