Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Feb 4, 2025
1 parent 1254d0d commit 7702cc8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ start-bcd-consumer-integration:
$(MAKE) -C contrib/images start-bcd-consumer-integration

test-e2e-bcd-consumer-integration: start-bcd-consumer-integration
@cd tests/e2e && go test -run TestBCDConsumerIntegrationTestSuite -mod=readonly -timeout=60m -v github.com/babylonlabs-io/babylon-sdk/tests/e2e --tags=e2e
@cd tests/e2e && go test -count 1 -run TestBCDConsumerIntegrationTestSuite -mod=readonly -timeout=60m -v github.com/babylonlabs-io/babylon-sdk/tests/e2e --tags=e2e
60 changes: 46 additions & 14 deletions contrib/images/ibcsim-bcd/setup-bcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@

display_usage() {
echo "Missing parameters. Please check if all parameters were specified."
echo "Usage: setup-bcd.sh [CHAIN_ID] [CHAIN_DIR] [RPC_PORT] [P2P_PORT] [PROFILING_PORT] [GRPC_PORT] [BABYLON_CONTRACT_CODE_FILE] [BTCSTAKING_CONTRACT_CODE_FILE] [BTCFINALITY_CONTRACT_CODE_FILE] [INSTANTIATING_CFG]"
echo "Example: setup-bcd.sh test-chain-id ./data 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm '{
"btc_confirmation_depth": 1,
"checkpoint_finalization_timeout": 2,
"network": "Regtest",
"babylon_tag": "01020304",
"notify_cosmos_zone": false,
"btc_staking_code_id": 2,
"btc_finality_code_id": 3
}'
"
echo "Usage: setup-bcd.sh [CHAIN_ID] [CHAIN_DIR] [RPC_PORT] [P2P_PORT] [PROFILING_PORT] [GRPC_PORT] [BABYLON_CONTRACT_CODE_FILE] [BTCSTAKING_CONTRACT_CODE_FILE] [BTCFINALITY_CONTRACT_CODE_FILE]"
echo "Example: setup-bcd.sh test-chain-id ./data 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm"
exit 1
}

Expand Down Expand Up @@ -44,7 +35,6 @@ GRPCPORT=$6
BABYLON_CONTRACT_CODE_FILE=$7
BTCSTAKING_CONTRACT_CODE_FILE=$8
BTCFINALITY_CONTRACT_CODE_FILE=$9
INSTANTIATING_CFG=${10}

# ensure the binary exists
if ! command -v $BINARY &>/dev/null; then
Expand Down Expand Up @@ -133,5 +123,47 @@ $BINARY --home $CHAINDIR/$CHAINID tx wasm store "$BTCFINALITY_CONTRACT_CODE_FILE
sleep 10

# Echo the command with expanded variables
echo "Instantiating contract $BABYLON_CONTRACT_CODE_FILE..."
$BINARY --home $CHAINDIR/$CHAINID tx wasm instantiate 1 "$INSTANTIATING_CFG" --admin=$(bcd --home $CHAINDIR/$CHAINID keys show user --keyring-backend test -a) --label "v0.0.1" $KEYRING --from user --chain-id $CHAINID --gas 20000000000 --gas-prices 0.001ustake --node http://localhost:$RPCPORT -y --amount 100000stake
echo "Instantiating contracts..."

FINALITY_MSG='{
"params": {
"max_active_finality_providers": 100,
"min_pub_rand": 1,
"finality_inflation_rate": "0.035",
"epoch_length": 10
}
}'

$BINARY --home $CHAINDIR/$CHAINID tx babylon instantiate-babylon-contracts 1 2 3 "Regtest" "01020304" 1 2 false "" $FINALITY_MSG test-consumer test-consumer-description --admin=$(bcd --home $CHAINDIR/$CHAINID keys show user --keyring-backend test -a) $KEYRING --from user --chain-id $CHAINID --gas 20000000000 --gas-prices 0.001ustake --node http://localhost:$RPCPORT -y --amount 100000stake

# FINALITY_MSG='{
# "params": {
# "max_active_finality_providers": 100,
# "min_pub_rand": 1,
# "finality_inflation_rate": "0.035",
# "epoch_length": 10
# }
# }'
# echo "btc-finality instantiation msg:"
# echo -n "$FINALITY_MSG" | jq '.'
# ENCODED_FINALITY_MSG=$(echo -n "$FINALITY_MSG" | base64 -w0)
# BABYLON_MSG="{
# \"network\": \"regtest\",
# \"babylon_tag\": \"01020304\",
# \"btc_confirmation_depth\": 1,
# \"checkpoint_finalization_timeout\": 2,
# \"notify_cosmos_zone\": false,
# \"btc_staking_code_id\": 2,
# \"consumer_name\": \"Test Consumer\",
# \"consumer_description\": \"Test Consumer Description\",
# \"btc_finality_code_id\": 3,
# \"btc_finality_msg\": \"$ENCODED_FINALITY_MSG\",
# \"transfer_info\": {
# \"channel_id\": \"channel-1\",
# \"recipient\": {
# \"module_addr\": \"zoneconcierge\"
# }
# }
# }"
# echo "babylon-contract instantiation msg:"
# echo -n "$BABYLON_MSG" | jq '.'
34 changes: 1 addition & 33 deletions contrib/images/ibcsim-bcd/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,7 @@ CONSUMER_KEY="bcd-key"
CONSUMER_CHAIN_ID="bcd-test"

# 1. Create a bcd testnet with Babylon contract
FINALITY_MSG='{
"params": {
"max_active_finality_providers": 100,
"min_pub_rand": 1,
"finality_inflation_rate": "0.035",
"epoch_length": 10
}
}'
echo "btc-finality instantiation msg:"
echo -n "$FINALITY_MSG" | jq '.'
ENCODED_FINALITY_MSG=$(echo -n "$FINALITY_MSG" | base64 -w0)
BABYLON_MSG="{
\"network\": \"regtest\",
\"babylon_tag\": \"01020304\",
\"btc_confirmation_depth\": 1,
\"checkpoint_finalization_timeout\": 2,
\"notify_cosmos_zone\": false,
\"btc_staking_code_id\": 2,
\"consumer_name\": \"Test Consumer\",
\"consumer_description\": \"Test Consumer Description\",
\"btc_finality_code_id\": 3,
\"btc_finality_msg\": \"$ENCODED_FINALITY_MSG\",
\"transfer_info\": {
\"channel_id\": \"channel-1\",
\"recipient\": {
\"module_addr\": \"zoneconcierge\"
}
}
}"
echo "babylon-contract instantiation msg:"
echo -n "$BABYLON_MSG" | jq '.'

./setup-bcd.sh $CONSUMER_CHAIN_ID $CONSUMER_CONF 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm "$BABYLON_MSG"
./setup-bcd.sh $CONSUMER_CHAIN_ID $CONSUMER_CONF 26657 26656 6060 9090 ./babylon_contract.wasm ./btc_staking.wasm ./btc_finality.wasm

sleep 5

Expand Down

0 comments on commit 7702cc8

Please sign in to comment.