Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
update tools configs (#611)
Browse files Browse the repository at this point in the history
* update tools configs

* minor updates
  • Loading branch information
fedekunze authored Nov 24, 2020
1 parent 3072376 commit 66d1918
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ linters:
- unused
- unparam
- misspell
# TODO: address these lint issues
# - wsl
# - nolintlint

issues:
exclude-rules:
Expand Down Expand Up @@ -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 changes: 10 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 12 additions & 6 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -57,4 +61,6 @@ ignore:
- "x/faucet"
- "**/*.pb.go"
- "types/*.pb.go"
- "tests/*"
- "x/**/*.pb.go"
- "scripts/"
20 changes: 12 additions & 8 deletions tests-solidity/suites/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
Expand All @@ -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))
Expand All @@ -97,20 +101,21 @@ 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
}

return rpcRes, nil
}

func main() {
var hash hexutil.Bytes

dat, err := ioutil.ReadFile(HOME + "/counter/counter_sol.bin")
if err != nil {
log.Fatal(err)
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions utils/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ func MarshalBigInt(i *big.Int) (string, error) {
if err != nil {
return "", err
}

return string(bz), nil
}

Expand All @@ -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
}

Expand All @@ -38,5 +42,6 @@ func MustUnmarshalBigInt(s string) *big.Int {
if err != nil {
panic(err)
}

return ret
}

0 comments on commit 66d1918

Please sign in to comment.