Skip to content

Commit

Permalink
Standardize variables for deployment (#928)
Browse files Browse the repository at this point in the history
* renamed statemine to asset hub and allow agent id overrides

* fix unbound variable

* upgrade contract hash change

* update variables
  • Loading branch information
alistair-singh authored Aug 22, 2023
1 parent d1590d0 commit 8b8f1b5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion smoketest/tests/upgrade_gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const BRIDGE_HUB_PARA_ID: u32 = 1013;
const GATEWAY_PROXY_CONTRACT: &str = "0xEDa338E4dC46038493b885327842fD3E301CaB39";
const GATETWAY_UPGRADE_MOCK_CONTRACT: [u8; 20] = hex!("f8f7758fbcefd546eaeff7de24aff666b6228e73");
const GATETWAY_UPGRADE_MOCK_CODE_HASH: [u8; 32] =
hex!("9ed4c5736e9322ae52d21856271c96e1c130477bce199fb4a35679866ce2a657");
hex!("ad2eaa7103b39aea14dac05981ce0ff31a8f51267eaf2a0e480c94159afc904f");

#[tokio::test]
async fn upgrade_gateway() {
Expand Down
2 changes: 1 addition & 1 deletion web/packages/test/.envrc-example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source_up_if_exists
# export BEEFY_START_BLOCK= # Start block to configure beefy client, default value: 1
# export RELAYCHAIN_ENDPOINT= # Relaychain endpoint, default value: ws://localhost:9944
# export PARACHAIN_RUNTIME= # Runtime type of parachain should be one of snowbase|snowblink|snowbridge
# export BRIDGEHUB_PALLETS_OWNER= # Pubkey of bridge owner that can halt/resume the bridge pallets, default value: 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d (Alice test account)
# export BRIDGE_HUB_PALLETS_OWNER= # Pubkey of bridge owner that can halt/resume the bridge pallets, default value: 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d (Alice test account)


## Eth config for production
Expand Down
6 changes: 3 additions & 3 deletions web/packages/test/scripts/configure-bridgehub-owner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ config_pallet_owner()
local pallet="30"
local callindex="03"
local payload="0x$pallet$callindex$option$owner"
send_governance_transact_from_relaychain $bridgehub_para_id "$payload"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$payload"

# config owner of outbound queue
local pallet="31"
local callindex="00"
local payload="0x$pallet$callindex$option$owner"
send_governance_transact_from_relaychain $bridgehub_para_id "$payload"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$payload"

# config owner of beacon client owner
local pallet="32"
local callindex="03"
local payload="0x$pallet$callindex$option$owner"
send_governance_transact_from_relaychain $bridgehub_para_id "$payload"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$payload"
}


Expand Down
6 changes: 3 additions & 3 deletions web/packages/test/scripts/configure-bridgehub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config_beacon_checkpoint()
pushd $root_dir
local check_point_call=$($relay_bin generate-beacon-checkpoint --spec $active_spec --url $beacon_endpoint_http)
popd
send_governance_transact_from_relaychain $bridgehub_para_id "$check_point_call" 180000000000 900000
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$check_point_call" 180000000000 900000
}

config_inbound_queue()
Expand All @@ -18,7 +18,7 @@ config_inbound_queue()
local callindex="01"
local payload="0x$pallet$callindex$(address_for GatewayProxy | tr "[:upper:]" "[:lower:]" | cut -c3-)"

send_governance_transact_from_relaychain $bridgehub_para_id "$payload"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$payload"
}

