-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added smoke test & load test for log poller (#11110)
* added smoke test & load test for log poller * read CL nodes logs in parallel and compare them in parallel with EVM node logs (has a big impact on execution, when we emit 100k+ logs) * add simple config validation * add smoke tests for backup process and replay * run replay test for 15m instead of 5m (for debuggin) * do not use hardcoded postgres values * added support for chaos experiments (pausing containers) + a smoke test that uses them * streamline log poller tests * remove backup poller test -- way to test it reliably in e2e tests * don't skip replay test * add go.work* to .gitignore * add tests that can easier run in CI + some changes after testing with live testnets * wait for LP to finalise endblock + on demand workflow in GH * rename on demand workflow * fix typo in workflow name
- Loading branch information
Showing
22 changed files
with
2,460 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: On Demand Log Poller Consistency Test | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
contracts: | ||
description: Number of test contracts | ||
default: "2" | ||
required: true | ||
eventsPerTx: | ||
description: Number of events to emit per transaction | ||
default: "10" | ||
required: true | ||
useFinalityTag: | ||
description: Use finality tag | ||
default: "false" | ||
required: true | ||
loadDuration: | ||
description: Load duration (e.g. 10s, 10m, 1h) | ||
default: "10m" | ||
required: true | ||
chainlinkImage: | ||
description: Chainlink image to use | ||
default: "public.ecr.aws/chainlink/chainlink" | ||
required: true | ||
chainlinkVersion: | ||
description: Chainlink version to use | ||
default: "v2.7.0-beta0" | ||
required: true | ||
selectedNetworks: | ||
description: Network to use (only Sepolia or Mumbai) | ||
default: "Sepolia" | ||
required: true | ||
fundingKey: | ||
description: Private key used to fund the contracts | ||
required: true | ||
rpcURL: | ||
description: RPC URL to use | ||
required: true | ||
wsURL: | ||
description: WS URL to use | ||
required: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: "integration-tests/go.mod" | ||
cache: true | ||
- name: Show overrides | ||
env: | ||
CONTRACTS: ${{ inputs.contracts }} | ||
EVENTS_PER_TX: ${{ inputs.eventsPerTx }} | ||
LOAD_DURATION: ${{ inputs.loadDuration }} | ||
USE_FINALITY_TAG: ${{ inputs.useFinalityTag }} | ||
CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }} | ||
CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }} | ||
SELECTED_NETWORKS: ${{ inputs.selectedNetworks }} | ||
EVM_KEYS: ${{ inputs.fundingKey }} | ||
EVM_HTTP_URLS: ${{ inputs.rpcURL }} | ||
EVM_URLS: ${{ inputs.wsURL }} | ||
run: | | ||
go test -v -timeout 5h -run=TestLogPollerFromEnv integration-tests/reorg/log_poller_maybe_reorg_test.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package contracts | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/rs/zerolog" | ||
"github.com/smartcontractkit/chainlink-testing-framework/blockchain" | ||
|
||
le "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_emitter" | ||
) | ||
|
||
type LogEmitterContract struct { | ||
address common.Address | ||
client blockchain.EVMClient | ||
instance *le.LogEmitter | ||
l zerolog.Logger | ||
} | ||
|
||
func (e *LogEmitterContract) Address() common.Address { | ||
return e.address | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogInts(ints []int) (*types.Transaction, error) { | ||
opts, err := e.client.TransactionOpts(e.client.GetDefaultWallet()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
bigInts := make([]*big.Int, len(ints)) | ||
for i, v := range ints { | ||
bigInts[i] = big.NewInt(int64(v)) | ||
} | ||
tx, err := e.instance.EmitLog1(opts, bigInts) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return tx, e.client.ProcessTransaction(tx) | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogIntsIndexed(ints []int) (*types.Transaction, error) { | ||
opts, err := e.client.TransactionOpts(e.client.GetDefaultWallet()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
bigInts := make([]*big.Int, len(ints)) | ||
for i, v := range ints { | ||
bigInts[i] = big.NewInt(int64(v)) | ||
} | ||
tx, err := e.instance.EmitLog2(opts, bigInts) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return tx, e.client.ProcessTransaction(tx) | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogStrings(strings []string) (*types.Transaction, error) { | ||
opts, err := e.client.TransactionOpts(e.client.GetDefaultWallet()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
tx, err := e.instance.EmitLog3(opts, strings) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return tx, e.client.ProcessTransaction(tx) | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogInt(payload int) (*types.Transaction, error) { | ||
return e.EmitLogInts([]int{payload}) | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogIntIndexed(payload int) (*types.Transaction, error) { | ||
return e.EmitLogIntsIndexed([]int{payload}) | ||
} | ||
|
||
func (e *LogEmitterContract) EmitLogString(strings string) (*types.Transaction, error) { | ||
return e.EmitLogStrings([]string{strings}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.