fix: sync Android join RPC admission
This commit is contained in:
parent
8e00a58112
commit
511f25efc2
4 changed files with 40 additions and 11 deletions
2
go.mod
2
go.mod
|
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/golang-migrate/migrate/v4 v4.19.1
|
||||
github.com/gotd/ige v0.2.2
|
||||
github.com/gotd/log/logzap v0.1.1
|
||||
github.com/iamxvbaba/td v1.1.3
|
||||
github.com/iamxvbaba/td v1.1.4
|
||||
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
|
||||
github.com/jackc/pgx/v5 v5.9.2
|
||||
github.com/lestrrat-go/jwx/v3 v3.1.1
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -82,8 +82,8 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
|
|||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
github.com/iamxvbaba/td v1.1.3 h1:g9GE2jZVB1U1N8HuaRy707EzYfcsEuXIC//wI23VYsg=
|
||||
github.com/iamxvbaba/td v1.1.3/go.mod h1:oG/fu7sqGC7NznoBD8f3fmTy9NFR42+DMNtdCPStX04=
|
||||
github.com/iamxvbaba/td v1.1.4 h1:N0WIo6pqBJdMb+9vQiqlqHfZDV1FmGgf+YH/m7uEwuQ=
|
||||
github.com/iamxvbaba/td v1.1.4/go.mod h1:oG/fu7sqGC7NznoBD8f3fmTy9NFR42+DMNtdCPStX04=
|
||||
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa h1:s+4MhCQ6YrzisK6hFJUX53drDT4UsSW3DEhKn0ifuHw=
|
||||
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ func TestUpgradePrivateLayerRPCOnlyAcceptsAuditedAndroidConstructors(t *testing.
|
|||
}
|
||||
|
||||
func TestGeneratedPrivateLayerRPCOverlayHasAllAuditedMethods(t *testing.T) {
|
||||
if got, want := tlprofile.ClientRPCOverlayMethodCount(tlprofile.ClientRPCOverlayDrkloAndroid), 15; got != want {
|
||||
if got, want := tlprofile.ClientRPCOverlayMethodCount(tlprofile.ClientRPCOverlayDrkloAndroid), 17; got != want {
|
||||
t.Fatalf("generated DrKLO method count = %d, want %d", got, want)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,12 @@ import (
|
|||
)
|
||||
|
||||
type androidPrivateLayerFixture struct {
|
||||
name string
|
||||
privateID uint32
|
||||
semantic tlprofile.SemanticID
|
||||
method string
|
||||
wire func(*testing.T) []byte
|
||||
name string
|
||||
privateID uint32
|
||||
semantic tlprofile.SemanticID
|
||||
method string
|
||||
currentJoinResult bool
|
||||
wire func(*testing.T) []byte
|
||||
}
|
||||
|
||||
// TestAndroidPrivateLayerRPCsAdaptAcrossCanonicalBoundary is the production
|
||||
|
|
@ -34,7 +35,7 @@ type androidPrivateLayerFixture struct {
|
|||
func TestAndroidPrivateLayerRPCsAdaptAcrossCanonicalBoundary(t *testing.T) {
|
||||
r := New(Config{DC: 2, IP: "127.0.0.1", Port: 2398}, Deps{}, zaptest.NewLogger(t), clock.System)
|
||||
fixtures := androidPrivateLayerFixtures()
|
||||
if got, want := len(fixtures), 15; got != want {
|
||||
if got, want := len(fixtures), 17; got != want {
|
||||
t.Fatalf("private fixture count = %d, want %d", got, want)
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +87,17 @@ func TestAndroidPrivateLayerRPCsAdaptAcrossCanonicalBoundary(t *testing.T) {
|
|||
if !ok || call.WireID() != wantWireID {
|
||||
t.Fatalf("admitted exact id = %#x, want %#x (ok=%v)", call.WireID(), wantWireID, ok)
|
||||
}
|
||||
if fixture.currentJoinResult {
|
||||
var result bin.Buffer
|
||||
if err := call.EncodeResult(&tg.MessagesChatInviteJoinResultOk{
|
||||
Updates: &tg.UpdatesTooLong{},
|
||||
}, &result); err != nil {
|
||||
t.Fatalf("encode current join result: %v", err)
|
||||
}
|
||||
if wireID, err := result.PeekID(); err != nil || wireID != 0x445663a7 {
|
||||
t.Fatalf("result wire = %#x err=%v, want chatInviteJoinResultOk#445663a7", wireID, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
@ -109,6 +121,24 @@ func androidPrivateLayerFixtures() []androidPrivateLayerFixture {
|
|||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "messages.importChatInvite_alias", privateID: 0x6c50051c,
|
||||
semantic: tlprofile.SemanticMethodMessagesImportChatInvite, method: "messages.importChatInvite",
|
||||
currentJoinResult: true,
|
||||
wire: func(t *testing.T) []byte {
|
||||
return androidPrivateAliasWire(t, 0x6c50051c, &tg.MessagesImportChatInviteRequest{Hash: "private-invite"})
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "channels.joinChannel_alias", privateID: 0x24b524c5,
|
||||
semantic: tlprofile.SemanticMethodChannelsJoinChannel, method: "channels.joinChannel",
|
||||
currentJoinResult: true,
|
||||
wire: func(t *testing.T) []byte {
|
||||
return androidPrivateAliasWire(t, 0x24b524c5, &tg.ChannelsJoinChannelRequest{
|
||||
Channel: &tg.InputChannel{ChannelID: 45, AccessHash: 46},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "updates.getDifference_alias", privateID: 0x25939651,
|
||||
semantic: tlprofile.SemanticMethodUpdatesGetDifference, method: "updates.getDifference",
|
||||
|
|
@ -121,7 +151,6 @@ func androidPrivateLayerFixtures() []androidPrivateLayerFixture {
|
|||
semantic: tlprofile.SemanticMethodMessagesCreateChat, method: "messages.createChat",
|
||||
wire: func(t *testing.T) []byte {
|
||||
return androidPrivateAliasWire(t, 0x0034a818, &tg.MessagesCreateChatRequest{
|
||||
Users: []tg.InputUserClass{&tg.InputUser{UserID: 51, AccessHash: 52}},
|
||||
Title: "private group",
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue