Repository navigation
[ANCHOR-1399]: Publish SEP-45 and Platform API fields under their snake_case wire keys - #2086
Open
ceciliaromao wants to merge 7 commits into
Open
ceciliaromao wants to merge 7 commits into
ceciliaromao wants to merge 7 commits into
Conversation
…s on GetTransactionResponse
…ne controller test
… and an under-scanning classpath
…ired_info_updates_fields
…e reporter's validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GetTransactionResponsenow publishesfunding_method(wasfundingMethod) andrequired_info_updates_fields(wasrequiredInfoUpdatesFields). The unannotated redeclaration ofrequiredInfoUpdatesFieldsthat shadowed the annotated field inPlatformTransactionDatais deleted, so the key is emitted once and matches what the PATCH side already accepts.sep45/ChallengeResponse,sep45/ValidationRequest,sep45/ChallengeRequestandsep10/ChallengeRequestget@SerializedNamenext to the existing@JsonProperty.GET /sep45/authnow answersauthorization_entries/network_passphrase, andPOST /sep45/authwith a JSON body{"authorization_entries": "..."}is accepted instead of failing with400 authorization_entries is required.AnchorEvent.clientName/clientDomainare now published asclient_name/client_domain, like the event's owntransaction.Sep45Service.validatenow answers400 Failed to decode auth entriesfor any value that is not valid base64. It used to catch onlyIOException, soIllegalArgumentExceptionfrom the decoder surfaced as a 500.WireKeyNamingTest, a standalone-MockMvcSep45ControllerTest(real Gson converter), and updatedTransactionMapperTest/ClientStatusCallbackHandlerTest.JacksonOnlyDtoGuardTestfails the build on two cases inorg.stellar.anchor.api: a field with@JsonPropertyand no@SerializedNameof the same value, and a serialized field whose wire key contains an upper-case letter (six named exceptions, each with its reason). It also asserts that its scan reaches the classes Spring's default filter skips.core/build.gradle.ktsgainstestImplementation(libs.jackson.annotations)for its self-test.Context
spring.mvc.converters.preferred-json-mapper=gson) andGsonUtils.builder()sets noFieldNamingPolicy, so@JsonPropertyis inert and an unannotated field goes out under its camelCase Java name.Sep45TestsandTransactionMapperTestround-trip through the same DTO, so a wrong key is symmetric.TransactionMapperTesteven asserted the camelCase keys; those two assertions are updated.@SerializedName, not with a globalFieldNamingPolicy:GsonUtils.getInstance()also serializes DB JSON columns and the event queue, so a global policy would silently rename every unannotated field.Testing
./gradlew test./gradlew :core:test :platform:testunfiltered: core 1151 tests, platform 1427, 0 failures, 0 errors, 0 skipped.developfor the reason in the report (authorizationEntrieson the challenge,authorization_entriesleft null on a JSON body) and pass with the fix.Sep45Tests,Sep31End2EndTests).Documentation
N/A. The upstream Platform API OpenAPI (
stellar-docs/openapi/anchor-platform) documents neitherfundingMethodnorfunding_method, nor either spelling ofrequired_info_updates_fields, so there is no published contract to update.Known limitations
fundingMethodorrequiredInfoUpdatesFieldsfrom the Platform API or fromAnchorEvent.transaction, orclientName/clientDomainfrom theAnchorEventpublished to Kafka, SQS or the event callback, read nothing after the upgrade. No dual emission was added, and during a rolling upgrade an old consumer and a new producer disagree on the key. This belongs in the release notes.ClientConfigRequest/ClientConfigResponse(PUT /clients/{name}and the other/clientsendpoints) still use camelCase keys (signingKeys,callbackUrls,allowAnyDestination,destinationAccounts) in both directions. The endpoint has been released since 4.7.0, so renaming it would break existing callers; left unchanged on purpose. It lives outsideorg.stellar.anchor.api, so the guard does not scan it.requestClientIpAddressstays camelCase on the five request DTOs; the controllers overwrite it from the connection and never read it from the body (see [ANCHOR-1398]: Derive request_client_ip_address from a trusted source #2085).