wormhole-icco/solana/modules/icco_contributor
Drew 6b2e573558 Hello, world! 2022-04-22 16:16:56 +00:00
..
client Hello, world! 2022-04-22 16:16:56 +00:00
program Hello, world! 2022-04-22 16:16:56 +00:00
token-metadata Hello, world! 2022-04-22 16:16:56 +00:00
Cargo.lock Hello, world! 2022-04-22 16:16:56 +00:00
Cargo.toml Hello, world! 2022-04-22 16:16:56 +00:00
README.md Hello, world! 2022-04-22 16:16:56 +00:00
contributor_id.json Hello, world! 2022-04-22 16:16:56 +00:00

README.md

local check For tilt devnet:

build using:

from: wormhole-icco/solana/modules/icco_contributor
EMITTER_ADDRESS="11111111111111111111111111111115" BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" cargo check
or
EMITTER_ADDRESS="11111111111111111111111111111115" BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" cargo build
or
EMITTER_ADDRESS="11111111111111111111111111111115" BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" cargo build-bpf

Buid or check wasm build:

from: wormhole-icco/solana/modules/icco_contributor/program
#EMITTER_ADDRESS="11111111111111111111111111111115" BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" wasm-pack build --target bundler -d bundler -- --features wasm
EMITTER_ADDRESS="11111111111111111111111111111115" BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" wasm-pack build --target nodejs -d node -- --features wasm
cp node/* ../../../../sdk/js/src/solana/icco_contributor-node/

To add building and deployement of icco_contributor to tilt:

wormhole-icco/devnet/solana-devnet.yaml
add
            - --bpf-program
            - 22mamxmojFWBdbGqaxTH46HBAgAY2bJRiGJJHfNRNQ95
            - /opt/solana/deps/icco_contributor.so


wormhole-icco/solana/Dockerfile.wasm (wasm building)
add:
# Compile icco_contributor
RUN --mount=type=cache,target=/root/.cache \
	--mount=type=cache,target=modules/icco_contributor/target \
    cd modules/icco_contributor/program && /usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \
    cd bundler && sed -i $SED_REMOVE_INVALID_REFERENCE icco_contributor_bg.js

RUN --mount=type=cache,target=/root/.cache \
	--mount=type=cache,target=modules/icco_contributor/target \
    cd modules/icco_contributor/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked

COPY --from=build /usr/src/bridge/modules/icco_contributor/program/bundler sdk/js/src/solana/icco_contributor
COPY --from=build /usr/src/bridge/modules/icco_contributor/program/nodejs sdk/js/src/solana/icco_contributor-node


wormhole-icco/solana/Dockerfile (bpf contract building)
add following lines to appropriate places in RUN command:
    --mount=type=cache,target=modules/icco_contributor/target \
    cargo build-bpf --manifest-path "modules/icco_contributor/program/Cargo.toml" -- --locked && \
    cp modules/icco_contributor/target/deploy/icco_contributor.so /opt/solana/deps/icco_contributor.so && \

OPTIONALLY - Deploying contributor contract to tilt devnet with new address:

wormhole-icco/solana/ directory:

0. Need to do every time tilt reloads Solana node..  Copy secret key and contract Id key to tilt.
kubectl cp -c devnet keys/solana-devnet.json  solana-devnet-0:/root/.config/solana/id.json
kubectl cp -c devnet modules/icco_contributor/contributor_id.json  solana-devnet-0:/usr/src/

1. Copy locally built bpf to tilt
kubectl cp -c devnet modules/icco_contributor/target/deploy/icco_contributor.so solana-devnet-0:/usr/src/

2. deploy to solana devnet
kubectl exec -c devnet solana-devnet-0 -- solana program deploy -u l --program-id=/usr/src/contributor_id.json /usr/src/icco_contributor.so
// returns Program Id: 5yrpFgtmiBkRmDgveVErMWuxC25eK5QE5ouZgfi46aqM

kubectl exec -c devnet solana-devnet-0 -- solana program deploy -u l /usr/src/icco_contributor.so       // This makes new contract address every time

to register coreBridge and conductor run the following from solana/ ./modules/icco_contributor/target/debug/client create-bridge 5yrpFgtmiBkRmDgveVErMWuxC25eK5QE5ouZgfi46aqM B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE addresses are: contributor, coreBridge, Conductor(fake for now)