Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[diem-framework] Add force shift event to CRSNs, add gate #9204

Merged
merged 1 commit into from Sep 20, 2021

Conversation

tzakian
Copy link
Contributor

@tzakian tzakian commented Sep 16, 2021

This PR updates CRSNs to:

  • Be able to be turned on after the new Diem Framework code is released
  • To emit a ForceShiftEvent whenever a force shift event occurs

It also adds tests to make sure that the gating is respected in the Framework, and that ForceShiftEvents are emitted when force shifting.

shift_amount: u64,
/// The state of the bitvector just before the shift (NB: the sequence
/// nonce of the shifting transaction will not be set).
bits_at_shift: BitVector,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random thought: is there any reason why the BitVector uses a vector<bool>? do we have a specialized compact serialization for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: also maybe add a small comment on why we need the bits_at_shift here, like "the bitvector state is needed to prove that a CRSN slot was expired and not already consumed; therefore, a user transaction at that slot can't exist (because that slot was expired)."

Copy link
Contributor Author

@tzakian tzakian Sep 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random thought: is there any reason why the BitVector uses a vector? do we have a specialized compact serialization for that?

Good question. The underlying bitvector representation can be compacted (e.g., to use vec<u64>), however verifying code that does computation around bitshifts is incredibly difficult, so there are issues with a more complex dense representation of these and we decided to go with vec<bool> for now.

language/diem-framework/modules/CRSN.move Show resolved Hide resolved
runtian-zhou
runtian-zhou previously approved these changes Sep 20, 2021
Copy link
Contributor

@runtian-zhou runtian-zhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

}

/// Whenever a force shift is performed a `ForceShiftEvent` is emitted.
/// This is used to prove the absence of a transaction at a specific sequence nonce.
struct ForceShiftEvent has drop, store {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to double check store here is to work with the phantom type parameter in the event handle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! it needs a T: drop + store so this needs store to match up with those restrictions.

@tzakian
Copy link
Contributor Author

tzakian commented Sep 20, 2021

/land

@bors-libra bors-libra moved this from In Review to Queued in bors Sep 20, 2021
* Be able to be turned on after release
* To emit a `ForceShiftEvent` whenever a force shift event occurs

Closes: diem#9204
@bors-libra bors-libra moved this from Queued to Testing in bors Sep 20, 2021
@github-actions
Copy link

Cluster Test Result

Test runner setup time spent 265 secs
Compatibility test results for land_716327e5 ==> land_5f9d2414 (PR)
1. All instances running land_716327e5, generating some traffic on network
2. First full node land_716327e5 ==> land_5f9d2414, to validate new full node to old validator node traffic
3. First Validator node land_716327e5 ==> land_5f9d2414, to validate storage compatibility
4. First batch validators (14) land_716327e5 ==> land_5f9d2414, to test consensus and traffic between old full nodes and new validator node
5. First batch full nodes (14) land_716327e5 ==> land_5f9d2414
6. Second batch validators (15) land_716327e5 ==> land_5f9d2414, to upgrade rest of the validators
7. Second batch of full nodes (15) land_716327e5 ==> land_5f9d2414, to finish the network upgrade, time spent 673 secs
all up : 1171 TPS, 3878 ms latency, 4400 ms p99 latency, no expired txns, time spent 250 secs
Logs: http://kibana.ct-1-k8s-testnet.aws.hlw3truzy4ls.com/app/kibana#/discover?_g=(time:(from:'2021-09-20T20:06:34Z',to:'2021-09-20T20:29:12Z'))
Dashboard: http://grafana.ct-1-k8s-testnet.aws.hlw3truzy4ls.com/d/performance/performance?from=1632168394000&to=1632169752000
Validator 1 logs: http://kibana.ct-1-k8s-testnet.aws.hlw3truzy4ls.com/app/kibana#/discover?_g=(time:(from:'2021-09-20T20:06:34Z',to:'2021-09-20T20:29:12Z'))&_a=(columns:!(log),query:(language:kuery,query:'kubernetes.pod_name:"val-1"'),sort:!(!('@timestamp',desc)))

Repro cmd:

./scripts/cti --tag land_716327e5 --cluster-test-tag land_5f9d2414 -E BATCH_SIZE=15 -E UPDATE_TO_TAG=land_5f9d2414 --report report.json --suite land_blocking_compat

🎉 Land-blocking cluster test passed! 👌

@bors-libra bors-libra removed this from Testing in bors Sep 20, 2021
@bors-libra bors-libra merged commit 5f9d241 into diem:main Sep 20, 2021
@bors-libra bors-libra temporarily deployed to Sccache September 20, 2021 20:31 Inactive
@bors-libra bors-libra temporarily deployed to Docker September 20, 2021 20:31 Inactive
@bors-libra bors-libra temporarily deployed to Sccache September 20, 2021 20:31 Inactive
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.

None yet

4 participants