Skip to content

Commit

Permalink
feat: use abigen code for contracts and add debug service (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
aloknerurkar authored May 26, 2024
1 parent 542f808 commit 8689624
Show file tree
Hide file tree
Showing 53 changed files with 2,744 additions and 4,176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ job "{{ job.name }}" {
fi
done

TOPOLOGY=$(curl -s https://{{ .Address }}:{{ .Port }}/topology)
ETHEREUM_ADDRESS=$(echo ${TOPOLOGY} | jq -r '.self["Ethereum Address"]')
TOPOLOGY=$(curl -s https://{{ .Address }}:{{ .Port }}/v1/debug/topology)
ETHEREUM_ADDRESS=$(echo ${TOPOLOGY} | jq -r '.topology.self["Ethereum Address"]')

{{- range nomadService "mev-commit-geth-bootnode1" }}
{{- if contains "http" .Tags }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ job "{{ job.name }}" {
{{- end }}
{{- range nomadService "mev-commit-geth-bootnode1" }}
{{- if contains "http" .Tags }}
MEV_ORACLE_SETTLEMENT_RPC_URL="http://{{ .Address }}:{{ .Port }}"
MEV_ORACLE_SETTLEMENT_RPC_URL_HTTP="http://{{ .Address }}:{{ .Port }}"
{{- end }}
{{- if contains "ws" .Tags }}
MEV_ORACLE_SETTLEMENT_WS_RPC_ENDPOINT="ws://{{ .Address}}:{{ .Port }}"
MEV_ORACLE_SETTLEMENT_RPC_URL_WS="ws://{{ .Address}}:{{ .Port }}"
{{- end }}
{{- end }}
{{- range nomadService "{% endraw %}{{ job.name }}{% raw %}" }}
Expand Down Expand Up @@ -186,8 +186,8 @@ job "{{ job.name }}" {
{%- raw %}
{{- range nomadService "mev-commit-provider-node1" }}
{{ if contains "http" .Tags }}
TOPOLOGY=$(curl https://{{ .Address}}:{{ .Port }}/topology)
PROVIDER_ETHEREUM_ADDRESS=$(echo ${TOPOLOGY} | jq -r '.self["Ethereum Address"]')
TOPOLOGY=$(curl https://{{ .Address}}:{{ .Port }}/v1/debug/topology)
PROVIDER_ETHEREUM_ADDRESS=$(echo ${TOPOLOGY} | jq -r '.topology.self["Ethereum Address"]')
export MEV_ORACLE_OVERRIDE_WINNERS=${PROVIDER_ETHEREUM_ADDRESS}
{{ end }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ job "{{ job.name }}" {
{{- if contains "http" .Tags }}

# Fetch topology data
TOPOLOGY=$(curl https://{{ .Address }}:{{ .Port }}/topology)
TOPOLOGY=$(curl https://{{ .Address }}:{{ .Port }}/v1/debug/topology)

# Extract peerId (assuming the response format is JSON and jq is available)
PEER_ID=$(echo $TOPOLOGY | jq -r '.self.Underlay')
PEER_ID=$(echo $TOPOLOGY | jq -r '.topology.self.Underlay')

{{- else if contains "p2p" .Tags }}

Expand Down
29 changes: 23 additions & 6 deletions oracle/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,20 @@ var (
EnvVars: []string{"MEV_ORACLE_L1_RPC_URL"},
})

optionSettlementRPCUrl = altsrc.NewStringFlag(&cli.StringFlag{
Name: "settlement-rpc-url",
Usage: "URL for settlement RPC",
EnvVars: []string{"MEV_ORACLE_SETTLEMENT_RPC_URL"},
optionSettlementRPCUrlHTTP = altsrc.NewStringFlag(&cli.StringFlag{
Name: "settlement-rpc-url-http",
Usage: "URL for settlement RPC endpoint over HTTP",
EnvVars: []string{"MEV_ORACLE_SETTLEMENT_RPC_URL_HTTP"},
Value: "http://localhost:8545",
})

optionSettlementRPCUrlWS = altsrc.NewStringFlag(&cli.StringFlag{
Name: "settlement-rpc-url-ws",
Usage: "URL for settlement RPC over WebSocket",
EnvVars: []string{"MEV_ORACLE_SETTLEMENT_RPC_URL_WS"},
Value: "http://localhost:8546",
})

optionOracleContractAddr = altsrc.NewStringFlag(&cli.StringFlag{
Name: "oracle-contract-addr",
Usage: "address of the oracle contract",
Expand Down Expand Up @@ -214,7 +221,8 @@ func main() {
optionLogLevel,
optionLogTags,
optionL1RPCUrl,
optionSettlementRPCUrl,
optionSettlementRPCUrlHTTP,
optionSettlementRPCUrlWS,
optionOracleContractAddr,
optionPreconfContractAddr,
optionBlockTrackerContractAddr,
Expand Down Expand Up @@ -287,12 +295,21 @@ func launchOracleWithConfig(c *cli.Context) error {
}
logger.Info("key signer account", "address", keySigner.GetAddress().Hex(), "url", keySigner.String())

rpcURL := c.String(optionSettlementRPCUrlHTTP.Name)
if c.IsSet(optionSettlementRPCUrlWS.Name) {
rpcURL = c.String(optionSettlementRPCUrlWS.Name)
}

if rpcURL == "" {
return fmt.Errorf("settlement rpc url is empty")
}

nd, err := node.NewNode(&node.Options{
Logger: logger,
KeySigner: keySigner,
HTTPPort: c.Int(optionHTTPPort.Name),
L1RPCUrl: c.String(optionL1RPCUrl.Name),
SettlementRPCUrl: c.String(optionSettlementRPCUrl.Name),
SettlementRPCUrl: rpcURL,
OracleContractAddr: common.HexToAddress(c.String(optionOracleContractAddr.Name)),
PreconfContractAddr: common.HexToAddress(c.String(optionPreconfContractAddr.Name)),
BlockTrackerContractAddr: common.HexToAddress(c.String(optionBlockTrackerContractAddr.Name)),
Expand Down
Loading

0 comments on commit 8689624

Please sign in to comment.