diff --git a/.github/workflows/capsule.yaml b/.github/workflows/capsule.yaml index fbd465f..7f25b15 100644 --- a/.github/workflows/capsule.yaml +++ b/.github/workflows/capsule.yaml @@ -1,5 +1,6 @@ name: Capsule build/test on: + push: pull_request: paths: - contracts/** @@ -7,14 +8,23 @@ on: - tests/** jobs: - capsule: + capsule-build-and-test: + strategy: + fail-fast: false + matrix: + include: + - target: debug + cargo-option: "" + target-dir: "build/debug" + - target: testnet + cargo-option: "--release" + target-dir: "build/release" + - target: mainnet + cargo-option: "--release -- --features release_export" + target-dir: "build/release" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: actions/checkout@v4 - name: Prepare capsule v0.10.2 run: | @@ -28,10 +38,50 @@ jobs: run: cargo install cross --git https://github.com/cross-rs/cross - name: Capsule build - run: capsule build + run: capsule build ${{ matrix.cargo-option }} - - name: Capsule test -- --nocapture - run: capsule test + - name: Capsule test + run: capsule test ${{ matrix.cargo-option }} - - \ No newline at end of file + - name: List all the contract binaries of ${{ github.ref }} + run: ls -l ${{ matrix.target-dir }} + + - name: Archive the contract binaries ${{ github.sha }} + uses: actions/upload-artifact@v4 + with: + name: contract-binaries-${{ matrix.target }}-${{ github.sha }} + path: | + build/debug + build/release + outputs: + spore-contract-ref: ${{ github.sha }} + + record-code-hash: + needs: capsule-build-and-test + strategy: + matrix: + target: [debug, testnet, mainnet] + runs-on: ubuntu-20.04 + steps: + # TODO: add this codehash util into the `tests` directory + # or, simply use `ckb-cli util blake2b --binary-path ...` to get the codehash + - name: Checkout a code_hash tool + uses: actions/checkout@v4 + with: + repository: Flouse/spore-contract + ref: codehash-tool + + - uses: actions/download-artifact@v4 + with: + name: contract-binaries-${{ matrix.target }}-${{ needs.capsule-build-and-test.outputs.spore-contract-ref }} + path: build + + - name: Build codehash-tool + working-directory: build + run: cargo build + + - name: Record code_hash of contract binaries + working-directory: build + run: | + echo "spore-contract-commit: ${{ needs.capsule-build-and-test.outputs.spore-contract-ref }}\n" + ./target/debug/code_hash diff --git a/README.md b/README.md index fafdc64..b8c4533 100644 --- a/README.md +++ b/README.md @@ -54,28 +54,7 @@ The versioning philosophy is **"Using code_hash as version"** for Spore Protocol Make sure you are using the proper version you want, because there's no such an "upgrade/downgrade" method but we suggest to use "destroy/reconstruct" method instead, which requires no modification of any fields in Spore cell. -Our `forzen` versions of contract, which are our prior versions, can be found in [directory](https://github.com/sporeprotocol/spore-contract/tree/master/deployment/frozen) `./deployment/frozen`. To describe more clearly, the `frozen` information contains each avaliable `code_hash` generated from Spore contracts with corresponding commit hash for the rolling back help. - -`./deployment/migration` recorded the deployment detail for each Spore contract. Here's a list about the newest versions: - -#### Spore -Pudge Testnet: -- data_hash: `0xa32df38d2de1da82cbcb9e4467f8c18479596394eea977e471b75be5fe3e9c67` - -#### Cluster -Pudge Testnet: -- data_hash: `0x5203a3baf931c15a809c4a0bb7041aebb73118281e31e8d104d926b8523977b1` - -#### Cluster Proxy -Pudge Testnet: -- data_hash: `0x08e5cecab2bbdea9139534a822d46b82929e06f12f00c68343a88a58827cd3db` - -#### Cluster Agent -- data_hash: `0x88850ac632eed604f0ad784394004db384d0eea8038a24eee83439687d79343f` - -#### Mutant (Lua Extension) -Pudge Testnet: -- data_hash: `0x94a9b875911ace20f1f0d063a26495d14e4b04e32fd218261bb747f34e71ae47` +Our `forzen` versions of contract, which are our prior versions, can be found in [directory](https://github.com/sporeprotocol/spore-contract/tree/master/deployment/frozen) `./deployment/frozen`. To describe more clearly, the `frozen` information contains each avaliable `code_hash` generated from Spore contracts. Historical version refers to [here](https://github.com/sporeprotocol/spore-contract/blob/master/docs/VERSIONS.md). In addition, using Mutant contract requires the binary of Lua library. Information are recorded [here](https://github.com/sporeprotocol/spore-contract/tree/master/contracts/spore_extension_lua/lua). For simplicity, it's already deployed in the Pudge Testnet: diff --git a/deployment/deploy.sh b/deployment/deploy.sh index 482d401..5f33d8e 100755 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -1,13 +1,20 @@ #!/usr/bin/env bash -echo "deploying $1 from $3 to $2" +export network=$4 + +if [ -z $network ] +then + export network="testnet" +fi + +echo "deploying $1 from $3 to $2 on $network" ckb-cli --url $2 deploy gen-txs --from-address $3 --fee-rate 1000 --deployment-config ./toml/$1.toml \ - --info-file ./$1.json --migration-dir ./migration/$1 --sign-now + --info-file ./$1.json --migration-dir ./migration/$network/$1 --sign-now echo "ckb transacion file '$1.json' has generated" -ckb-cli --url $2 deploy apply-txs --info-file ./$1.json --migration-dir ./migration/$1 +ckb-cli --url $2 deploy apply-txs --info-file ./$1.json --migration-dir ./migration/$network/$1 rm ./$1.json diff --git a/deployment/frozen/testnet.toml b/deployment/frozen/testnet.toml index 2251e1b..33948fd 100644 --- a/deployment/frozen/testnet.toml +++ b/deployment/frozen/testnet.toml @@ -1,5 +1,4 @@ -# version v1 +# version v0.1.0 [[code_hash_list]] -commit_hash = "457e32d23b5f401cad837e52a568281784943e18" cluster = "598d793defef36e2eeba54a9b45130e4ca92822e1d193671f490950c3b856080" spore = "bbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494" diff --git a/deployment/migration/mainnet/cluster/2024-01-23-0.2.2-beta.1.json b/deployment/migration/mainnet/cluster/2024-01-23-0.2.2-beta.1.json new file mode 100644 index 0000000..351f212 --- /dev/null +++ b/deployment/migration/mainnet/cluster/2024-01-23-0.2.2-beta.1.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "cluster", + "tx_hash": "0xe464b7fb9311c5e2820e61c99afc615d6b98bdefbe318c34868c010cbd0dc938", + "index": 0, + "occupied_capacity": 4690900000000, + "data_hash": "0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075", + "type_id": null + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/mainnet/spore/2024-01-23-40ef57a2.json b/deployment/migration/mainnet/spore/2024-01-23-40ef57a2.json new file mode 100644 index 0000000..990af2f --- /dev/null +++ b/deployment/migration/mainnet/spore/2024-01-23-40ef57a2.json @@ -0,0 +1,13 @@ +{ + "cell_recipes": [ + { + "name": "spore", + "tx_hash": "0xcb67e11a39594a183eae50664073a85fa0140ae25480df61114aca0e47726d38", + "index": 0, + "occupied_capacity": 7679700000000, + "data_hash": "0x9cb02fa8621d79fff300b910d52665f594d3ad468142a66213cfaaca0409502c", + "type_id": null + } + ], + "dep_group_recipes": [] +} \ No newline at end of file diff --git a/deployment/migration/cluster/2024-01-19-aa7ae614.json b/deployment/migration/testnet/cluster/2024-01-19-0.2.1.json similarity index 100% rename from deployment/migration/cluster/2024-01-19-aa7ae614.json rename to deployment/migration/testnet/cluster/2024-01-19-0.2.1.json diff --git a/deployment/migration/cluster_agent/2024-01-19-aa7ae614.json b/deployment/migration/testnet/cluster_agent/2024-01-19-0.2.1.json similarity index 100% rename from deployment/migration/cluster_agent/2024-01-19-aa7ae614.json rename to deployment/migration/testnet/cluster_agent/2024-01-19-0.2.1.json diff --git a/deployment/migration/cluster_proxy/2024-01-19-aa7ae614.json b/deployment/migration/testnet/cluster_proxy/2024-01-19-0.2.1.json similarity index 100% rename from deployment/migration/cluster_proxy/2024-01-19-aa7ae614.json rename to deployment/migration/testnet/cluster_proxy/2024-01-19-0.2.1.json diff --git a/deployment/migration/spore/2024-01-19-aa7ae614.json b/deployment/migration/testnet/spore/2024-01-19-0.2.1.json similarity index 100% rename from deployment/migration/spore/2024-01-19-aa7ae614.json rename to deployment/migration/testnet/spore/2024-01-19-0.2.1.json diff --git a/deployment/migration/spore_extension_lua/2024-01-19-aa7ae614.json b/deployment/migration/testnet/spore_extension_lua/2024-01-19-0.2.1.json similarity index 100% rename from deployment/migration/spore_extension_lua/2024-01-19-aa7ae614.json rename to deployment/migration/testnet/spore_extension_lua/2024-01-19-0.2.1.json diff --git a/deployment/toml/cluster.toml b/deployment/toml/cluster.toml index 6a4cf37..a3e9b1f 100644 --- a/deployment/toml/cluster.toml +++ b/deployment/toml/cluster.toml @@ -8,5 +8,5 @@ location = { file = "../build/release/cluster" } # The lock script set to output cells [lock] code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" +args = "0x20da6b70dfe59586e89635dbb3adc7aa998e7189" hash_type = "type" diff --git a/deployment/toml/spore.toml b/deployment/toml/spore.toml index e685c2b..3be33ef 100644 --- a/deployment/toml/spore.toml +++ b/deployment/toml/spore.toml @@ -8,5 +8,5 @@ location = { file = "../build/release/spore" } # The lock script set to output cells [lock] code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" +args = "0x20da6b70dfe59586e89635dbb3adc7aa998e7189" hash_type = "type" diff --git a/docs/VERSIONS.md b/docs/VERSIONS.md index 68e7f40..201e7d5 100644 --- a/docs/VERSIONS.md +++ b/docs/VERSIONS.md @@ -1 +1,41 @@ # Historical Versions + +## tag 0.2.1 (testnet) + +**spore**: +| | | +|-|-| +|tx_hash|0x06995b9fc19461a2bf9933e57b69af47a20bf0a5bc6c0ffcb85567a2c733f0a1| +|index|0| +|code_hash|0x5e063b4c0e7abeaa6a428df3b693521a3050934cf3b0ae97a800d1bc31449398| + +**cluster**: +| | | +|-|-| +|tx_hash|0xfbceb70b2e683ef3a97865bb88e082e3e5366ee195a9c826e3c07d1026792fcd| +|index|0| +|code_hash|0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075| + +**cluster_agent**: +| | | +|-|-| +|tx_hash|0x53fdb9366637434ff685d0aca5e2a68a859b6fcaa4b608a7ecca0713fed0f5b7| +|index|0| +|code_hash|0xc986099b41d79ca1b2a56ce5874bcda8175440a17298ea5e2bbc3897736b8c21| + +**cluster_proxy**: +| | | +|-|-| +|tx_hash|0x0231ea581bbc38965e10a2659da326ae840c038a9d0d6849f458b51d94870104| +|index|0| +|code_hash|0xbe8b9ce3d05a32c4bb26fe71cd5fc1407ce91e3a8b9e8719be2ab072cef1454b| + +## tag 0.2.2 (mainnet) + + +**cluster**: +| | | +|-|-| +|tx_hash|0xe464b7fb9311c5e2820e61c99afc615d6b98bdefbe318c34868c010cbd0dc938| +|index|0| +|code_hash|0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075| diff --git a/lib/build/src/lib.rs b/lib/build/src/lib.rs index 19f30c5..a2d6a72 100644 --- a/lib/build/src/lib.rs +++ b/lib/build/src/lib.rs @@ -9,8 +9,6 @@ pub struct FrozenVersions { #[derive(serde::Deserialize)] pub struct PublishedCodeHash { - #[serde(rename(deserialize = "commit_hash"))] - _commit_hash: String, #[serde(default)] spore: String, #[serde(default)]