Skip to content

Commit

Permalink
fix: Separate files for Secret Gateway and Nunya contract with clean …
Browse files Browse the repository at this point in the history
…Docker build
  • Loading branch information
ltfschoen committed Dec 14, 2024
1 parent 1b19e09 commit d83147f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 11 deletions.
32 changes: 32 additions & 0 deletions _SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,25 @@ git submodule update --init --recursive

* Secret Gateway Contract
```
make clean
make build
```
* Note: Use `make build-mainnet-reproducible` to deploy to Testnet
* Note: Use existing localsecret Docker container that is running already.
* Copy compiled Secret Gateway contract to the Docker container
```
make copy-secret-gateway-contract-local
```
* Store compiled Secret Gateway contract on Localhost (Localsecret network)
```
make store-secret-gateway-contract-local
```
* TODO
###### Deploy Relayer of SecretPath on Localhost
* Reference: https://docs.scrt.network/secret-network-documentation/confidential-computing-layer/ethereum-evm-developer-toolkit/basics/cross-chain-messaging/secretpath/how-to-deploy-secretpath-on-your-chain
Expand Down Expand Up @@ -535,6 +550,7 @@ docker rmi sco
* Nunya Contract
```
cd packages/secret-contracts/nunya-contract
make clean
make build-mainnet-reproducible
```
Expand All @@ -543,11 +559,14 @@ docker rmi sco
* My Counter Contract (Example only)
```
cd packages/secret-contracts/my-counter-contract
make clean
make build-mainnet-reproducible
```
##### Deploy (Upload and Instantiate)
###### Testnet
* Upload and Instantiate
> IMPORTANT: Prior to Upload step it is necessary to recompile changes if any.
Expand Down Expand Up @@ -589,8 +608,19 @@ yarn run secret:instantiate
* Reference https://docs.scrt.network/secret-network-documentation/development/readme-1/compile-and-deploy
###### Localhost
```bash
make clean
make start-server
make copy-nunya-contract-local
make store-nunya-contract-local
```

#### Interact with Deployed Secret Contract via Deployed EVM Gateway to `requestValue` <a id="request-value"></a>

##### Testnet

Options:

1. Script requestValue.ts
Expand Down Expand Up @@ -635,6 +665,8 @@ Options:

##### Unsorted

###### Testnet

* Query Pubkey
```
cd ../../../
Expand Down
11 changes: 9 additions & 2 deletions packages/secret-contracts/nunya-contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@ start-server: # CTRL+C to stop
-v $$(pwd):/root/code \
--name secretdev ghcr.io/scrtlabs/localsecret:v1.6.0-rc.3

.PHONY: copy-nunya-contract-local
copy-nunya--contract-local:
docker cp contract.wasm secretdev:/root/code/contract.wasm
docker cp contract.wasm.gz secretdev:/root/code/contract.wasm.gz

# This relies on running `start-server` in another console
# You can run other commands on the secretcli inside the dev image
# by using `docker exec secretdev secretcli`.
.PHONY: store-contract-local
store-contract-local:
.PHONY: store-nunya-contract-local
store-nunya-contract-local:
docker exec secretdev secretcli tx compute store -y --from a --gas 1000000 /root/code/contract.wasm.gz

.PHONY: clean
clean:
cargo clean
-rm -f ./contract.wasm ./contract.wasm.gz
docker exec secretdev rm -rf /root/code/contract.wasm
docker exec secretdev rm -rf /root/code/contract.wasm.gz
26 changes: 17 additions & 9 deletions packages/secret-contracts/secret-gateway/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ build-mainnet-reproducible:

.PHONY: compress-wasm
compress-wasm:
cp ./target/wasm32-unknown-unknown/release/*.wasm ./contract.wasm
cp ./target/wasm32-unknown-unknown/release/*.wasm ./secret-gateway-contract.wasm
@## The following line is not necessary, may work only on linux (extra size optimization)
wasm-opt -Os ./contract.wasm -o ./contract.wasm
cat ./contract.wasm | gzip -9 > ./contract.wasm.gz
wasm-opt -Os ./secret-gateway-contract.wasm -o ./secret-gateway-contract.wasm
cat ./secret-gateway-contract.wasm | gzip -9 > ./secret-gateway-contract.wasm.gz

.PHONY: schema
schema:
Expand All @@ -51,16 +51,22 @@ schema:
.PHONY: start-server
start-server: # CTRL+C to stop
docker run -it --rm \
-p 26657:26657 -p 26656:26656 -p 1317:1317 -p 5000:5000 \
-p 9091:9091 -p 26657:26657 -p 26656:26656 -p 1317:1317 -p 5000:5000 \
-v $$(pwd):/root/code \
--name localsecret ghcr.io/scrtlabs/localsecret:1.3.1
--name localsecret ghcr.io/scrtlabs/localsecret:v1.6.0-rc.3


.PHONY: copy-secret-gateway-contract-local
copy-secret-gateway-contract-local:
docker cp secret-gateway-contract.wasm secretdev:/root/code/secret-gateway-contract.wasm
docker cp secret-gateway-contract.wasm.gz secretdev:/root/code/secret-gateway-contract.wasm.gz

# This relies on running `start-server` in another console
# You can run other commands on the secretcli inside the dev image
# by using `docker exec secretdev secretcli`.
.PHONY: store-contract-local
store-contract-local:
docker exec secretdev secretcli tx compute store -y --from a --gas 2000000 /root/code/contract.wasm.gz
.PHONY: store-secret-gateway-contract-local
store-secret-gateway-contract-local:
docker exec secretdev secretcli tx compute store -y --from a --gas 2000000 /root/code/secret-gateway-contract.wasm.gz

.PHONY: integration-test
integration-test:
Expand All @@ -69,4 +75,6 @@ integration-test:
.PHONY: clean
clean:
cargo clean
-rm -f ./contract.wasm ./contract.wasm.gz
-rm -f ./secret-gateway-contract.wasm ./secret-gateway-contract.wasm.gz
docker exec secretdev rm -rf /root/code/secret-gateway-contract.wasm
docker exec secretdev rm -rf /root/code/secret-gateway-contract.wasm.gz

0 comments on commit d83147f

Please sign in to comment.