diff --git a/integration/obscurogateway/gateway_user.go b/integration/obscurogateway/gateway_user.go index 433aac9d45..bb8a42cf1b 100644 --- a/integration/obscurogateway/gateway_user.go +++ b/integration/obscurogateway/gateway_user.go @@ -50,12 +50,24 @@ func NewUser(wallets []wallet.Wallet, serverAddressHTTP string, serverAddressWS } func (u GatewayUser) RegisterAccounts() error { + for _, w := range u.Wallets { + err := u.tgClient.RegisterAccount(w.PrivateKey(), w.Address()) + if err != nil { + return err + } + testlog.Logger().Info(fmt.Sprintf("Successfully registered address %s for user: %s. With EIP-712 message", w.Address().Hex(), u.tgClient.UserID())) + } + + return nil +} + +func (u GatewayUser) RegisterAccountsNonEIP712() error { for _, w := range u.Wallets { err := u.tgClient.RegisterAccountNonEP712(w.PrivateKey(), w.Address()) if err != nil { return err } - testlog.Logger().Info(fmt.Sprintf("Successfully registered address %s for user: %s.", w.Address().Hex(), u.tgClient.UserID())) + testlog.Logger().Info(fmt.Sprintf("Successfully registered address %s for user: %s. With personal sign message", w.Address().Hex(), u.tgClient.UserID())) } return nil diff --git a/integration/obscurogateway/tengateway_test.go b/integration/obscurogateway/tengateway_test.go index a06e199289..2f8989468d 100644 --- a/integration/obscurogateway/tengateway_test.go +++ b/integration/obscurogateway/tengateway_test.go @@ -100,6 +100,7 @@ func TestTenGateway(t *testing.T) { "testUnsubscribe": testUnsubscribe, "testClosingConnectionWhileSubscribed": testClosingConnectionWhileSubscribed, "testSubscriptionTopics": testSubscriptionTopics, + "testDifferentMessagesOnRegister": testDifferentMessagesOnRegister, } { t.Run(name, func(t *testing.T) { test(t, httpURL, wsURL, w) @@ -604,6 +605,20 @@ func testClosingConnectionWhileSubscribed(t *testing.T, httpURL, wsURL string, w subscription.Unsubscribe() } +func testDifferentMessagesOnRegister(t *testing.T, httpURL, wsURL string, w wallet.Wallet) { + user, err := NewUser([]wallet.Wallet{w, datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL) + require.NoError(t, err) + testlog.Logger().Info("Created user with encryption token: %s\n", user.tgClient.UserID()) + + // register all the accounts for the user with EIP-712 message format + err = user.RegisterAccounts() + require.NoError(t, err) + + // register all the accounts for the user with personal sign message format + err = user.RegisterAccountsNonEIP712() + require.NoError(t, err) +} + func transferRandomAddr(t *testing.T, client *ethclient.Client, w wallet.Wallet) common.TxHash { //nolint: unused ctx := context.Background() toAddr := datagenerator.RandomAddress()