Skip to content

Commit def5b53

Browse files
Merge pull request #21 from Itheum/develop
Last commit before we upgrade mainnet from v1.0 to v2.0
2 parents 4222d01 + c8d665d commit def5b53

File tree

7 files changed

+49
-10
lines changed

7 files changed

+49
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "claims"
3-
version = "0.1.0"
3+
version = "2.0.0"
44
authors = ["Ovidiu Damian - Itheum"]
55
edition = "2021"
66
publish = false

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ Example with claim type: "harvestClaim@02"
206206

207207
This smart contract, albeit being a simple one, aims to set the standard when it comes to the quality of testing and documentation for which smart contract developers should aim. The above average level of documentation present aims specifically to take advantage of our open source codebase in order to learn, contribute and take good practices from the smart contract.
208208

209-
### Setting up dev environment (project development bootstrap)
209+
### Setting up dev environment (project development bootstrap) + how to build
210210

211211
- Uses `multiversx-sc-* 0.39.5` SDK libs (see Cargo.toml)
212-
- Building requires minimum **mxpy 5.2.3** (newer version should also work but devs used 5.2.3). Check version using `mxpy --version`
212+
- Building requires minimum **mxpy 6.1.1** (newer version should also work but devs used 6.1.1). Check version using `mxpy --version`
213213
- To build the project, requires minimum Rust version `1.68.0-nightly`. Check your Rust version by running `rustc --version`. To update your Rust, run `rustup update`. To set to nightly run `rustup default nightly` (devs used 1.69.0-nightly)
214214
- After you make sure you have the minimum Rust version you can then begin development. After you clone repo and before you run build, deploy or run the tests - follow these steps
215215

@@ -269,6 +269,45 @@ After using that, to deploy one can simply use:
269269

270270
After deployment, one can interact with the smart contract and test its functionality. To do so, one can use the interaction snippets already presented above. More explanations can be found about the snippets inside the devnet.snippets file.
271271

272+
### Mainnet Deployment (via Reproducible Builds)
273+
- After the security audit has passed the Mainnet deployment need to be verified to match the version that was audited. This guarantee is given via [Reproducible Builds](https://docs.multiversx.com/developers/reproducible-contract-builds/#how-to-run-a-reproducible-build-using-mxpy)
274+
275+
- IMPORTANT - BUT it's important to note that we DID not do a REPRODUCIBLE BUILD for v1.0 deployment. This was only done from v2.0 onwards for the upgraded we did.
276+
277+
**Step 1 (Final build + Code Hash):**
278+
- Be in the latest `main` branch. On the commit that was audited. Update the cargo.toml files with the correct version. This should match the version we use in our requirements files (i.e Notion). e.g. 1.0.0. you need to update the `cargo.toml` files in the root folder, wasm folder and meta folder.
279+
280+
- In the `cargo.toml` files make sure you set the correct `edition`. i.e. edition = "2021"
281+
282+
- As the `cargo.toml` files has been updated. Build locally as normal. i.e. see "how to build" above and also run tests as per "how to test". This will reflect the `cargo.toml` update in the linked cargo.lock files and produces the final local meta build files to keep the final github check-in and version tagging perfect.
283+
284+
285+
**Step 2 (Final build + Code Hash):**
286+
Once the main commit is locked in, we can then produce the code hash and build to deploy to devnet 1st (for final testing) and then to mainnet (after sending the code hash to the auditor)
287+
288+
1. Make sure your mxpy version is >= 6.
289+
2. If Cargo.lock is in gitignore, remove it, build the contract and make a new commit. Otherwise this step can be skipped. (see Step 1 and repeat if needed)
290+
3. Run the following in the root of the repository (run the latest Docker client in your computer. Used `Docker Desktop 4.18.0 (104112) on MacOX 12.6`):
291+
292+
`mxpy contract reproducible-build --docker-image="multiversx/sdk-rust-contract-builder:v4.1.4"`
293+
294+
Note that if you already have a output-docker from a previous build and deploy then delete this folder.
295+
296+
This process may take some time. After it's done you should see "Docker build ran successfully!". An output-docker folder will be created containing the WASM files built in a reproducible way and artifacts.json containing the code hash of the WASM files.
297+
298+
You can then share the auditor the code hash. The auditor will follow the same steps and compare the code hash with yours. If they match, we will be good to go!
299+
300+
Note that "output-docker" folder should not be check-into GIT.
301+
302+
**Step 4 (Send Code Hash to auditor to verify against devnet and give us all final clear):**
303+
We should have got this final clear in Step 2, but we still do a final check here.
304+
305+
**Step 5 (Deploy to Devnet as final build for testing + Move ABI to all apps that need it):**
306+
307+
**Step 6 (Tag the commit in the main branch of Github with the version that was deployed. e.g. 1.0.0):**
308+
309+
**Step 6 (Deploy SC to Mainnet):**
310+
272311
## Contributing
273312

274313
Feel free the contact the development team if you wish to contribute or if you have any questions. If you find any issues, please report them in the Issues sections of the repository. You can also create your own pull requests which will be analyzed by the team.

meta/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

meta/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "claims-meta"
3-
version = "0.1.0"
3+
version = "2.0.0"
44
edition = "2021"
55
publish = false
66
authors = ["Ovidiu Damian - Itheum"]

wasm/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "claims-wasm"
3-
version = "0.1.0"
3+
version = "2.0.0"
44
edition = "2021"
55
publish = false
66
authors = ["Ovidiu Damian - Itheum"]

0 commit comments

Comments
 (0)