# @trevyn - Progress update thread

**URL:** <https://forum.grin.mw/t/trevyn-progress-update-thread/8702>\
**Category:** Uncategorized\
**Created:** [April 5, 2021, 6:25pm UTC](https://forum.grin.mw/t/trevyn-progress-update-thread/8702 "2021-04-05T18:25:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevyn](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/trevyn/32/3886_2.png) [@trevyn](https://forum.grin.mw/u/trevyn)\
**Post date:** [April 5, 2021, 6:25pm UTC](https://forum.grin.mw/t/trevyn-progress-update-thread/8702/1 "2021-04-05T18:25:48Z")

</div>

As a new contributor, I’m currently getting familiar with the `grin` and `grin-wallet` codebases by working on an assortment of PRs and issues.

Since posting an [initial funding request](https://forum.grin.mw/t/request-for-funding-trevyn-apr-2021/8641) at the end of March, I’ve been working on the items below. As April progresses, I expect to make 2-3 additional progress reports in this thread.

| | |
| --- | --- |
| [forum.grin.mw/8548](https://forum.grin.mw/t/chicken-1-4-are-not-running-away-ipollo-g1-mini-review-and-disassembly/8548/27) | Diagnosed manufacturing error on iPollo G1 affecting thermal performance and hash rate |
| [grin#3630](https://github.com/mimblewimble/grin/pull/3630) | Add test for duplicate rangeproof inflation bug |
| [grin#3621](https://github.com/mimblewimble/grin/pull/3621) | Incentivized work leading to robust chain-level test of inflation bug |
| [grin#3613](https://github.com/mimblewimble/grin/pull/3613) | Fix verifier cache keys by hashing full `Output` |
| [grin#3609](https://github.com/mimblewimble/grin/issues/3609#issuecomment-812494290) | Thinking about how to implement a `verify-chain` command to increase user confidence in chain integrity |
| [grin#3631](https://github.com/mimblewimble/grin/issues/3631) | Tracking issue for deprecation of `failure` crate |
| [grin-wallet#599](https://github.com/mimblewimble/grin-wallet/pull/599) | Sync grin-wallet dependencies to latest grin master and fix missing verifier\_cache |
| [grin#3617](https://github.com/mimblewimble/grin/pull/3617#pullrequestreview-627505816) | Reviewed PR: “Update zip dependency and fix deprecation warnings” |
| [grin-wallet#582](https://github.com/mimblewimble/grin-wallet/issues/582) | Fixed: “grin-wallet crashes when attempting to send amount larger than balance” |
| [grin-wallet#600](https://github.com/mimblewimble/grin-wallet/pull/600) | Bubble `init_send_tx` error instead of unwrapping |
| [grin#3632](https://github.com/mimblewimble/grin/pull/3632)  
[grin-wallet#603](https://github.com/mimblewimble/grin-wallet/pull/603) | Fix Windows CI `cargo test` silently passing |
| [grin-wallet#479](https://github.com/mimblewimble/grin-wallet/issues/479#issuecomment-813384105) | Build error when targeting Apple iOS for grin-wallet v4.0.0 |

---

<div class="post-metadata">

**Author:** ![Anynomous](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/anynomous/32/2928_2.png) [@Anynomous](https://forum.grin.mw/u/Anynomous)\
**Post date:** [April 6, 2021, 7:29am UTC](https://forum.grin.mw/t/trevyn-progress-update-thread/8702/2 "2021-04-06T07:29:53Z")

</div>

> [@trevyn](#):
>
> Add test for duplicate rangeproof inflation bug

Glad the set of test cases is increasing, this is just how Bitcoin works, a huge amount of test cases to detect bugs from creeping into the code.  
❤

---

<div class="post-metadata">

**Author:** ![trevyn](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/trevyn/32/3886_2.png) [@trevyn](https://forum.grin.mw/u/trevyn)\
**Post date:** [April 17, 2021, 3:03pm UTC](https://forum.grin.mw/t/trevyn-progress-update-thread/8702/3 "2021-04-17T15:03:50Z")

</div>

Over the past 10 days, I’ve primarily worked on three projects:

## A config file versioning scheme

> <https://github.com/mimblewimble/grin/pull/3634>
>
> This adds an automatic migration of \`grin-server.toml\` to \`config\_file\_version =… 2\`, performed as such:
> 
> \- Add \`config\_file\_version = 2\` line after header comments
> \- If \`server.pool\_config.accept\_fee\_base\` is 1000000, change it to 500000
> \- Remove the comment \`#a setting to 1000000 will be overridden to 500000 to respect the fixfees RFC\`, since it no longer will once \`config\_file\_version\` \>= 2
> \- Verify that the updated toml parses to the expected result
> \- Write the updated \`grin-server.toml\` file to disk
> 
> This migration is only applied when the \`config\_file\_version\` key is not present in the existing \`grin-server.toml\` file.
> 
> For a fresh install, the migration is performed automatically when reading the initial default config.
> 
> Error handling can be improved upon request if this general approach is OK.
> 
> Closes #3540.

To unblock implementation of the fix past fees RFC, we needed a principled way of versioning and updating the configuration file format without disturbing any custom edits or comments that the user may have made. This is a tricky problem, because TOML can express the same data structure in multiple format variants, and the `toml` crate does not have any functionality for updating a file’s data while preserving user comments, only full serializing and deserializing.

The chosen solution is to apply naive textual replacements to the file, while also making semantic edits to the `struct` that the file is deserialized into. After the edits are symmetrically applied to both forms, we re-read the TOML to ensure that it parses without error and produces the expected `struct` result. This can fail and error out if the user has made _heavy_ edits to the file, but if it succeeds, the file is guaranteed to be correct.

This solution also suggests a straightforward templated approach to applying any necessary future config file changes.

## Migrating from deprecated `failure` crate for error handling

> <https://github.com/mimblewimble/grin/pull/3633>
>
> Will write detailed review notes soon.
> 
> To do:
> \- \[\] Consider how best to han…dle conversion from \`.context()\`

Assessed the feasibility of this migration by removing `failure` and re-implementing error handling with the `thiserror` crate. Successfully performed the replacement, which passes all tests. There are some subtleties regarding differences in how `failure` and `thiserror` handle reporting error context information that I’ll clean up in the coming weeks. This also needs solid review notes to make for an easier code review due to the number of changes involved.

## Formal specification & verified implementation of bulletproofs

> [@Investigation: Formal proofs & alternate "verifier" implementation](https://forum.grin.mw/t/investigation-formal-proofs-alternate-verifier-implementation/8712):
>
> With the recent rangeproof inflation bug, there has been increased talk about ensuring the integrity of the chain in the face of possible undetected implementation errors. I’m very interested in developing a principled approach to this problem. We have a distinct advantage over many other formal proof / verification applications — we can have multiple implementations that are optimized for different aspects of the problem, and the ecosystem as a whole benefits from the superset of all of them.…

This is a longer-term project that has important implications for our confidence in chain integrity. The general idea is to develop a clear, concise formal specification or implementation of bulletproofs that can be easily compared against the bulletproofs paper, and run as a parallel implementation to help mitigate any potential exploitable errors in the primary bulletproofs implementation.

There’s some behind-the-scenes work going on here that I’ll hopefully be able to share soon.

---

<div class="post-metadata">

**Author:** ![satoshocrat](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/satoshocrat/32/3985_2.png) [@satoshocrat](https://forum.grin.mw/u/satoshocrat)\
**Post date:** [May 31, 2021, 7:35pm UTC](https://forum.grin.mw/t/trevyn-progress-update-thread/8702/4 "2021-05-31T19:35:02Z")

</div>

Great! Hope all is well, we appreciate you and your contributions! 💛💪🕶