wait_beacon_chain_ready()
Expand All @@ -36,7 +36,7 @@ wait_beacon_chain_ready()
fund_accounts()
{
echo "Funding substrate accounts"
transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $statemine_sovereign_account
transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $assethub_sovereign_account
transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $beacon_relayer_pub_key
transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $execution_relayer_pub_key
transfer_balance $relaychain_ws_url "//Charlie" 1000 1000000000000000 $gateway_contract_sovereign_account
Expand Down
26 changes: 11 additions & 15 deletions web/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ basic_eth_addresses="${BASIC_ETH_ADDRESSES:-0x89b4ab1ef20763630df9743acf15586560
beacon_endpoint_http="${BEACON_HTTP_ENDPOINT:-http://127.0.0.1:9596}"

# Local substrate chain endpoints
bridgehub_ws_url="${BRIDGEHUB_WS_URL:-ws://127.0.0.1:11144}"
bridgehub_para_id="${BRIDGEHUB_PARA_ID:-1013}"
bridgehub_seed="${BRIDGEHUB_SEED:-//Alice}"
bridgehub_pallets_owner="${BRIDGEHUB_PALLETS_OWNER:-0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d}"
bridgehub_ws_url="${BRIDGE_HUB_WS_URL:-ws://127.0.0.1:11144}"
bridgehub_seed="${BRIDGE_HUB_SEED:-//Alice}"
bridgehub_pallets_owner="${BRIDGE_HUB_PALLETS_OWNER:-0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d}"
export BRIDGE_HUB_PARAID="${BRIDGE_HUB_PARAID:-1013}"
export BRIDGE_HUB_AGENT_ID="${BRIDGE_HUB_AGENT_ID:-0x05f0ced792884ed09997292bd95f8d0d1094bb3bded91ec3f2f08531624037d6}"

statemine_ws_url="${STATEMINE_WS_URL:-ws://127.0.0.1:12144}"
statemine_para_id="${STATEMINE_PARA_ID:-1000}"
statemine_seed="${STATEMINE_SEED:-//Alice}"
assethub_ws_url="${ASSET_HUB_WS_URL:-ws://127.0.0.1:12144}"
assethub_seed="${ASSET_HUB_SEED:-//Alice}"
export ASSET_HUB_PARAID="${ASSET_HUB_PARAID:-1000}"
export ASSET_HUB_AGENT_ID="${ASSET_HUB_AGENT_ID:-0x72456f48efed08af20e5b317abf8648ac66e86bb90a411d9b0b713f7364b75b4}"

relaychain_ws_url="${RELAYCHAIN_WS_URL:-ws://127.0.0.1:9944}"
relaychain_sudo_seed="${RELAYCHAIN_SUDO_SEED:-//Alice}"
Expand All @@ -57,8 +59,8 @@ skip_relayer="${SKIP_RELAYER:-false}"

## Important accounts

# Account for statemine (1000 5Ec4AhPZk8STuex8Wsi9TwDtJQxKqzPJRCH7348Xtcs9vZLJ in testnet)
statemine_sovereign_account="${STATEMINE_SOVEREIGN_ACCOUNT:-0x70617261e8030000000000000000000000000000000000000000000000000000}"
# Account for assethub (1000 5Ec4AhPZk8STuex8Wsi9TwDtJQxKqzPJRCH7348Xtcs9vZLJ in testnet)
assethub_sovereign_account="${ASSETHUB_SOVEREIGN_ACCOUNT:-0x70617261e8030000000000000000000000000000000000000000000000000000}"
# Beacon relay account (//BeaconRelay 5GWFwdZb6JyU46e6ZiLxjGxogAHe8SenX76btfq8vGNAaq8c in testnet)
beacon_relayer_pub_key="${BEACON_RELAYER_PUB_KEY:-0xc46e141b5083721ad5f5056ba1cded69dce4a65f027ed3362357605b1687986a}"
# Execution relay account (//ExecutionRelay 5CFNWKMFPsw5Cs2Teo6Pvg7rWyjKiFfqPZs8U4MZXzMYFwXL in testnet)
Expand All @@ -79,13 +81,7 @@ export PRIVATE_KEY="${DEPLOYER_ETH_KEY:-0x4e9444a6efd6d42725a250b650a781da2737ea
export RANDAO_COMMIT_DELAY="${ETH_RANDAO_DELAY:-3}"
export RANDAO_COMMIT_EXP="${ETH_RANDAO_EXP:-3}"

export BRIDGE_HUB_PARAID=$bridgehub_para_id
# TODO: update placeholder value
export BRIDGE_HUB_AGENT_ID="0x05f0ced792884ed09997292bd95f8d0d1094bb3bded91ec3f2f08531624037d6"

export ASSET_HUB_PARAID=$statemine_para_id
# TODO: update placeholder value
export ASSET_HUB_AGENT_ID="0x72456f48efed08af20e5b317abf8648ac66e86bb90a411d9b0b713f7364b75b4"

export DEFAULT_FEE=1
export DEFAULT_REWARD=1
Expand Down
4 changes: 2 additions & 2 deletions web/packages/test/scripts/set_operating_mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ source scripts/xcm-helper.sh

enable_gateway() {
local transact_call="0x330400"
send_governance_transact_from_relaychain $bridgehub_para_id "$transact_call"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$transact_call"
}

disable_gateway() {
local transact_call="0x330401"
send_governance_transact_from_relaychain $bridgehub_para_id "$transact_call"
send_governance_transact_from_relaychain $BRIDGE_HUB_PARAID "$transact_call"
}

read -p "Enable gateway? (Y/N): " confirm
Expand Down

0 comments on commit 8b8f1b5

Please sign in to comment.