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

[TrafficController] correctly categorize spam #18324

Merged
merged 3 commits into from
Jun 27, 2024
Merged

Conversation

williampsmith
Copy link
Contributor

@williampsmith williampsmith commented Jun 19, 2024

Description

This PR redefines spam in the context of traffic controller as any request type that does not consume gas. There are two such categories that have bee considered so far - read api requests and transaction execution requests that do not invoke the vm (which, to my knowledge, should only happen on submitting a certificate for an already executed transaction, at which point all validators simply read and return the effects). Both cases are hadled here.

Test plan

Fixed existing tests to exercise the new logic


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2024 0:26am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 27, 2024 0:26am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 27, 2024 0:26am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Jun 27, 2024 0:26am

}
Err(err) => {
Err(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this could just be .map(|(result, _)| result)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

if !policy_config.spam_sample_rate.is_sampled().await {
let sampled = futures::future::join_all(vec![
tally.spam_weight.is_sampled(),
policy_config.spam_sample_rate.is_sampled(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why this requires anything async or join_all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed this, you're right the function called here doesn't need to be async

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

// unless request requires gas payment, count against
// spam tally
match method.as_str() {
"sui_executeTransactionBlock" | "sui_devInspectTransactionBlock" => Weight::zero(),
Copy link
Contributor

Choose a reason for hiding this comment

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

So, sui_devInspectTransactionBlock certainly could be spammed, and arguable a fullnode operator would want to count sui_executeTransactionBlock as spam as well, since its the validators that are being paid, not them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@williampsmith williampsmith enabled auto-merge (squash) June 27, 2024 00:32
@williampsmith williampsmith merged commit a025ca0 into main Jun 27, 2024
48 checks passed
@williampsmith williampsmith deleted the william/spam-counting branch June 27, 2024 00:53
williampsmith added a commit that referenced this pull request Jun 27, 2024
## Description 

This PR redefines spam in the context of traffic controller as any
request type that does not consume gas. There are two such categories
that have bee considered so far - read api requests and transaction
execution requests that do not invoke the vm (which, to my knowledge,
should only happen on submitting a certificate for an already executed
transaction, at which point all validators simply read and return the
effects). Both cases are hadled here.

## Test plan 

Fixed existing tests to exercise the new logic

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
@williampsmith williampsmith mentioned this pull request Jun 27, 2024
7 tasks
williampsmith added a commit that referenced this pull request Jun 27, 2024
## Description 

CP #18396 and
#18324

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
tx-tomcat pushed a commit to tx-tomcat/sui-network that referenced this pull request Jul 29, 2024
## Description 

This PR redefines spam in the context of traffic controller as any
request type that does not consume gas. There are two such categories
that have bee considered so far - read api requests and transaction
execution requests that do not invoke the vm (which, to my knowledge,
should only happen on submitting a certificate for an already executed
transaction, at which point all validators simply read and return the
effects). Both cases are hadled here.

## Test plan 

Fixed existing tests to exercise the new logic

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants