-
Notifications
You must be signed in to change notification settings - Fork 214
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
API account counter issue #2104
Comments
The old api had I agree that it can be confusing to get an account info without the projected values. I think that from an api-consumer perspective it's best to get those values as part of the existing account endpoints, in addition to the "final" data from the state. Any reason not to do it that way? |
I agree. I'll update the API to add projected as well as current state values. |
The API has been updated. I'm adding support for the latest API release in #2133 which should take care of this. |
Closes #2133 Closes #2104 - Upgrade to spacemesh API v1.0.0. Major API changes include: - split account state into current/projected (spacemeshos/api#111) - align node error types with zapcore error types (spacemeshos/api#102) - harmonize layernum type as uint32 (spacemeshos/api#120) - add an unimplemented SmesherService endpoint (EstimatedRewards) (spacemeshos/api#101) - Upgrade google modules (required by API) No new tests are needed. No new functionality has been added to the API. Existing tests have been updated. There are no docs to update. Master API docs live in the API repository and have already been updated. Implementation docs are still a work in progress in #2083. - [x] Finish upgrading API code Note: Google modules were upgraded because cmd/sync imports google.golang.org/api/option, and the version it was importing was incompatible with google.golang.org/grpc >= v1.30.0. More info here: - google/trillian#2195 - etcd-io/etcd#12124 Here's the error I was getting: ``` > go mod tidy go: finding module for package google.golang.org/grpc/naming github.com/spacemeshos/go-spacemesh/cmd/sync imports google.golang.org/api/option imports google.golang.org/api/internal imports google.golang.org/grpc/naming: module google.golang.org/grpc@latest found (v1.32.0), but does not contain package google.golang.org/grpc/naming ``` For reference here are the API changes: spacemeshos/api@49b94a5...v1.0.0
Description
Calling
GlobalStateService.Account
returns the actual account counter (nonce) (along with balance) from global state. However, this is not the counter value that should be included in a newly-submitted tx. For a new tx, the system expects the counter to match the projected counter value returned byTransactionProcessor.GetProjection
, which factors in pending transactions:go-spacemesh/mesh/meshdb.go
Lines 576 to 584 in 1c81878
If a client naively reads account data from the API, then tries to submit a tx, it will fail as a result.
CC @noamnelke @avive, would appreciate your input on this.
Steps To Reproduce
GlobalStateService.Account
TransactionService.SubmitTransaction
using the account counter you just got. If there are any pending txs from this sender, it will fail.Expected Behavior
I see a few options:
The text was updated successfully, but these errors were encountered: