Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eth2network #1483

Merged
merged 7 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockerfiles/enclave.debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FROM golang:1.20-alpine as system
# install build utils
RUN apk add build-base
ENV CGO_ENABLED=1
RUN go install github.com/go-delve/delve/cmd/dlv@v1.9.1
RUN go install github.com/go-delve/delve/cmd/dlv@v1.20.2

FROM system as get-dependencies
# setup container data structure
Expand Down
3 changes: 2 additions & 1 deletion go/common/gethencoding/geth_encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ func ExtractEthCall(param interface{}) (*gethapi.TransactionArgs, error) {
var value, gasPrice, maxFeePerGas, maxPriorityFeePerGas *hexutil.Big
var ok bool
zeroUint := hexutil.Uint64(0)
gas := &zeroUint
nonce := &zeroUint
// if gas is not set it should be null
gas := (*hexutil.Uint64)(nil)

for field, val := range param.(map[string]interface{}) {
if val == nil {
Expand Down
2 changes: 1 addition & 1 deletion integration/eth2network/eth2_binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
_gethVersion = "1.11.6"
_gethVersion = "1.12.2"
_prysmVersion = "v4.0.6"
)

Expand Down
1 change: 1 addition & 0 deletions integration/eth2network/eth2_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ func (n *Impl) prysmStartValidator(beaconHTTPPort int, nodeDataDir string) (*exe
"--interop-start-index", "0",
"--chain-config-file", n.prysmConfigPath,
"--config-file", n.prysmConfigPath,
"--suggested-fee-recipient", "0x52FfeB84540173B15eEC5a486FdB5c769F50400a", // random address to avoid a continuous warning
"--force-clear-db",
"--disable-account-metrics",
"--accept-terms-of-use",
Expand Down
1 change: 0 additions & 1 deletion integration/simulation/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func balance(ctx context.Context, client *obsclient.AuthObsClient, address gethc
From: address,
To: l2ContractAddress,
Data: balanceData,
Gas: uint64(1_000_000),
}

response, err := client.CallContract(ctx, callMsg, nil)
Expand Down
44 changes: 11 additions & 33 deletions testnet/launcher/docker.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package launcher

import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"time"

"github.com/obscuronet/go-obscuro/go/common/retry"
"github.com/obscuronet/go-obscuro/go/node"
"github.com/obscuronet/go-obscuro/go/obsclient"
"github.com/obscuronet/go-obscuro/go/rpc"
"github.com/obscuronet/go-obscuro/testnet/launcher/eth2network"
"github.com/sanity-io/litter"

Expand Down Expand Up @@ -210,49 +207,30 @@ func deployL1Contracts() (*node.NetworkConfig, error) {

// waitForHealthyNode retries continuously for the node to respond to a healthcheck http request
func waitForHealthyNode(port int) error { // todo: hook the cfg
requestURL := fmt.Sprintf("http://localhost:%d", port)
reqBody := `{"method": "obscuro_health", "id": 1}`

timeStart := time.Now()

hostRPCAddress := fmt.Sprintf("http://localhost:%d", port)
fmt.Println("Waiting for Obscuro node to be healthy...")
err := retry.Do(
func() error {
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, requestURL, bytes.NewBufferString(reqBody))
if err != nil {
return fmt.Errorf("client: could not create request: %w", err)
}
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
client, err := rpc.NewNetworkClient(hostRPCAddress)
if err != nil {
return err
}
defer res.Body.Close()
defer client.Stop()

resBody, err := io.ReadAll(res.Body)
obsClient := obsclient.NewObsClient(client)
health, err := obsClient.Health()
if err != nil {
return err
}

response := map[string]interface{}{}
err = json.Unmarshal(resBody, &response)
if err != nil {
return err
if health {
fmt.Println("obscuro node is ready")
otherview marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

if r := response["result"]; r != nil { //nolint: nestif
if h, ok := r.(map[string]interface{}); ok {
if overallHealth := h["OverallHealth"]; overallHealth != nil {
if health, ok := overallHealth.(bool); ok && health {
fmt.Println("obscuro node is ready")
return nil
}
}
}
}
return fmt.Errorf("node OverallHealth is not good yet")
}, retry.NewTimeoutStrategy(2*time.Minute, 1*time.Second),
}, retry.NewTimeoutStrategy(5*time.Minute, 1*time.Second),
zkokelj marked this conversation as resolved.
Show resolved Hide resolved
)
if err != nil {
return err
Expand Down
Loading