Add all test cases to integration tests for indexer - #346
Conversation
This reverts commit 64015ae.
|
|
||
| if issuerFlags.IsAuthRequired() { | ||
| flags = append(flags, "authorized_flag") | ||
| if entryAssetCode == assetCode && entryAssetIssuer == assetIssuer { |
There was a problem hiding this comment.
we remove the null bytes from entryAssetCode but compares against assetCode directly. Do we also need to remove null bytes from assetCode?
There was a problem hiding this comment.
@aristidesstaffieri The assetCode comes from string details from the effects output: https://github.com/stellar/wallet-backend/blob/main/internal/indexer/processors/effects.go#L291.
The entryAssetCode is derived from XDR binary data alphanum4.AssetCode[:], alphanum12.AssetCode[:]. They are fixed length arrays so they have null bytes added at the end for padding. So we have to remove the null bytes to convert the string from USD\x00 to USD
| stateChanges = append(stateChanges, p.createStateChange(types.StateChangeCategoryAccount, types.StateChangeReasonCreate, transfer.GetTo(), "", "", builder.Clone().WithFunder(funder))) | ||
| case xdr.OperationTypeAccountMerge: | ||
| stateChanges = append(stateChanges, p.createStateChange(types.StateChangeCategoryAccount, types.StateChangeReasonMerge, transfer.GetTo(), transfer.GetAmount(), "", builder.Clone())) | ||
| stateChanges = append(stateChanges, p.createStateChange(types.StateChangeCategoryAccount, types.StateChangeReasonMerge, transfer.GetTo(), "", "", builder.Clone())) |
There was a problem hiding this comment.
why is the transfer amount an empty string now?
There was a problem hiding this comment.
@aristidesstaffieri Hmmm, we are already creating CREDIT/DEBIT state changes for XLM transfers involving the creation and merging of accounts. These separate ACCOUNT CREATE/MERGE are for information purposes so we dont have the amount there
| // getTrustlineFlagsFromChanges extracts the trustline flags from transaction changes | ||
| func (p *EffectsProcessor) getTrustlineFlagsFromChanges(trustorAddress, assetCode, assetIssuer string, changes []ingest.Change) (xdr.TrustLineFlags, error) { | ||
| // Search through changes to find the trustline entry for this specific asset and trustor | ||
| for _, change := range changes { |
There was a problem hiding this comment.
can there be multiple trustline entries in a list of changes? If so, this returns only the first(which would presumable not be the final state if we had several changes).
There was a problem hiding this comment.
@aristidesstaffieri These changes are for that particular operation only: https://github.com/stellar/wallet-backend/blob/main/internal/indexer/processors/effects.go#L97. So, technically there wouldnt be any other trustline entries and even if there is, there wouldnt be trustline entry with same asset and trustorAddress
There was a problem hiding this comment.
ah gotcha, do you mind adding a comment on why this is ok.
What
Why
End to end testing of wallet backend indexer
Known limitations
N/A
Issue that this PR addresses
#330 #331