Skip to content

Commit

Permalink
Merge branch 'main' into mustidev/retry_for_da_http_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
musitdev committed Feb 20, 2025
2 parents 0e89e5a + 4694590 commit 6529c75
Show file tree
Hide file tree
Showing 30 changed files with 335 additions and 187 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-push-containers-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ jobs:

- name: Read the commit SHA
id: vars
run: echo "CONTAINER_REV=${{ github.ref }}" >> .env
run: |
commit_hash=$(git rev-parse HEAD | cut -c1-7)
echo CONTAINER_REV=${commit_hash}
echo "CONTAINER_REV=${commit_hash}" >> .env
- name: Display .env file
run: cat .env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
-p move-rocks \
-p movement-types \
-p movement-config \
-p movement-celestia-da-util \
-p movement-da-util \
-p movement-signer-test
movement-full-node-local:
Expand Down
65 changes: 57 additions & 8 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ members = [
"util/signing/integrations/aptos",
"util/signing/providers/aws-kms",
"util/signing/providers/hashicorp-vault",
"util/signing/testing",
"demo/hsm",
"protocol-units/execution/maptos/framework/releases/*",
"protocol-units/execution/maptos/framework/migrations/*",
Expand Down Expand Up @@ -361,9 +362,9 @@ http-body-util = "0.1"
tap = "1.0.1"

# trying to pin diesel
diesel = { version = "2.2.4", features = ["postgres", "numeric", "r2d2"] }
diesel = { version = "2.2.7", features = ["postgres", "numeric", "r2d2"] }
diesel_migrations = { version = "2.2.0" }
bigdecimal = "0.4.0"
bigdecimal = "0.3"
num_cpus = "=1.16.0"
ahash = "=0.8.11"

Expand Down
3 changes: 3 additions & 0 deletions docker/build/movement-full-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ RUN rust_binary="./target/release/movement-full-node"; dest_dir="/tmp/runtime";

FROM alpine:latest

# Install dependencies: git
RUN apk add --no-cache git

# Copy the build artifact from the builder stage
COPY --from=builder /tmp/build/target/release/movement-full-node /app/movement-full-node
COPY --from=builder /tmp/runtime/nix/store /nix/store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
AWS_REGION: ${AWS_REGION:?AWS_REGION is not set}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
MOVEMENT_SYNC: ${MOVEMENT_SYNC:?MOVEMENT_SYNC is not set}
MOVEMENT_SYNC: ${MOVEMENT_SYNC}
MAYBE_RUN_LOCAL: "false"
RUST_LOG: info,aws_sdk_s3=debug
volumes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
setup:
environment:
MOVEMENT_SYNC: ${MOVEMENT_SYNC:?MOVEMENT_SYNC is not set}
MOVEMENT_SYNC: ${MOVEMENT_SYNC}
AWS_REGION: ${AWS_REGION:?AWS_REGION is not set}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

processes:

setup:
environment:
- "KNOWN_FRAMEWORK_RELEASE=elsa"

test-migrate-elsa-to-biarritz-rc1:
command: |
cargo run --bin movement-full-node admin bring-up elsa-to-biarritz-rc1 upgrade 0x1 0x2 0x3
depends_on:
movement-full-node:
condition: process_healthy
movement-faucet:
condition: process_healthy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ processes:

setup:
environment:
- "KNOWN_FRAMEWORK_RELEASE=biarritz-rc1"
- "KNOWN_FRAMEWORK_RELEASE=elsa"

test-migrate-elsa-to-biarritz-rc1:
command: |
Expand Down
10 changes: 6 additions & 4 deletions protocol-units/bridge/indexer-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ publish = { workspace = true }
rust-version = { workspace = true }

[dependencies]
diesel = { workspace = true, features = ["postgres", "numeric", "r2d2", "chrono"] }
diesel_migrations = { workspace = true }
bigdecimal = { workspace = true }
# Use specific version different from Aptos core one.
# Could use workplace version when Aptos core will have upgrade for a more recent version.
diesel = { version = "2.2.4", features = ["postgres", "numeric", "r2d2", "chrono"] }
diesel_migrations = { version = "2.2.0" }
bigdecimal = "0.4.0"

serde = { workspace = true }
bridge-util = { workspace = true }
bridge-config = { workspace = true }
anyhow = { workspace = true }
hex = { workspace = true }
chrono = { workspace = true }
Expand Down
5 changes: 2 additions & 3 deletions protocol-units/bridge/indexer-db/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::migrations::run_migrations;
use crate::models::*;
use crate::schema::*;
use bridge_config::Config;
use bridge_util::chains::bridge_contracts::BridgeContractEvent;
use bridge_util::types::BridgeTransferId;
use bridge_util::TransferActionType;
Expand All @@ -23,8 +22,8 @@ impl Client {
Self { conn }
}

pub fn from_bridge_config(config: &Config) -> Result<Self, anyhow::Error> {
let conn = PgConnection::establish(&config.indexer.indexer_url)
pub fn build_from_db_url(db_url: &str) -> Result<Self, anyhow::Error> {
let conn = PgConnection::establish(&db_url)
.map_err(|e| anyhow::anyhow!("Failed to connect to postgresql instance: {}", e))?;
Ok(Self::new(conn))
}
Expand Down
5 changes: 2 additions & 3 deletions protocol-units/bridge/indexer-db/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::client::Client;
use bridge_config::Config;
use bridge_util::chains::bridge_contracts::BridgeContractMonitoring;
use bridge_util::types::BridgeTransferId;
use bridge_util::TransferActionType;
Expand All @@ -16,7 +15,7 @@ pub async fn run_indexer_client<
SOURCE: Send + TryFrom<Vec<u8>> + std::clone::Clone + 'static + std::fmt::Debug,
TARGET: Send + TryFrom<Vec<u8>> + std::clone::Clone + 'static + std::fmt::Debug,
>(
config: Config,
db_url: String,
mut stream_source: impl BridgeContractMonitoring<Address = SOURCE>,
mut stream_target: impl BridgeContractMonitoring<Address = TARGET>,
_relayer_actions: Option<mpsc::Sender<(BridgeTransferId, TransferActionType)>>,
Expand All @@ -25,7 +24,7 @@ where
Vec<u8>: From<SOURCE>,
Vec<u8>: From<TARGET>,
{
let mut indexer_db_client = match Client::from_bridge_config(&config) {
let mut indexer_db_client = match Client::build_from_db_url(&db_url) {
Ok(mut client) => {
client.run_migrations()?;
client
Expand Down
7 changes: 6 additions & 1 deletion protocol-units/bridge/service/bin/start_indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ async fn main() -> Result<()> {
tracing::info!("Bridge Eth and Movement Inited. Starting bridge loop.");

// Start indexer
let indexer_jh = tokio::spawn(run_indexer_client(bridge_config, eth_stream, mvt_stream, None));
let indexer_jh = tokio::spawn(run_indexer_client(
bridge_config.indexer.indexer_url,
eth_stream,
mvt_stream,
None,
));

tokio::select! {
res = eth_healh_check_jh => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use maptos_framework_release_util::{
compiler::Compiler, Release, ReleaseBundleError, ReleaseSigner,
};
use std::fs;
use std::path::PathBuf;
use tempfile::tempdir;
use tracing::info;

Expand All @@ -19,26 +18,15 @@ where
R: Release + Debug,
{
pub wrapped_release: R,
pub repo: &'static str,
pub commit_hash: &'static str,
pub bytecode_version: u32,
pub framework_local_dir: Option<PathBuf>,
pub features: Features,
}

impl<R> SetFeatureFlags<R>
where
R: Release + Debug,
{
pub fn new(
wrapped_release: R,
repo: &'static str,
commit_hash: &'static str,
bytecode_version: u32,
framework_local_dir: Option<PathBuf>,
features: Features,
) -> Self {
Self { wrapped_release, repo, commit_hash, bytecode_version, framework_local_dir, features }
pub fn new(wrapped_release: R, features: Features) -> Self {
Self { wrapped_release, features }
}

/// Generates the bytecode for the feature flag proposal.
Expand All @@ -64,13 +52,7 @@ where
println!("file: {:?}", file.path());
}

let compiler = Compiler::new(
self.repo,
self.commit_hash,
self.bytecode_version,
self.framework_local_dir.clone(),
);

let compiler = Compiler::movement();
let bytecode = compiler
.compile_in_temp_dir_to_bytecode("feature_flags", &feature_flags_script_path)
.map_err(|e| ReleaseBundleError::Build(e.into()))?;
Expand Down Expand Up @@ -218,14 +200,7 @@ macro_rules! generate_feature_upgrade_module {
let features = $features_stanza;

Self {
with_features: SetFeatureFlags::new(
super::$struct_name::new(),
"null",
"null",
6,
Some(aptos_framework_path()), // just use the path to the framework for the feature flag
features,
),
with_features: SetFeatureFlags::new(super::$struct_name::new(), features),
}
}
}
Expand Down
Loading

0 comments on commit 6529c75

Please sign in to comment.