Skip to content

Commit e2af942

Browse files
authored
Merge branch 'main' into keeper_soak
2 parents 3b2e18a + 9965cc9 commit e2af942

32 files changed

+1359
-233
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ test_ocr_soak: ## run OCR soak test
7272
test_keeper_soak: ## run Keeper soak/performance test
7373
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@performance-keeper"
7474

75+
.PHONY: test_vrf_soak
76+
test_vrf_soak: ## run VRF soak test
77+
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@soak-vrf"
78+
7579
.PHONY: test_runlog
7680
test_runlog: ## run runlog tests
7781
ginkgo -r --focus=@runlog
@@ -82,4 +86,8 @@ test_contract: ## run contract tests
8286

8387
.PHONY: test_vrf
8488
test_vrf: ## run vrf tests
85-
ginkgo -r --focus=@vrf
89+
ginkgo -r --focus=@vrf
90+
91+
.PHONY: test_observability
92+
test_observability: # run observability tests
93+
ginkgo -r --focus=@observability

client/mockserver.go

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package client
2+
3+
import (
4+
"net/http"
5+
)
6+
7+
// MockserverClient mockserver client
8+
type MockserverClient struct {
9+
*BasicHTTPClient
10+
Config *MockserverConfig
11+
}
12+
13+
// MockserverConfig holds config information for MockserverClient
14+
type MockserverConfig struct {
15+
LocalURL string
16+
ClusterURL string
17+
}
18+
19+
// NewMockserverClient returns a mockserver client
20+
func NewMockserverClient(cfg *MockserverConfig) *MockserverClient {
21+
return &MockserverClient{
22+
Config: cfg,
23+
BasicHTTPClient: NewBasicHTTPClient(&http.Client{}, cfg.LocalURL),
24+
}
25+
}
26+
27+
// PutExpectations sets the expectations (i.e. mocked responses)
28+
func (em *MockserverClient) PutExpectations(body interface{}) error {
29+
_, err := em.do(http.MethodPut, "/expectation", &body, nil, http.StatusCreated)
30+
return err
31+
}
32+
33+
// ClearExpectation clears expectations
34+
func (em *MockserverClient) ClearExpectation(body interface{}) error {
35+
_, err := em.do(http.MethodPut, "/clear", &body, nil, http.StatusOK)
36+
return err
37+
}
38+
39+
// PathSelector represents the json object used to find expectations by path
40+
type PathSelector struct {
41+
Path string `json:"path"`
42+
}
43+
44+
// HttpRequest represents the httpRequest json object used in the mockserver initializer
45+
type HttpRequest struct {
46+
Path string `json:"path"`
47+
}
48+
49+
// HttpResponse represents the httpResponse json object used in the mockserver initializer
50+
type HttpResponse struct {
51+
Body interface{} `json:"body"`
52+
}
53+
54+
// HttpInitializer represents an element of the initializer array used in the mockserver initializer
55+
type HttpInitializer struct {
56+
Request HttpRequest `json:"httpRequest"`
57+
Response HttpResponse `json:"httpResponse"`
58+
}
59+
60+
// For OTPE - weiwatchers
61+
62+
// NodeInfoJSON represents an element of the nodes array used to deliver configs to otpe
63+
type NodeInfoJSON struct {
64+
ID string `json:"id"`
65+
NodeAddress []string `json:"nodeAddress"`
66+
}
67+
68+
// ContractInfoJSON represents an element of the contracts array used to deliver configs to otpe
69+
type ContractInfoJSON struct {
70+
ContractAddress string `json:"contractAddress"`
71+
ContractVersion int `json:"contractVersion"`
72+
Path string `json:"path"`
73+
Status string `json:"status"`
74+
}
75+
76+
// For Adapter endpoints
77+
78+
// AdapterResult represents an int result for an adapter
79+
type AdapterResult struct {
80+
Result int `json:"result"`
81+
}
82+
83+
// AdapterResponse represents a response from an adapter
84+
type AdapterResponse struct {
85+
Id string `json:"id"`
86+
Data AdapterResult `json:"data"`
87+
Error interface{} `json:"error"`
88+
}

client/prometheus.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,21 @@ func (p *Prometheus) ResourcesSummary() (float64, float64, error) {
9797
}
9898
return cpu, mem, nil
9999
}
100+
101+
// GetAlerts returns all firing alerts
102+
func (p *Prometheus) GetAlerts() (v1.AlertsResult, error) {
103+
alerts, err := p.API.Alerts(context.Background())
104+
if err != nil {
105+
return v1.AlertsResult{}, err
106+
}
107+
return alerts, nil
108+
}
109+
110+
// GetQuery returns the result of applying a PromQL query
111+
func (p *Prometheus) GetQuery(query string) (model.Value, error) {
112+
value, _, err := p.API.Query(context.Background(), query, time.Now())
113+
if err != nil {
114+
return nil, err
115+
}
116+
return value, nil
117+
}

config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ networks:
198198
private_url: moonbase_alpha_url
199199
private_keys:
200200
- moonbase_alpha_1
201+
iotex_testnet:
202+
<<: *common_ethereum_testnet
203+
name: "IoTeX testnet"
204+
chain_id: 4690
205+
private_url: iotex_testnet_url
206+
private_keys:
207+
- iotex_testnet_1
201208
retry:
202209
attempts: 120
203210
linear_delay: 1s

contracts/contract_models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ type VRFCoordinator interface {
258258
}
259259

260260
type VRFConsumer interface {
261+
Address() string
261262
RequestRandomness(fromWallet client.BlockchainWallet, hash [32]byte, fee *big.Int) error
263+
CurrentRoundID(ctx context.Context) (*big.Int, error)
262264
RandomnessOutput(ctx context.Context) (*big.Int, error)
263265
Fund(fromWallet client.BlockchainWallet, ethAmount, linkAmount *big.Float) error
264266
}

contracts/ethereum/VRFConsumer.go

Lines changed: 64 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ethereum/v0.6/abi/VRFConsumer.abi

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,32 @@
1515
"stateMutability": "nonpayable",
1616
"type": "constructor"
1717
},
18+
{
19+
"inputs": [],
20+
"name": "currentRoundID",
21+
"outputs": [
22+
{
23+
"internalType": "uint256",
24+
"name": "",
25+
"type": "uint256"
26+
}
27+
],
28+
"stateMutability": "view",
29+
"type": "function"
30+
},
31+
{
32+
"inputs": [],
33+
"name": "prevRandomnessOutput",
34+
"outputs": [
35+
{
36+
"internalType": "uint256",
37+
"name": "",
38+
"type": "uint256"
39+
}
40+
],
41+
"stateMutability": "view",
42+
"type": "function"
43+
},
1844
{
1945
"inputs": [],
2046
"name": "randomnessOutput",

0 commit comments

Comments
 (0)