Skip to content

Commit

Permalink
Merge develop and update common to have a merged develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nolag committed Jan 18, 2024
2 parents 66a8abe + 3e91b24 commit 40189d0
Show file tree
Hide file tree
Showing 91 changed files with 744 additions and 653 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
needs: [changes, enforce-ctf-version]
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -142,7 +142,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Chainlink Image
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: ./.github/actions/build-chainlink-image
with:
tag_suffix: ${{ matrix.image.tag-suffix }}
Expand All @@ -164,7 +164,7 @@ jobs:
needs: [changes]
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -177,7 +177,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Test Image
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: ./.github/actions/build-test-image
with:
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
fi
eth-smoke-tests-matrix-automation:
if: ${{ !(contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') || github.event_name == 'workflow_dispatch') }}
if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
environment: integration
permissions:
checks: write
Expand All @@ -250,7 +250,7 @@ jobs:
name: ETH Smoke Tests ${{ matrix.product.name }}
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -274,7 +274,7 @@ jobs:
fi
## Run this step when changes that require tests to be run are made
- name: Run Tests
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@e865e376b8c2d594028c8d645dd6c47169b72974 # v2.2.16
env:
PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725
Expand All @@ -297,7 +297,7 @@ jobs:
QA_KUBECONFIG: ""

eth-smoke-tests-matrix:
if: ${{ !(contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') || github.event_name == 'workflow_dispatch') }}
if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
environment: integration
permissions:
checks: write
Expand All @@ -316,15 +316,15 @@ jobs:
matrix:
product:
- name: cron
nodes: 1
nodes: 2
os: ubuntu-latest
pyroscope_env: ""
- name: flux
nodes: 1
os: ubuntu-latest
pyroscope_env: ""
- name: ocr
nodes: 1
nodes: 2
os: ubuntu-latest
file: ocr
pyroscope_env: ci-smoke-ocr-evm-simulated
Expand All @@ -343,15 +343,15 @@ jobs:
os: ubuntu-latest
pyroscope_env: ""
- name: vrf
nodes: 1
nodes: 2
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf-evm-simulated
- name: vrfv2
nodes: 1
nodes: 2
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2-evm-simulated
- name: vrfv2plus
nodes: 1
nodes: 3
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2plus-evm-simulated
- name: forwarder_ocr
Expand All @@ -366,7 +366,7 @@ jobs:
name: ETH Smoke Tests ${{ matrix.product.name }}${{ matrix.product.tag_suffix }}
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand Down Expand Up @@ -442,7 +442,7 @@ jobs:
docker logs otel-collector
## Run this step when changes that require tests to be run are made
- name: Run Tests
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@e865e376b8c2d594028c8d645dd6c47169b72974 # v2.2.16
env:
PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725
Expand Down Expand Up @@ -773,7 +773,7 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -789,7 +789,7 @@ jobs:
repository: smartcontractkit/chainlink-solana
ref: ${{ needs.get_solana_sha.outputs.sha }}
- name: Build contracts
if: needs.changes.outputs.src == 'true' && needs.solana-test-image-exists.outputs.exists == 'false'
if: (needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false'
uses: smartcontractkit/chainlink-solana/.github/actions/build_contract_artifacts@21675b3a7dcdff8e790391708d4763020cace21e # stable action on December 18 2023
with:
ref: ${{ needs.get_solana_sha.outputs.sha }}
Expand All @@ -814,7 +814,7 @@ jobs:
CONTRACT_ARTIFACTS_PATH: contracts/target/deploy
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true' && needs.solana-test-image-exists.outputs.exists == 'false'
if: (needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -823,13 +823,13 @@ jobs:
this-job-name: Solana Build Test Image
continue-on-error: true
- name: Checkout the repo
if: needs.changes.outputs.src == 'true' && needs.solana-test-image-exists.outputs.exists == 'false'
if: (needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: smartcontractkit/chainlink-solana
ref: ${{ needs.get_solana_sha.outputs.sha }}
- name: Build Test Image
if: needs.changes.outputs.src == 'true' && needs.solana-test-image-exists.outputs.exists == 'false'
if: (needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false'
uses: ./.github/actions/build-test-image
with:
tag: ${{ needs.get_solana_sha.outputs.sha }}
Expand Down Expand Up @@ -865,7 +865,7 @@ jobs:
CONTRACT_ARTIFACTS_PATH: contracts/target/deploy
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
Expand All @@ -880,7 +880,7 @@ jobs:
repository: smartcontractkit/chainlink-solana
ref: ${{ needs.get_solana_sha.outputs.sha }}
- name: Run Setup
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@e865e376b8c2d594028c8d645dd6c47169b72974 # v2.2.16
with:
go_mod_path: ./integration-tests/go.mod
Expand All @@ -893,7 +893,7 @@ jobs:
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
- name: Pull Artfacts
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
run: |
IMAGE_NAME=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }}
# Pull the Docker image
Expand All @@ -909,7 +909,7 @@ jobs:
# Remove the created container
docker rm "$CONTAINER_ID"
- name: Run Tests
if: needs.changes.outputs.src == 'true'
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@e865e376b8c2d594028c8d645dd6c47169b72974 # v2.2.16
with:
test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/live-testnet-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ env:
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
MOD_CACHE_VERSION: 2
CHAINLINK_NODE_FUNDING: .5
PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }}
LOKI_TENANT_ID: ${{ vars.LOKI_TENANT_ID }}
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
LOGSTREAM_LOG_TARGETS: loki
GRAFANA_URL: ${{ vars.GRAFANA_URL }}
RUN_ID: ${{ github.run_id }}

CHAINLINK_COMMIT_SHA: ${{ github.sha }}
CHAINLINK_ENV_USER: ${{ github.actor }}
Expand Down
5 changes: 3 additions & 2 deletions common/config/chaintype.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ const (
ChainWeMix ChainType = "wemix"
ChainKroma ChainType = "kroma"
ChainZkSync ChainType = "zksync"
ChainScroll ChainType = "scroll"
)

var ErrInvalidChainType = fmt.Errorf("must be one of %s or omitted", strings.Join([]string{
string(ChainArbitrum), string(ChainMetis), string(ChainXDai), string(ChainOptimismBedrock), string(ChainCelo),
string(ChainKroma), string(ChainWeMix), string(ChainZkSync)}, ", "))
string(ChainKroma), string(ChainWeMix), string(ChainZkSync), string(ChainScroll)}, ", "))

// IsValid returns true if the ChainType value is known or empty.
func (c ChainType) IsValid() bool {
switch c {
case "", ChainArbitrum, ChainMetis, ChainOptimismBedrock, ChainXDai, ChainCelo, ChainKroma, ChainWeMix, ChainZkSync:
case "", ChainArbitrum, ChainMetis, ChainOptimismBedrock, ChainXDai, ChainCelo, ChainKroma, ChainWeMix, ChainZkSync, ChainScroll:
return true
}
return false
Expand Down
1 change: 1 addition & 0 deletions core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ChainID = '534352'
FinalityDepth = 1
ChainType = 'scroll'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
# Scroll only emits blocks when a new tx is received, so this method of liveness detection is not useful
Expand Down
1 change: 1 addition & 0 deletions core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ChainID = '534351'
FinalityDepth = 1
ChainType = 'scroll'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
# Scroll only emits blocks when a new tx is received, so this method of liveness detection is not useful
Expand Down
12 changes: 11 additions & 1 deletion core/chains/evm/gas/rollups/l1_gas_price_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ const (
// `function l1BaseFee() external view returns (uint256);`
KromaGasOracle_l1BaseFee = "519b4bd3"

// GasOracleAddress is the address of the precompiled contract that exists on scroll chain.
// This is the case for Scroll.
ScrollGasOracleAddress = "0x5300000000000000000000000000000000000002"
// GasOracle_l1BaseFee is the a hex encoded call to:
// `function l1BaseFee() external view returns (uint256);`
ScrollGasOracle_l1BaseFee = "519b4bd3"

// Interval at which to poll for L1BaseFee. A good starting point is the L1 block time.
PollPeriod = 12 * time.Second
)

var supportedChainTypes = []config.ChainType{config.ChainArbitrum, config.ChainOptimismBedrock, config.ChainKroma}
var supportedChainTypes = []config.ChainType{config.ChainArbitrum, config.ChainOptimismBedrock, config.ChainKroma, config.ChainScroll}

func IsRollupWithL1Support(chainType config.ChainType) bool {
return slices.Contains(supportedChainTypes, chainType)
Expand All @@ -87,6 +94,9 @@ func NewL1GasPriceOracle(lggr logger.Logger, ethClient ethClient, chainType conf
case config.ChainKroma:
address = KromaGasOracleAddress
callArgs = KromaGasOracle_l1BaseFee
case config.ChainScroll:
address = ScrollGasOracleAddress
callArgs = ScrollGasOracle_l1BaseFee
default:
panic(fmt.Sprintf("Received unspported chaintype %s", chainType))
}
Expand Down
22 changes: 22 additions & 0 deletions core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,26 @@ func TestL1GasPriceOracle(t *testing.T) {

assert.Equal(t, assets.NewWei(l1BaseFee), gasPrice)
})

t.Run("Calling GasPrice on started Scroll L1Oracle returns Scroll l1GasPrice", func(t *testing.T) {
l1BaseFee := big.NewInt(200)

ethClient := mocks.NewETHClient(t)
ethClient.On("CallContract", mock.Anything, mock.IsType(ethereum.CallMsg{}), mock.IsType(&big.Int{})).Run(func(args mock.Arguments) {
callMsg := args.Get(1).(ethereum.CallMsg)
blockNumber := args.Get(2).(*big.Int)
assert.Equal(t, ScrollGasOracleAddress, callMsg.To.String())
assert.Equal(t, ScrollGasOracle_l1BaseFee, fmt.Sprintf("%x", callMsg.Data))
assert.Nil(t, blockNumber)
}).Return(common.BigToHash(l1BaseFee).Bytes(), nil)

oracle := NewL1GasPriceOracle(logger.Test(t), ethClient, config.ChainScroll)
require.NoError(t, oracle.Start(testutils.Context(t)))
t.Cleanup(func() { assert.NoError(t, oracle.Close()) })

gasPrice, err := oracle.GasPrice(testutils.Context(t))
require.NoError(t, err)

assert.Equal(t, assets.NewWei(l1BaseFee), gasPrice)
})
}
4 changes: 2 additions & 2 deletions core/chains/evm/logpoller/log_poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func populateDatabase(t testing.TB, o *logpoller.DbORM, chainID *big.Int) (commo
EventSig: event1,
Topics: [][]byte{event1[:], logpoller.EvmWord(uint64(i + 1000*j)).Bytes()},
Address: addr,
TxHash: utils.RandomAddress().Hash(),
TxHash: utils.RandomHash(),
Data: logpoller.EvmWord(uint64(i + 1000*j)).Bytes(),
CreatedAt: blockTimestamp,
})

}
require.NoError(t, o.InsertLogs(logs))
require.NoError(t, o.InsertBlock(utils.RandomAddress().Hash(), int64((j+1)*1000-1), startDate.Add(time.Duration(j*1000)*time.Hour), 0))
require.NoError(t, o.InsertBlock(utils.RandomHash(), int64((j+1)*1000-1), startDate.Add(time.Duration(j*1000)*time.Hour), 0))
}

