瀏覽代碼

remove createGovernancevaa and use the custom path for deployment path

nidhi-singh02 2 月之前
父節點
當前提交
807579531e

+ 3 - 3
contract_manager/scripts/common.ts

@@ -35,7 +35,7 @@ export async function deployIfNotCached(
   const key = cacheKey ?? `${chain.getId()}-${artifactName}`;
   return runIfNotCached(key, async () => {
     const artifact = JSON.parse(
-      readFileSync(join(config.jsonOutputDir, `${artifactName}.json`), "utf8"),
+      readFileSync(join(config.jsonOutputDir, `${artifactName}.sol`, `${artifactName}.json`), "utf8"),
     );
 
     // Handle bytecode which can be either a string or an object with an 'object' property
@@ -74,7 +74,7 @@ export function getWeb3Contract(
   address: string,
 ): Contract {
   const artifact = JSON.parse(
-    readFileSync(join(jsonOutputDir, `${artifactName}.json`), "utf8"),
+    readFileSync(join(jsonOutputDir, `${artifactName}.sol`, `${artifactName}.json`), "utf8"),
   );
   const web3 = new Web3();
   return new web3.eth.Contract(artifact["abi"], address);
@@ -84,7 +84,7 @@ export const COMMON_DEPLOY_OPTIONS = {
   "std-output-dir": {
     type: "string",
     demandOption: true,
-    desc: "Path to the standard JSON output of the contracts (build artifact) directory",
+    desc: "Path to the Foundry output directory (contains Contract.sol/Contract.json structure)",
   },
   "private-key": {
     type: "string",

+ 0 - 22
target_chains/ethereum/contracts/README.md

@@ -101,28 +101,6 @@ npm run receiver-submit-guardian-sets
 
 This script submits the pre-configured mainnet guardian set upgrade VAAs to bring your contract up to date with the current mainnet guardian set.
 
-### Utility Scripts
-
-Additional utility scripts are available for testing and development:
-
-#### Create Governance VAA (for testing)
-
-```bash
-# Create a governance VAA for localnet testing
-GOVERNANCE_DATA=0x... npm run create-governance-vaa
-```
-
-This script creates a properly signed governance VAA for local testing. You can customize it with environment variables:
-
-- `TIMESTAMP` - VAA timestamp (defaults to current block timestamp)
-- `NONCE` - VAA nonce (defaults to 0)
-- `EMITTER_CHAIN_ID` - Chain ID of the emitter (defaults to 1)
-- `EMITTER_ADDRESS` - Address of the emitter (defaults to test address)
-- `SEQUENCE` - VAA sequence number (defaults to 0)
-- `GOVERNANCE_DATA` - The governance payload data (required)
-- `GUARDIAN_SET_INDEX` - Guardian set index (defaults to 0)
-- `CONSISTENCY_LEVEL` - Consistency level (defaults to 32)
-
 ### Gas Benchmarks
 
 You can use foundry to run gas benchmark tests (which can be found in the `forge-test` directory). To run the tests with gas report

+ 1 - 33
target_chains/ethereum/contracts/deploy.sh

@@ -21,34 +21,7 @@ shift
 
 if [ "$version" = "latest" ]; then
   echo "Deploying latest version"
-  # Create a temporary directory for flattened contract artifacts
-  contracts_dir="out/contracts"
-  mkdir -p "$contracts_dir"
-  
-  echo "Copying contract artifacts from Foundry output structure..."
-  
-  # List of required contracts for EVM deployment
-  contracts=(
-    "PythUpgradable"
-    "ERC1967Proxy" 
-    "ReceiverSetup"
-    "WormholeReceiver"
-    "ReceiverImplementation"
-  )
-  
-  # Copy each contract artifact
-  for contract in "${contracts[@]}"; do
-    source_file="./out/${contract}.sol/${contract}.json"
-    dest_file="$contracts_dir/${contract}.json"
-    
-    if [ -f "$source_file" ]; then
-      cp "$source_file" "$dest_file"
-      echo "✓ Copied ${contract}.json"
-    else
-      echo "Warning: ${contract}.json not found at $source_file"
-    fi
-  done
-  stdoutputdir="$(pwd)/$contracts_dir"
+  stdoutputdir="$(pwd)/out"
 else
   # make sure version has format of vX.Y.Z
   if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -78,11 +51,6 @@ if [ -n "${tmpdir:-}" ]; then
   rm -rf $tmpdir
 fi
 
-# Clean up the contracts directory if we created it for the latest version
-if [ "$version" = "latest" ]; then
-  rm -rf "out/contracts"
-  echo "Cleaned up contracts directory"
-fi
 
 if [ "$version" != "latest" ]; then
     echo "Verify the contracts by using the std-input artifacts of the contracts in https://github.com/pyth-network/pyth-crosschain/releases/tag/pyth-evm-contract-$version"

+ 0 - 1
target_chains/ethereum/contracts/package.json

@@ -19,7 +19,6 @@
     "deploy-and-verify": "forge script script/Deploy.s.sol --rpc-url testnet --broadcast --verify",
     "deploy-local": "ETHERSCAN_API_KEY= forge script script/Deploy.s.sol --slow  --rpc-url local --broadcast -vvvv",
     "receiver-submit-guardian-sets": "forge script script/ReceiverSubmitGuardianSetUpgrades.s.sol --rpc-url $RPC_URL --broadcast",
-    "create-governance-vaa": "forge script script/CreateLocalnetGovernanceVaa.s.sol",
     "install-forge-deps": "forge install foundry-rs/forge-std@v1.7.6 --no-git",
     "coverage": "./coverage.sh",
     "test:format": "prettier --check .",

+ 0 - 83
target_chains/ethereum/contracts/script/CreateLocalnetGovernanceVaa.s.sol

@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-pragma solidity ^0.8.0;
-
-import "forge-std/Script.sol";
-import "forge-std/console.sol";
-
-contract CreateLocalnetGovernanceVaaScript is Script {
-    // Test signer private key (same as in the JS version)
-    uint256 constant TEST_SIGNER_PK =
-        0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0;
-
-    uint16 constant TEST_GOVERNANCE_CHAIN = 1; // ethereum
-    bytes32 constant TEST_GOVERNANCE_EMITTER =
-        0x0000000000000000000000000000000000000000000000000000000000001234;
-
-    function run() external view {
-        uint32 timestamp = uint32(
-            vm.envOr("TIMESTAMP", uint256(block.timestamp))
-        );
-        uint32 nonce = uint32(vm.envOr("NONCE", uint256(0)));
-        uint16 emitterChainId = uint16(
-            vm.envOr("EMITTER_CHAIN_ID", uint256(TEST_GOVERNANCE_CHAIN))
-        );
-        bytes32 emitterAddress = vm.envOr(
-            "EMITTER_ADDRESS",
-            TEST_GOVERNANCE_EMITTER
-        );
-        uint64 sequence = uint64(vm.envOr("SEQUENCE", uint256(0)));
-        bytes memory data = vm.envBytes("GOVERNANCE_DATA");
-        uint32 guardianSetIndex = uint32(
-            vm.envOr("GUARDIAN_SET_INDEX", uint256(0))
-        );
-        uint8 consistencyLevel = uint8(
-            vm.envOr("CONSISTENCY_LEVEL", uint256(32))
-        );
-
-        console.log("Creating localnet governance VAA with parameters:");
-        console.log("Timestamp:", timestamp);
-        console.log("Nonce:", nonce);
-        console.log("Emitter Chain ID:", emitterChainId);
-        console.log("Emitter Address:", uint256(emitterAddress));
-        console.log("Sequence:", sequence);
-        console.log("Guardian Set Index:", guardianSetIndex);
-        console.log("Consistency Level:", consistencyLevel);
-        console.log("Data length:", data.length);
-
-        // Create VAA body
-        bytes memory body = abi.encodePacked(
-            timestamp,
-            nonce,
-            emitterChainId,
-            emitterAddress,
-            sequence,
-            consistencyLevel,
-            data
-        );
-
-        // Hash the body for signing
-        bytes32 bodyHash = keccak256(abi.encodePacked(keccak256(body)));
-
-        // Sign with test private key
-        (uint8 v, bytes32 r, bytes32 s) = vm.sign(TEST_SIGNER_PK, bodyHash);
-
-        // Create signature structure (guardian index 0, signature)
-        bytes memory signature = abi.encodePacked(uint8(0), r, s, v);
-
-        // Create complete VAA
-        bytes memory vaa = abi.encodePacked(
-            uint8(1), // version
-            guardianSetIndex, // guardian set index
-            uint8(1), // number of signatures
-            signature, // signatures
-            body // body
-        );
-
-        console.log("Generated VAA (hex):");
-        console.logBytes(vaa);
-
-        // Also log as a string for easy copying
-        string memory vaaHex = vm.toString(vaa);
-        console.log("VAA hex string:", vaaHex);
-    }
-}