Skip to content

Commit

Permalink
Merge branch 'main' into radu-fix-build-labeled-only
Browse files Browse the repository at this point in the history
  • Loading branch information
radupopa369 committed Mar 6, 2025
2 parents 6bba899 + 88d12fb commit 6c3354c
Show file tree
Hide file tree
Showing 44 changed files with 336 additions and 112 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/checks-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,34 @@ jobs:
nix develop --command bash -c "just movement-full-node native build.setup.eth-holesky.celestia-local.test -t=false"
nix develop --command bash -c "just movement-full-node native build.setup.eth-holesky.celestia-local.test -t=false"
# Elsa to Biarritz RC1
movement-elsa-to-biarritz-rc1-bring-up:
if: github.event.label.name == 'cicd:movement-elsa-to-biarritz-rc1' || github.ref == 'refs/heads/main'

strategy:
matrix:
include:
- os: ubuntu-22.04
arch: x86_64
runs-on: buildjet-16vcpu-ubuntu-2204

runs-on: ${{ matrix.runs-on }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Run Movement Full Node Gas DoS Test
env:
CELESTIA_LOG_LEVEL: FATAL # adjust the log level while debugging
run: |
nix develop --command bash -c "just movement-full-node native build.setup.eth-local.celestia-local.gas-dos -t=false"
movement-celestia-da-light-node:
if: false # this is effectively tested by the above
strategy:
Expand Down
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ services:
container_name: celestia-light-node
command: |
celestia light start
--core.ip rpc.celestia.pops.one
--core.ip consensus.celestia.mainnet.movementinfra.xyz
--core.port 9090
--rpc.addr 0.0.0.0
--p2p.network celestia
--node.store /.movement/celestia/movement/.celestia-light
--keyring.backend test
Expand All @@ -35,6 +37,8 @@ services:
environment:
- NODE_TYPE=light
- P2P_NETWORK=celestia
- NODE_STORE=/.movement/celestia/movement/.celestia-light
user: root:root
volumes:
- ${DOT_MOVEMENT_PATH}/celestia:/.movement/celestia
ports:
Expand All @@ -43,5 +47,5 @@ services:
setup:
condition: service_healthy
healthcheck:
test: "celestia node info"
test: "nc -zv 0.0.0.0 26658"
restart: on-failure:3
30 changes: 20 additions & 10 deletions networks/movement/indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ fn main() -> Result<(), anyhow::Error> {
None
};

// ANS processor.
let ans_indexer_config = build_processor_conf(
"ans_processor
ans_v1_primary_names_table_handle: temp
ans_v1_name_records_table_handle: temp
ans_v2_contract_address: 0x67bf15b3eed0fc62deea9630bbbd1d48842550655140f913699a1ca7e6f727d8",
&maptos_config,
)?;

let num_cpus = num_cpus::get();
let worker_threads = (num_cpus * RUNTIME_WORKER_MULTIPLIER).max(16);
println!(
Expand Down Expand Up @@ -94,6 +103,7 @@ fn main() -> Result<(), anyhow::Error> {
set.spawn(async move { token_indexer_config.run().await });
set.spawn(async move { tokenv2_indexer_config.run().await });
}
set.spawn(async move { ans_indexer_config.run().await });

while let Some(res) = set.join_next().await {
tracing::error!("An Error occurs during indexer execution: {res:?}");
Expand Down Expand Up @@ -122,33 +132,33 @@ fn build_processor_conf(
.map(|t| t.parse().unwrap_or(10))
.unwrap_or(10);

// If the starting version is not defined, don't put a default value in the conf.
let starting_version_entry = std::env::var("INDEXER_STARTING_VERSION")
.map(|t| t.parse().unwrap_or(0))
.map(|t| format!("starting_version: {}", t))
.unwrap_or(String::new());

//create config file
let indexer_config_content = format!(
let mut indexer_config_content = format!(
"processor_config:
type: {}
postgres_connection_string: {}
indexer_grpc_data_service_address: {}
indexer_grpc_http2_ping_interval_in_secs: {}
indexer_grpc_http2_ping_timeout_in_secs: {}
auth_token: \"{}\"
default_sleep_time_between_request: {}
{}",
default_sleep_time_between_request: {}",
processor_name,
maptos_config.indexer_processor.postgres_connection_string,
indexer_grpc_data_service_address,
maptos_config.indexer.maptos_indexer_grpc_inactivity_timeout,
maptos_config.indexer.maptos_indexer_grpc_inactivity_ping_interval,
maptos_config.indexer_processor.indexer_processor_auth_token,
default_sleep_time_between_request,
starting_version_entry,
);

// If the starting version is not defined, don't put a default value in the conf.
if let Ok(start_version) = std::env::var("INDEXER_STARTING_VERSION") {
if let Ok(start_version) = start_version.parse::<u64>() {
indexer_config_content.push('\n');
indexer_config_content.push_str(&format!("starting_version: {}", start_version));
}
}

//let indexer_config_path = dot_movement.get_path().join("indexer_config.yaml");
let mut output_file = tempfile::NamedTempFile::new()?;
write!(output_file, "{}", indexer_config_content)?;
Expand Down
4 changes: 4 additions & 0 deletions networks/movement/movement-full-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ movement-signer = { workspace = true }
movement-signer-loader = { workspace = true }
syncador = { workspace = true }
syncup = { workspace = true }
aptos-crypto = { workspace = true }
aptos-sdk = { workspace = true }
k256 = { workspace = true }
alloy-signer = { workspace = true }
chrono = { workspace = true }

[features]
Expand Down
5 changes: 5 additions & 0 deletions networks/movement/movement-full-node/src/admin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pub mod governed_gas_pool;
pub mod mcr;
pub mod ops;
pub mod rotate_key;
pub mod testkey;

use clap::Subcommand;

#[derive(Subcommand, Debug)]
Expand All @@ -24,6 +26,8 @@ pub enum Admin {
Framework(framework::Framework),
#[clap(subcommand)]
Config(config::Config),
#[clap(subcommand)]
TestKey(testkey::TestKey),
}

impl Admin {
Expand All @@ -36,6 +40,7 @@ impl Admin {
Admin::Ops(ops) => ops.execute().await,
Admin::Framework(framework) => framework.execute().await,
Admin::Config(config) => config.execute().await,
Admin::TestKey(key) => key.execute().await,
}
}
}
77 changes: 77 additions & 0 deletions networks/movement/movement-full-node/src/admin/testkey/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
use aptos_crypto::ed25519::Ed25519PublicKey;
use aptos_sdk::types::transaction::authenticator::AuthenticationKey;
use clap::Parser;
use clap::Subcommand;
use k256::ecdsa::VerifyingKey;
use movement_signer::cryptography::ed25519::Ed25519;
use movement_signer::cryptography::secp256k1::Secp256k1;
use movement_signer::key::TryFromCanonicalString;
use movement_signer::Signing;
use movement_signer::Verify;
use movement_signer_loader::identifiers::SignerIdentifier;
use movement_signer_loader::{Load, LoadedSigner};

#[derive(Subcommand, Debug)]
#[clap(rename_all = "kebab-case", about = "Commands to test key name")]
pub enum TestKey {
Ed25519(TestKeyParam),
Secp256k1(TestKeyParam),
}

impl TestKey {
pub async fn execute(&self) -> Result<(), anyhow::Error> {
match self {
TestKey::Ed25519(param) => param.execute_ed25519().await,
TestKey::Secp256k1(param) => param.execute_secp256k1().await,
}
}
}

#[derive(Debug, Parser, Clone)]
#[clap(rename_all = "kebab-case", about = "Key to test.")]
pub struct TestKeyParam {
#[clap(default_value = "{maptos,maptos-storage,movement-da-db}/**", value_name = "DB PATTERN")]
pub name: String,
}

impl TestKeyParam {
pub async fn execute_ed25519(&self) -> Result<(), anyhow::Error> {
let signer_identifier = SignerIdentifier::try_from_canonical_string(&self.name)
.map_err(|err| anyhow::anyhow!(err))?;
let loader: LoadedSigner<Ed25519> = signer_identifier.load().await?;

let public_key = Ed25519PublicKey::try_from(loader.public_key().await?.as_bytes())?;
let account_address = AuthenticationKey::ed25519(&public_key).account_address();

tracing::info!("Key loaded, account address:{account_address}");
tracing::info!("Try to sign a message ...");

let message = b"Hello, world!";
let signature = loader.sign(message).await?;
assert!(Ed25519::verify(message, &signature, &loader.public_key().await?)?);

tracing::info!("Message sign verify pass");

Ok(())
}
pub async fn execute_secp256k1(&self) -> Result<(), anyhow::Error> {
let signer_identifier = SignerIdentifier::try_from_canonical_string(&self.name)
.map_err(|err| anyhow::anyhow!(err))?;
let loader: LoadedSigner<Secp256k1> = signer_identifier.load().await?;
let pub_key = loader.public_key().await?;
let verify_key = VerifyingKey::from_sec1_bytes(pub_key.as_bytes())?;

let account_address = alloy_signer::utils::public_key_to_address(&verify_key);

tracing::info!("Key loaded, account address:{account_address}");
tracing::info!("Try to sign a message ...");

let message = b"Hello, world!";
let signature = loader.sign(message).await?;
assert!(Secp256k1::verify(message, &signature, &loader.public_key().await?)?);

tracing::info!("Message sign verify pass");

Ok(())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ impl StreamBlocks {
pub async fn execute(&self) -> Result<(), anyhow::Error> {
// Get the config

let mut client = MovementDaLightNodeClient::try_http1(self.light_node_url.as_str())
let mut client = MovementDaLightNodeClient::try_http2(self.light_node_url.as_str())
.await
.context("Failed to connect to light node")?;

let mut blocks_from_da = client
Expand Down
2 changes: 2 additions & 0 deletions networks/movement/movement-full-node/src/node/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ where
impl MovementPartialNode<Executor> {
pub async fn try_executor_from_config(config: Config) -> Result<Executor, anyhow::Error> {
let executor = Executor::try_from_config(config.execution_config.maptos_config.clone())
.await
.context("Failed to create the inner executor")?;
Ok(executor)
}
Expand Down Expand Up @@ -142,6 +143,7 @@ impl MovementPartialNode<Executor> {

debug!("Creating the executor");
let executor = Executor::try_from_config(config.execution_config.maptos_config.clone())
.await
.context("Failed to create the inner executor")?;

let (settlement_manager, commitment_events) = if config.mcr.should_settle() {
Expand Down
2 changes: 1 addition & 1 deletion process-compose/movement-full-node/process-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ processes:

movement-full-node:
command: |
movement-full-node run
RUST_BACKTRACE=1 movement-full-node run
depends_on:
movement-celestia-da-light-node:
condition: process_healthy
Expand Down
1 change: 1 addition & 0 deletions protocol-units/bridge/contracts/minter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
8 changes: 8 additions & 0 deletions protocol-units/bridge/contracts/minter/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "Minter"
version = "0.0.0"

[dependencies.AptosFramework]
git = "https://github.com/movementlabsxyz/aptos-core.git"
rev = "movement"
subdir = "aptos-move/framework/aptos-framework"
14 changes: 14 additions & 0 deletions protocol-units/bridge/contracts/minter/sources/minter.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
script {
use aptos_framework::aptos_governance;
use aptos_framework::transaction_fee;

fun main(core_resources: &signer) {

let core_signer = aptos_governance::get_signer_testnet_only(core_resources, @0x1);

let framework_signer = &core_signer;

transaction_fee::burn_from(framework_signer, @0xdead, 4);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async fn main() -> Result<(), anyhow::Error> {

// get the config file
let dot_movement = dot_movement::DotMovement::try_from_env()?;
let mut config_file = dot_movement.try_get_or_create_config_file().await?;
let config_file = dot_movement.try_get_or_create_config_file().await?;

// get a matching godfig object
let godfig: Godfig<CelestiaDaLightNodeConfig, ConfigFile> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main() -> Result<(), anyhow::Error> {
.init();

let dot_movement = dot_movement::DotMovement::try_from_env()?;
let mut config_file = dot_movement.try_get_or_create_config_file().await?;
let config_file = dot_movement.try_get_or_create_config_file().await?;

// get a matching godfig object
let godfig: Godfig<CelestiaDaLightNodeConfig, ConfigFile> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main() -> Result<(), anyhow::Error> {
.init();

let dot_movement = dot_movement::DotMovement::try_from_env()?;
let mut config_file = dot_movement.try_get_or_create_config_file().await?;
let config_file = dot_movement.try_get_or_create_config_file().await?;

// get a matching godfig object
let godfig: Godfig<CelestiaDaLightNodeConfig, ConfigFile> =
Expand Down
2 changes: 1 addition & 1 deletion protocol-units/da/movement/protocol/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rust-version = { workspace = true }

[dependencies]
movement-da-light-node-proto = { workspace = true, features = ["client"] }
tonic = { workspace = true}
tonic = { workspace = true, features = ["tls", "tls-webpki-roots"]}
tonic-web = { workspace = true }
hyper-util = { workspace = true }
tower = { workspace = true }
Expand Down
Loading

0 comments on commit 6c3354c

Please sign in to comment.