diff --git a/Tiltfile b/Tiltfile index 1f29f798a..a7e3c6a34 100644 --- a/Tiltfile +++ b/Tiltfile @@ -83,7 +83,7 @@ def build_bridge_yaml(): k8s_yaml_with_ns(build_bridge_yaml()) -k8s_resource("guardian", resource_deps=["proto-gen"], port_forwards=[ +k8s_resource("guardian", resource_deps=["proto-gen", "solana-devnet"], port_forwards=[ port_forward(6060, name="Debug/Status Server [:6060]"), ]) diff --git a/solana/Dockerfile b/solana/Dockerfile index 64a3f7403..9afe3124d 100644 --- a/solana/Dockerfile +++ b/solana/Dockerfile @@ -6,11 +6,13 @@ RUN rustup component add rustfmt WORKDIR /usr/src/bridge +RUN sh -c "$(curl -sSfL https://release.solana.com/v1.5.5/install)" + +ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH" + COPY bpf-sdk-install.sh . COPY do.sh . -RUN ./do.sh update - COPY bridge bridge COPY agent agent COPY cli cli @@ -24,4 +26,4 @@ RUN --mount=type=cache,target=/usr/local,from=rust,source=/usr/local \ --mount=type=cache,target=bin,from=rust,source=bin \ ./do.sh build bridge && \ mkdir -p /opt/solana/deps && \ - cp target/bpfel-unknown-unknown/release/spl_bridge_debug.so /opt/solana/deps/spl_bridge.so + cp target/deploy/spl_bridge_debug.so /opt/solana/deps/spl_bridge.so diff --git a/solana/bridge/Cargo.toml b/solana/bridge/Cargo.toml index 27918b222..0eb1752da 100644 --- a/solana/bridge/Cargo.toml +++ b/solana/bridge/Cargo.toml @@ -10,15 +10,16 @@ license = "Apache-2.0" edition = "2018" [features] +default = ["program"] no-entrypoint = [] -program = ["spl-token/no-entrypoint"] +program = [] [dependencies] num-derive = "0.2" num-traits = "0.2" remove_dir_all = "=0.5.0" solana-program = "=1.5.5" -spl-token = { version = "=3.0.1" } +spl-token = { version = "=3.0.1", features = ["no-entrypoint"] } thiserror = "1.0" byteorder = "1.3.4" zerocopy = "0.3.0" diff --git a/solana/bridge/src/entrypoint.rs b/solana/bridge/src/entrypoint.rs index 5393f0f2b..8741abdc0 100644 --- a/solana/bridge/src/entrypoint.rs +++ b/solana/bridge/src/entrypoint.rs @@ -15,6 +15,7 @@ fn process_instruction<'a>( accounts: &'a [AccountInfo<'a>], instruction_data: &[u8], ) -> ProgramResult { + msg!("In bridge entrypoint"); if let Err(error) = Bridge::process(program_id, accounts, instruction_data) { // catch the error so we can print it error.print::(); diff --git a/solana/cli/src/main.rs b/solana/cli/src/main.rs index e9bb29417..f729e5f38 100644 --- a/solana/cli/src/main.rs +++ b/solana/cli/src/main.rs @@ -56,7 +56,7 @@ fn command_deploy_bridge( bridge: &Pubkey, initial_guardian: Vec<[u8; 20]>, ) -> CommmandResult { - println!("Deploying bridge program"); + println!("Deploying bridge program {}", bridge); let minimum_balance_for_rent_exemption = config .rpc_client diff --git a/solana/do.sh b/solana/do.sh index e0a4e2e5d..16954b62a 100755 --- a/solana/do.sh +++ b/solana/do.sh @@ -24,21 +24,22 @@ Supported projects: EOF } -sdkParentDir=bin -sdkDir="$sdkParentDir"/bpf-sdk -profile=bpfel-unknown-unknown/release +sdkDir=$HOME/.local/share/solana/install/active_release/bin/sdk/bpf +profile=deploy perform_action() { set -e + set -x projectDir="$PWD"/$2 targetDir=target case "$1" in build) - if [[ -f "$projectDir"/Xargo.toml ]]; then - "$sdkDir"/rust/build.sh "$projectDir" - + if [[ -f "$projectDir"/Xargo.toml ]]; then + # "$sdkDir"/rust/build.sh "$projectDir" so_path="$targetDir/$profile" + cargo build-bpf --manifest-path "$projectDir/Cargo.toml" files=`find $so_path -maxdepth 1 -type f \! -name "*_debug.so" -name "*.so"` + echo "pwd: $PWD" for file in $files do cp $file ${file/.so/_debug.so} # Copy with rename @@ -134,10 +135,10 @@ perform_action() { cargo test --features=program ${@:3} ) ;; - update) - mkdir -p $sdkParentDir - ./bpf-sdk-install.sh $sdkParentDir - ;; + # update) + # mkdir -p $sdkParentDir + # ./bpf-sdk-install.sh $sdkParentDir + # ;; *) echo "Error: Unknown command" usage @@ -156,7 +157,8 @@ else exit fi if [[ ! -d "$sdkDir" ]]; then - ./do.sh update + true + # ./do.sh update fi fi