return event1, address1, address2
Expand Down
14 changes: 7 additions & 7 deletions core/chains/evm/logpoller/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ func TestSelectLatestBlockNumberEventSigsAddrsWithConfs(t *testing.T) {
GenLog(th.ChainID, 2, 2, utils.RandomAddress().String(), event2[:], address2),
GenLog(th.ChainID, 2, 3, utils.RandomAddress().String(), event2[:], address2),
}))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 3, time.Now(), 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 3, time.Now(), 1))

tests := []struct {
name string
Expand Down Expand Up @@ -1205,9 +1205,9 @@ func TestSelectLogsCreatedAfter(t *testing.T) {
GenLogWithTimestamp(th.ChainID, 2, 2, utils.RandomAddress().String(), event[:], address, block2ts),
GenLogWithTimestamp(th.ChainID, 1, 3, utils.RandomAddress().String(), event[:], address, block3ts),
}))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 1, block1ts, 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 2, block2ts, 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 3, block3ts, 2))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 1, block1ts, 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 2, block2ts, 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 3, block3ts, 2))

type expectedLog struct {
block int64
Expand Down Expand Up @@ -1309,7 +1309,7 @@ func TestNestedLogPollerBlocksQuery(t *testing.T) {
require.Len(t, logs, 0)

// Persist block
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 10, time.Now(), 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 10, time.Now(), 0))

// Check if query actually works well with provided dataset
logs, err = th.ORM.SelectIndexedLogs(address, event, 1, []common.Hash{event}, logpoller.Unconfirmed)
Expand Down Expand Up @@ -1542,12 +1542,12 @@ func Benchmark_LogsDataWordBetween(b *testing.B) {
EventSig: commitReportAccepted,
Topics: [][]byte{},
Address: commitStoreAddress,
TxHash: utils.RandomAddress().Hash(),
TxHash: utils.RandomHash(),
Data: data,
CreatedAt: time.Now(),
})
}
require.NoError(b, o.InsertBlock(utils.RandomAddress().Hash(), int64(numberOfReports*numberOfMessagesPerReport), time.Now(), int64(numberOfReports*numberOfMessagesPerReport)))
require.NoError(b, o.InsertBlock(utils.RandomHash(), int64(numberOfReports*numberOfMessagesPerReport), time.Now(), int64(numberOfReports*numberOfMessagesPerReport)))
require.NoError(b, o.InsertLogs(dbLogs))

b.ResetTimer()
Expand Down
6 changes: 6 additions & 0 deletions core/chains/evm/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ func RandomAddress() common.Address {
return common.BytesToAddress(b)
}

func RandomHash() common.Hash {
b := make([]byte, 32)
_, _ = rand.Read(b) // Assignment for errcheck. Only used in tests so we can ignore.
return common.BytesToHash(b)
}

// IsEmptyAddress checks that the address is empty, synonymous with the zero
// account/address. No logs can come from this address, as there is no contract
// present there.
Expand Down
Loading

0 comments on commit 40189d0

Please sign in to comment.