BPF SDK hotfix and devnet startup improvement (#196)
* Tiltfile: Make the guardian k8s_resource depend on solana-devnet This makes guardian network convergence faster as the guardian pods don't have to suffer from increasing redeploy back-off delays. This should impact performance neglibibly as solana-devnet is still the heaviest build we perform (at the time of this writing saturating a 32-thread Ryzen 9 CPU on my build machine.) * hotfix bpf-sdk: bump bpf-sdk; use cargo-build-bpf
This commit is contained in:
parent
bfa8a974e5
commit
6de425a990
2
Tiltfile
2
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]"),
|
||||
])
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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::<Error>();
|
||||
|
|
|
@ -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
|
||||
|
|
22
solana/do.sh
22
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"
|
||||
|
||||
# "$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
|
||||
|
||||
|
|
Loading…
Reference in New Issue