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

Move context lock into network.issueTx #2525

Merged
merged 12 commits into from
Dec 22, 2023
Merged

Move context lock into network.issueTx #2525

merged 12 commits into from
Dec 22, 2023

Conversation

joshua-kim
Copy link
Contributor

Why this should be merged

P-chain counterpart to #2524

How this works

Moves the context lock grab into issueTx to be held while verification is being done

How this was tested

UTs

@joshua-kim joshua-kim marked this pull request as ready for review December 20, 2023 22:17
@joshua-kim joshua-kim self-assigned this Dec 20, 2023
@joshua-kim joshua-kim added the networking This involves networking label Dec 20, 2023
vms/platformvm/service.go Outdated Show resolved Hide resolved
Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

just a question around locking in test. Other than that lgtm

Base automatically changed from pchain-thread-safe-mempool to dev December 21, 2023 21:34
vms/platformvm/service.go Outdated Show resolved Hide resolved
vms/platformvm/service.go Show resolved Hide resolved
vms/platformvm/service.go Outdated Show resolved Hide resolved
vms/platformvm/block/builder/builder_test.go Outdated Show resolved Hide resolved
vms/platformvm/validator_set_property_test.go Show resolved Hide resolved
vms/platformvm/validator_set_property_test.go Show resolved Hide resolved
vms/platformvm/vm_test.go Outdated Show resolved Hide resolved
@joshua-kim joshua-kim force-pushed the move-ctx-lock branch 3 times, most recently from 8db7029 to ab299db Compare December 22, 2023 09:30
@joshua-kim joshua-kim changed the base branch from dev to export-mempool-errors December 22, 2023 09:32
@joshua-kim joshua-kim force-pushed the move-ctx-lock branch 2 times, most recently from 578fc8e to be0321c Compare December 22, 2023 15:39
vms/platformvm/service.go Outdated Show resolved Hide resolved
return fmt.Errorf("couldn't format address: %w", err)
}

return s.vm.issueTx(req.Context(), tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was slightly concerned providing req.Context() here in the X-chain because these contexts can be cancelled by the client invoking this API... We also document that if AppSender returns an error it should be treated as FATAL... However for the rpcchainvm the gRPC server may return an error if the provided context is cancelled... We never expect the platformvm to run in to this situation... but wanted to note this so that we could talk about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also document that if AppSender returns an error it should be treated as FATAL

I remember this being an invariant but I never understood why. Why can't a sender just log the error and move on? If we're letting the request context be cancelled by the client which is a legitimate use-case I feel like we shouldn't be expected to fatal.

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment was a prior invariant before we passed the context over the gRPC. Feel free to make a PR to remove that comment

vms/platformvm/service.go Outdated Show resolved Hide resolved
vms/platformvm/service.go Show resolved Hide resolved
vms/platformvm/service.go Show resolved Hide resolved
vms/platformvm/service.go Show resolved Hide resolved
vms/platformvm/vm.go Outdated Show resolved Hide resolved
Base automatically changed from export-mempool-errors to dev December 22, 2023 16:10
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 22, 2023
Merged via the queue into dev with commit 1284454 Dec 22, 2023
17 checks passed
@StephenButtolph StephenButtolph deleted the move-ctx-lock branch December 22, 2023 20:50
@StephenButtolph StephenButtolph added this to the v1.10.18 milestone Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking This involves networking
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants