Skip to content

feat(IC-1579): TLA-code link for split_neuron - #913

Merged
oggy-dfin merged 55 commits into
masterfrom
oggy-split-neuron-localkey
Oct 9, 2024
Merged

oggy-dfin merged 55 commits into
masterfrom
oggy-split-neuron-localkey

Conversation

@oggy-dfin

@oggy-dfin oggy-dfin commented Aug 13, 2024 •

Copy link
Copy Markdown
Contributor

This is the first change to link the behavior in the existing tests of the split_neuron method on the NNS governance with the corresponding TLA model. In this PR, only the pure Rust-based tests are instrumented to check the link; I plan to follow up with another PR linking the canister-based tests as well (this will require adding a new test-only query method to fetch the TLA traces), but I'm opening this now to allow Andy to work on claim_neuron concurrently.

The PR consists of roughly four sets of changes:

  1. Conditional (under the tla crate feature) instrumentation of production code
  2. TLA model of split neuron and the mapping of the Rust state to TLA state (the tla module under governance)
  3. Conditional checks in the Rust based tests of split neuron. These can be disabled permanently through feature_flags.bzl or on the temporarily on the Bazel command line with --define tla_disabled=true
  4. The Bazel/Cargo config. There's perhaps a bit more splitting of Bazel targets into "regular" and --test_feature than optimal, due to the fact that the SNS swap depends on the IcpLedgerCanister even when not compiled into a canister, but I didn't dare try to change this.

Unit tests likely won't work because of async access (due to how Rust execute tests) to the static global mutable InstrumentationStack
TODO: do requests/responses in the ledger directly
Rust analyzer doesn't seem to find the imports when they are defined in the workspace Cargo.toml
@oggy-dfin
oggy-dfin requested a review from a team as a code owner October 1, 2024 15:43
Completely reshuffled the structure of the code in the process of merging
@oggy-dfin
oggy-dfin requested a review from a team as a code owner October 2, 2024 15:42
@github-actions github-actions Bot added the @idx label Oct 2, 2024
@oggy-dfin

Copy link
Copy Markdown
Contributor Author

@max-dfinity I've applied all the changes that we discussed (adapted a bit since moving the "logging" canister to governance enabled me to trim the Bazel targets more aggressively - that was a good suggestion, thanks).

One blip now is that I pushed the test canister to just above 1.4 MB in size (i.e., just above the current limit). I've followed the instructions to add some headroom and set the limit to 1.7MB now, hopefully that's OK.

@oggy-dfin
oggy-dfin requested a review from max-dfinity October 2, 2024 17:16
@max-dfinity

Copy link
Copy Markdown
Contributor

LGTM, approved

@oggy-dfin
oggy-dfin enabled auto-merge October 9, 2024 13:46
@oggy-dfin
oggy-dfin added this pull request to the merge queue Oct 9, 2024
Merged via the queue into master with commit 8f73698 Oct 9, 2024
@oggy-dfin
oggy-dfin deleted the oggy-split-neuron-localkey branch October 9, 2024 14:26
nikolay-komarevskiy pushed a commit that referenced this pull request Oct 11, 2024
This is the first change to link the behavior in the existing tests of
the `split_neuron` method on the NNS governance with the corresponding
TLA model. In this PR, only the pure Rust-based tests are instrumented
to check the link; I plan to follow up with another PR linking the
canister-based tests as well (this will require adding a new test-only
query method to fetch the TLA traces), but I'm opening this now to allow
Andy to work on `claim_neuron` concurrently.

The PR consists of roughly four sets of changes:
1. Conditional (under the `tla` crate feature) instrumentation of
production code
2. TLA model of split neuron and the mapping of the Rust state to TLA
state (the `tla` module under governance)
3. Conditional checks in the Rust based tests of split neuron. These can
be disabled permanently through `feature_flags.bzl` or on the
temporarily on the Bazel command line with `--define tla_disabled=true`
4. The Bazel/Cargo config. There's perhaps a bit more splitting of Bazel
targets into "regular" and `--test_feature` than optimal, due to the
fact that the SNS `swap` depends on the `IcpLedgerCanister` even when
not compiled into a canister, but I didn't dare try to change this.

---------

Co-authored-by: IDX GitHub Automation <[email protected]>
github-merge-queue Bot pushed a commit that referenced this pull request Oct 17, 2024
Follow up to #913, adding code link for claim_neuron.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants