update tools configs (#611)

* update tools configs

* minor updates
This commit is contained in:
Federico Kunze 2020-11-24 16:43:08 +01:00 committed by GitHub
parent 3072376371
commit 66d19188f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 14 deletions

View File

@ -34,6 +34,9 @@ linters:
- unused
- unparam
- misspell
# TODO: address these lint issues
# - wsl
# - nolintlint
issues:
exclude-rules:
@ -63,3 +66,8 @@ linters-settings:
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false

10
.mergify.yml Normal file
View File

@ -0,0 +1,10 @@
pull_request_rules:
- name: automerge to master with label automerge and branch protection passing
conditions:
- "#approved-reviews-by>1"
- base=development
- label=automerge
actions:
merge:
method: squash
strict: true

View File

@ -15,15 +15,19 @@ coverage:
threshold: 1% # allow this much decrease on project
app:
target: 70%
flags: app
flags:
- app
modules:
target: 50%
flags: modules
target: 70%
flags:
- modules
core:
target: 50%
flags: core
clients:
flags: clients
flags:
- core
client:
flags:
- client
changes: false
comment:
@ -57,4 +61,6 @@ ignore:
- "x/faucet"
- "**/*.pb.go"
- "types/*.pb.go"
- "tests/*"
- "x/**/*.pb.go"
- "scripts/"

View File

@ -49,12 +49,14 @@ func createRequest(method string, params interface{}) Request {
func getTransactionReceipt(hash hexutil.Bytes) (map[string]interface{}, error) {
param := []string{hash.String()}
rpcRes, err := call("eth_getTransactionReceipt", param)
if err != nil {
return nil, err
}
receipt := make(map[string]interface{})
err = json.Unmarshal(rpcRes.Result, &receipt)
if err != nil {
return nil, err
@ -74,10 +76,13 @@ func waitForReceipt(hash hexutil.Bytes) (map[string]interface{}, error) {
time.Sleep(time.Second)
}
return nil, errors.New("cound not find transaction on chain")
}
func call(method string, params interface{}) (*Response, error) {
var rpcRes *Response
if HOST == "" {
HOST = "http://localhost:8545"
}
@ -87,7 +92,6 @@ func call(method string, params interface{}) (*Response, error) {
return nil, err
}
var rpcRes *Response
time.Sleep(1000000 * time.Nanosecond)
/* #nosec */
res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req))
@ -97,13 +101,12 @@ func call(method string, params interface{}) (*Response, error) {
decoder := json.NewDecoder(res.Body)
rpcRes = new(Response)
err = decoder.Decode(&rpcRes)
if err != nil {
if err := decoder.Decode(&rpcRes); err != nil {
return nil, err
}
err = res.Body.Close()
if err != nil {
if err := res.Body.Close(); err != nil {
return nil, err
}
@ -111,6 +114,8 @@ func call(method string, params interface{}) (*Response, error) {
}
func main() {
var hash hexutil.Bytes
dat, err := ioutil.ReadFile(HOME + "/counter/counter_sol.bin")
if err != nil {
log.Fatal(err)
@ -126,11 +131,10 @@ func main() {
log.Fatal(err)
}
var hash hexutil.Bytes
err = json.Unmarshal(txRPCRes.Result, &hash)
if err != nil {
if err := json.Unmarshal(txRPCRes.Result, &hash); err != nil {
log.Fatal(err)
}
fmt.Println("Contract TX hash: ", hash)
receipt, err := waitForReceipt(hash)

View File

@ -8,6 +8,7 @@ func MarshalBigInt(i *big.Int) (string, error) {
if err != nil {
return "", err
}
return string(bz), nil
}
@ -18,16 +19,19 @@ func MustMarshalBigInt(i *big.Int) string {
if err != nil {
panic(err)
}
return str
}
// UnmarshalBigInt unmarshalls string from *big.Int
func UnmarshalBigInt(s string) (*big.Int, error) {
ret := new(big.Int)
err := ret.UnmarshalText([]byte(s))
if err != nil {
return nil, err
}
return ret, nil
}
@ -38,5 +42,6 @@ func MustUnmarshalBigInt(s string) *big.Int {
if err != nil {
panic(err)
}
return ret
}