Merge pull request #48 from sikkatech/sunny/46

remove http request in validatebasic
This commit is contained in:
Ethan Frey 2020-01-23 22:41:53 +01:00 committed by GitHub
commit 7c9b48071a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 21 deletions

View File

@ -52,20 +52,6 @@ func TestInitGenesis(t *testing.T) {
res = h(data.ctx, msg) res = h(data.ctx, msg)
require.False(t, res.IsOK()) require.False(t, res.IsOK())
t.Log("fail with unreachable source url")
msg = MsgStoreCode{
Sender: creator,
WASMByteCode: testContract,
Source: "https://github.com/cosmwasm/wasmddddddrandom",
Builder: "",
}
sdkerr = msg.ValidateBasic()
require.Error(t, sdkerr)
res = h(data.ctx, msg)
require.False(t, res.IsOK())
t.Log("fail with invalid build tag") t.Log("fail with invalid build tag")
msg = MsgStoreCode{ msg = MsgStoreCode{
Sender: creator, Sender: creator,

View File

@ -2,7 +2,6 @@ package types
import ( import (
"encoding/json" "encoding/json"
"net/http"
"net/url" "net/url"
"regexp" "regexp"
@ -50,12 +49,6 @@ func (msg MsgStoreCode) ValidateBasic() sdk.Error {
if !u.IsAbs() { if !u.IsAbs() {
return sdk.ErrInternal("source should be an absolute url") return sdk.ErrInternal("source should be an absolute url")
} }
// check if the source is reachable
resp, err := http.Get(msg.Source)
if err != nil || resp.StatusCode != 200 {
return sdk.ErrInternal("source url is not reachable")
}
} }
if msg.Builder != "" { if msg.Builder != "" {