From fd5d5c2e78e60532dd640608088a4c7e4f786b2f Mon Sep 17 00:00:00 2001 From: Artem Poltorzhitskiy Date: Wed, 7 Feb 2024 15:29:46 +0100 Subject: [PATCH] Fix: smart rollup address validation (#1012) --- internal/bcd/ast/validators_test.go | 4 ++++ internal/bcd/literal.go | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/bcd/ast/validators_test.go b/internal/bcd/ast/validators_test.go index 444a90764..1c5693412 100644 --- a/internal/bcd/ast/validators_test.go +++ b/internal/bcd/ast/validators_test.go @@ -32,6 +32,10 @@ func TestAddressValidator(t *testing.T) { name: "test 5", value: "0x6e4943f7a23ab9cbe56f48ff72f6c27e8956762400", wantErr: true, + }, { + name: "test 6", + value: "sr18wx6ezkeRjt1SZSeZ2UQzQN3Uc3YLMLqg", + wantErr: false, }, } for _, tt := range tests { diff --git a/internal/bcd/literal.go b/internal/bcd/literal.go index 02dfd336d..5d53ea8be 100644 --- a/internal/bcd/literal.go +++ b/internal/bcd/literal.go @@ -28,7 +28,9 @@ func IsContractLazy(str string) bool { // IsAddressLazy - func IsAddressLazy(address string) bool { - return (len(address) == 36 && (strings.HasPrefix(address, "KT") || strings.HasPrefix(address, "tz"))) || + return (len(address) == 36 && (strings.HasPrefix(address, "KT") || + strings.HasPrefix(address, "tz") || + strings.HasPrefix(address, "sr1"))) || (len(address) == 37 && strings.HasPrefix(address, "txr")) }