Skip to content

Commit eb4e1f8

Browse files
committed
wip: try to fix invalid contract error
1 parent 17851ce commit eb4e1f8

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

packages/hardhat/contracts/Gateway.sol

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,17 @@ contract Gateway is Ownable, Utils {
524524
require(msg.value >= estimatedPrice, "Paid Callback Fee Too Low");
525525
}
526526

527+
// TODO - make `user_key` a unique key different from `user_pubkey`
528+
// bytes memory userKey = bytes.concat(senderAddressBase64); // equals AAA= in base64
529+
// FIXME: failed to validate transaction. Message contains mismatched contract hash
530+
// bytes memory userKey = bytes.concat(owner_public_key); // equals AAA= in base64
531+
// secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg
532+
// Note: Find the public key from the account_info in the Relayer logs
533+
// '/cosmos.crypto.secp256k1.PubKey', 'key':
534+
// Encode A4K+MyJNnNcdt78SncjhArLWNnDRHapkZFsemjmf9/7A to base64:
535+
// QTRLK015Sk5uTmNkdDc4U25jamhBckxXTm5EUkhhcGtaRnNlbWptZjkvN0E=
536+
bytes memory userKey = bytes.concat("A4K+MyJNnNcdt78SncjhArLWNnDRHapkZFsemjmf9/7A");
537+
527538
// Note: Since contracts only have an address, but not public keys, where the
528539
// addresses are derived from the address of the user (or other contract) that
529540
// created them, which are in turn are derived from the public key of a normal
@@ -547,8 +558,10 @@ contract Gateway is Ownable, Utils {
547558
bytes memory payload_info = abi.encodePacked(
548559
'}","routing_info":"',routing_info,
549560
'","routing_code_hash":"',routing_code_hash,
550-
'","user_address":"',address(owner),
551-
'","user_key":"',owner_public_key,
561+
// '","user_address":"',address(owner),
562+
// '","user_key":"',owner_public_key,
563+
'","user_address":"secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg',
564+
'","user_key":"',userKey,
552565
'","callback_address":"'
553566
// '","user_address":"0x0000","user_key":"AAA=","callback_address":"'
554567
);
@@ -604,17 +617,14 @@ contract Gateway is Ownable, Utils {
604617

605618
bytes memory emptyBytes = hex"0000";
606619

607-
// TODO - make `user_key` a unique key different from `user_pubkey`
608-
// bytes memory userKey = bytes.concat(senderAddressBase64); // equals AAA= in base64
609-
bytes memory userKey = bytes.concat(owner_public_key); // equals AAA= in base64
610-
611620
// ExecutionInfo struct
612621
ExecutionInfo memory executionInfo = ExecutionInfo({
613622
user_key: userKey, // FIXME - use this instead when resolve issue
614623
// user_key: emptyBytes, // equals AAA= in base64
615624
// FIXME: use of `secret_gateway_signer_pubkey` does not compile, what alternative to use?
616625
// user_pubkey: uint256toBytesString(secret_gateway_signer_pubkey),
617-
user_pubkey: owner_public_key,
626+
// user_pubkey: owner_public_key,
627+
user_pubkey: userKey,
618628
// user_pubkey: emptyBytes, // Fill with 0 bytes
619629
routing_code_hash: routing_code_hash, // custom contract codehash on Secret
620630
task_destination_network: task_destination_network,
@@ -624,8 +634,8 @@ contract Gateway is Ownable, Utils {
624634
payload: payload,
625635
// TODO: add a payload signature
626636
// Signature of hash of encrypted input values
627-
// payload_signature: emptyBytes // empty signature, fill with 0 bytes
628-
payload_signature: bytes32ToBytes(payloadHash)
637+
payload_signature: emptyBytes // empty signature, fill with 0 bytes
638+
// payload_signature: bytes32ToBytes(payloadHash)
629639
});
630640

631641
// persisting the task

packages/secret-contracts-scripts/src/config/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ const config = {
7777
endpoint: process.env.ENDPOINT_LOCAL,
7878
secretNunya: {
7979
nunyaContractCodeId: "2", // only know after upload
80-
nunyaContractCodeHash: "37bf978b95a5fb3aa60799ab8be8be410d9da9cb291c40c3dc3e0d110a5fca66", // only know after upload
80+
nunyaContractCodeHash: "bd379de6cac6c154690c2c398631ccbcad13bd3242486356e764cf23327aa623", // only know after upload
8181
nunyaContractAddress: "secret1gyruqan6yxf0q423t8z5zce3x7np35uw8s8wqc", // only know after instantiate
8282
nunyaContractWasmPath: "contract.wasm.gz",
8383
},
8484
secretGateway: {
8585
gatewayContractCodeId: "1", // only know after upload
8686
gatewayContractAddress: "secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q", // only know after instantiate
87-
gatewayContractCodeHash: "2fec99443c428e1b9261b41c80717affd8e027a736490ab438157b09f2c83a71", // only know after upload
87+
gatewayContractCodeHash: "836a34c60637d684c044d4ddc1277e3d21ae1f440d2bb2d26870c81639d2f4c4", // only know after upload
8888
// note: mock value hard-coded
8989
gatewayContractPublicKey: "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
9090
// note: mock value hard-coded

0 commit comments

Comments
 (0)