Skip to content

Commit

Permalink
fix: Update local gateway address and other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Dec 18, 2024
1 parent 1b0b47e commit e750cee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
22 changes: 16 additions & 6 deletions _SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ git submodule update --init --recursive
yarn run secret:clean
yarn run secret:uploadGateway
```
* Note: If you get error `TypeError: URL.canParse is not a function` then you're likely using the wrong Node.js version, so just change to the project root directory and run `nvm use` in that terminal tab.
* Add the `CODE_ID` to `secretGateway -> gatewayContractCodeId` and `CODE_HASH` to `secretGateway -> gatewayContractCodeHash` respectively to the relevant config.secret.<network> in ./packages/secret-contracts-scripts/src/config/deploy.ts
* Add the terminal log to ./logs_secret/uploadGatewaySecretLocalhost.log
Expand Down Expand Up @@ -424,6 +425,8 @@ git checkout nunya
cd SecretPath/TNLS-Relayers
```
* Check that it is using the latest version of the Python secret-sdk in requirements.txt https://github.com/secretanalytics/secret-sdk-python/releases
* Configure the Relayer
* 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#configuring-the-relayer
Expand Down Expand Up @@ -471,6 +474,16 @@ cd SecretPath/TNLS-Relayers
SOURCE=/Users/luke/code/clones/github/ltfschoen/SecretPath/TNLS-Relayers/.env
DESTINATION=/root/ltfschoen/SecretPath/TNLS-Relayers/.env
scp -r $SOURCE root@$REMOTE_IP:$DESTINATION

REMOTE_IP=172.105.184.209
SOURCE=/Users/luke/code/clones/github/ltfschoen/SecretPath/TNLS-Relayers/base_interface.py
DESTINATION=/root/ltfschoen/SecretPath/TNLS-Relayers/base_interface.py
scp -r $SOURCE root@$REMOTE_IP:$DESTINATION

REMOTE_IP=172.105.184.209
SOURCE=/Users/luke/code/clones/github/ltfschoen/SecretPath/TNLS-Relayers/scrt_interface.py
DESTINATION=/root/ltfschoen/SecretPath/TNLS-Relayers/scrt_interface.py
scp -r $SOURCE root@$REMOTE_IP:$DESTINATION
```
* IGNORE - Transfer some Localhost Ethereum tokens from a default account like `Account #0` that is shown when running Ethereum Localhost to that Ethereum wallet address associated with the private key `ethereum-private-key`.
Expand Down Expand Up @@ -563,6 +576,7 @@ cd SecretPath/TNLS-Relayers
```
conda create --name secretpath_env python=3.11
y
y
```
* Outputs:
Expand All @@ -578,15 +592,10 @@ cd SecretPath/TNLS-Relayers
# $ conda deactivate
```
* Activate it:
* Install Relayer dependencies and activate Conda environment
```
cd ~/ltfschoen/SecretPath/TNLS-Relayers
conda activate secretpath_env
```
* Install Relayer dependencies
```
cd ~/ltfschoen/SecretPath/TNLS-Relayers
pip install -r requirements.txt --no-dependencies
pip install --upgrade lru-dict
```
Expand Down Expand Up @@ -722,6 +731,7 @@ yarn run secret:instantiate
```bash
make start-server
```
* Note: `docker logs -f --tail 10 secretdev` to view its logs

* Terminal Tab 2: Option A (SecretJS) Compile, Upload, Instantiate:
* Change back to the project root directory
Expand Down
10 changes: 2 additions & 8 deletions packages/hardhat/contracts/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ contract Gateway is Ownable, Utils {
function requestValue(uint256 _callbackSelector, uint32 _callbackGasLimit) external payable onlyOwner returns (uint256 requestId) {
console.log("------ Gateway.requestValue");

// Note - It is only possible to call this function `encodeAddressToBase64` three times
// in this function, otherwise it generates error `Error: Transaction reverted without a reason`.
bytes28 senderAddressBase64 = encodeAddressToBase64(address(msg.sender));

requestId = taskId;
Expand Down Expand Up @@ -569,15 +571,9 @@ contract Gateway is Ownable, Utils {

bytes memory emptyBytes = hex"0000";

console.log("1");

// TODO - make `user_key` a unique key different from `user_pubkey`
// FIXME - `Error: Transaction reverted without a reason` occurs the 3rd time that
// `encodeAddressToBase64` is called in this function
bytes memory userKey = bytes.concat(senderAddressBase64); // equals AAA= in base64

console.log("2");

// ExecutionInfo struct
ExecutionInfo memory executionInfo = ExecutionInfo({
user_key: userKey, // FIXME - use this instead when resolve issue
Expand All @@ -596,8 +592,6 @@ contract Gateway is Ownable, Utils {
payload_signature: bytes32ToBytes(payloadHash)
});

console.log("3");

// persisting the task
tasks[requestId] = Task(bytes31(payloadHash), false);

Expand Down
2 changes: 1 addition & 1 deletion packages/secret-contracts-scripts/src/config/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config = {
// Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
nunyaBusinessContractAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3", // only know after deploy
gatewayContractAddress: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788", // only know after deploy
gatewayContractAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", // only know after deploy
},
sepolia: {
chainId: 11155111,
Expand Down

0 comments on commit e750cee

Please sign in to comment.