parent
3072376371
commit
66d19188f6
@ -34,6 +34,9 @@ linters:
|
|||||||
- unused
|
- unused
|
||||||
- unparam
|
- unparam
|
||||||
- misspell
|
- misspell
|
||||||
|
# TODO: address these lint issues
|
||||||
|
# - wsl
|
||||||
|
# - nolintlint
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
@ -63,3 +66,8 @@ linters-settings:
|
|||||||
maligned:
|
maligned:
|
||||||
# print struct with more effective memory layout or not, false by default
|
# print struct with more effective memory layout or not, false by default
|
||||||
suggest-new: true
|
suggest-new: true
|
||||||
|
nolintlint:
|
||||||
|
allow-unused: false
|
||||||
|
allow-leading-space: true
|
||||||
|
require-explanation: false
|
||||||
|
require-specific: false
|
||||||
|
10
.mergify.yml
Normal file
10
.mergify.yml
Normal 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
|
18
codecov.yml
18
codecov.yml
@ -15,15 +15,19 @@ coverage:
|
|||||||
threshold: 1% # allow this much decrease on project
|
threshold: 1% # allow this much decrease on project
|
||||||
app:
|
app:
|
||||||
target: 70%
|
target: 70%
|
||||||
flags: app
|
flags:
|
||||||
|
- app
|
||||||
modules:
|
modules:
|
||||||
target: 50%
|
target: 70%
|
||||||
flags: modules
|
flags:
|
||||||
|
- modules
|
||||||
core:
|
core:
|
||||||
target: 50%
|
target: 50%
|
||||||
flags: core
|
flags:
|
||||||
clients:
|
- core
|
||||||
flags: clients
|
client:
|
||||||
|
flags:
|
||||||
|
- client
|
||||||
changes: false
|
changes: false
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
@ -57,4 +61,6 @@ ignore:
|
|||||||
- "x/faucet"
|
- "x/faucet"
|
||||||
- "**/*.pb.go"
|
- "**/*.pb.go"
|
||||||
- "types/*.pb.go"
|
- "types/*.pb.go"
|
||||||
|
- "tests/*"
|
||||||
- "x/**/*.pb.go"
|
- "x/**/*.pb.go"
|
||||||
|
- "scripts/"
|
||||||
|
@ -49,12 +49,14 @@ func createRequest(method string, params interface{}) Request {
|
|||||||
|
|
||||||
func getTransactionReceipt(hash hexutil.Bytes) (map[string]interface{}, error) {
|
func getTransactionReceipt(hash hexutil.Bytes) (map[string]interface{}, error) {
|
||||||
param := []string{hash.String()}
|
param := []string{hash.String()}
|
||||||
|
|
||||||
rpcRes, err := call("eth_getTransactionReceipt", param)
|
rpcRes, err := call("eth_getTransactionReceipt", param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
receipt := make(map[string]interface{})
|
receipt := make(map[string]interface{})
|
||||||
|
|
||||||
err = json.Unmarshal(rpcRes.Result, &receipt)
|
err = json.Unmarshal(rpcRes.Result, &receipt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -74,10 +76,13 @@ func waitForReceipt(hash hexutil.Bytes) (map[string]interface{}, error) {
|
|||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errors.New("cound not find transaction on chain")
|
return nil, errors.New("cound not find transaction on chain")
|
||||||
}
|
}
|
||||||
|
|
||||||
func call(method string, params interface{}) (*Response, error) {
|
func call(method string, params interface{}) (*Response, error) {
|
||||||
|
var rpcRes *Response
|
||||||
|
|
||||||
if HOST == "" {
|
if HOST == "" {
|
||||||
HOST = "http://localhost:8545"
|
HOST = "http://localhost:8545"
|
||||||
}
|
}
|
||||||
@ -87,7 +92,6 @@ func call(method string, params interface{}) (*Response, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var rpcRes *Response
|
|
||||||
time.Sleep(1000000 * time.Nanosecond)
|
time.Sleep(1000000 * time.Nanosecond)
|
||||||
/* #nosec */
|
/* #nosec */
|
||||||
res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req))
|
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)
|
decoder := json.NewDecoder(res.Body)
|
||||||
rpcRes = new(Response)
|
rpcRes = new(Response)
|
||||||
err = decoder.Decode(&rpcRes)
|
|
||||||
if err != nil {
|
if err := decoder.Decode(&rpcRes); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = res.Body.Close()
|
if err := res.Body.Close(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +114,8 @@ func call(method string, params interface{}) (*Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
var hash hexutil.Bytes
|
||||||
|
|
||||||
dat, err := ioutil.ReadFile(HOME + "/counter/counter_sol.bin")
|
dat, err := ioutil.ReadFile(HOME + "/counter/counter_sol.bin")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -126,11 +131,10 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hash hexutil.Bytes
|
if err := json.Unmarshal(txRPCRes.Result, &hash); err != nil {
|
||||||
err = json.Unmarshal(txRPCRes.Result, &hash)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Contract TX hash: ", hash)
|
fmt.Println("Contract TX hash: ", hash)
|
||||||
|
|
||||||
receipt, err := waitForReceipt(hash)
|
receipt, err := waitForReceipt(hash)
|
||||||
|
@ -8,6 +8,7 @@ func MarshalBigInt(i *big.Int) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(bz), nil
|
return string(bz), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,16 +19,19 @@ func MustMarshalBigInt(i *big.Int) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalBigInt unmarshalls string from *big.Int
|
// UnmarshalBigInt unmarshalls string from *big.Int
|
||||||
func UnmarshalBigInt(s string) (*big.Int, error) {
|
func UnmarshalBigInt(s string) (*big.Int, error) {
|
||||||
ret := new(big.Int)
|
ret := new(big.Int)
|
||||||
|
|
||||||
err := ret.UnmarshalText([]byte(s))
|
err := ret.UnmarshalText([]byte(s))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,5 +42,6 @@ func MustUnmarshalBigInt(s string) *big.Int {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user