Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
asoliman92 committed Nov 28, 2024
1 parent 9af0c51 commit a73ede0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
5 changes: 5 additions & 0 deletions contracts/.changeset/mean-masks-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

#added new function to CCIPReaderTester getLatestPriceSequenceNumber
4 changes: 3 additions & 1 deletion contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ contract CCIPReaderTester {
}

/// @notice sets the sequence number of the last price update.
function setLatestPriceSequenceNumber(uint64 seqNr) external {
function setLatestPriceSequenceNumber(
uint64 seqNr
) external {
s_latestPriceSequenceNumber = seqNr;
}

Expand Down
18 changes: 10 additions & 8 deletions integration-tests/contracts/ccipreader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
defaultGasPrice = assets.GWei(10)
)

func setupGetCommitGTETimestampTest(t *testing.T, ctx context.Context, finalityDepth int64) (*testSetupData, int64, common.Address) {
func setupGetCommitGTETimestampTest(ctx context.Context, t *testing.T, finalityDepth int64) (*testSetupData, int64, common.Address) {
cfg := evmtypes.ChainReaderConfig{
Contracts: map[string]evmtypes.ChainContractReader{
consts.ContractNameOffRamp: {
Expand Down Expand Up @@ -99,7 +99,7 @@ func setupGetCommitGTETimestampTest(t *testing.T, ctx context.Context, finalityD
return s, finalityDepth, onRampAddress
}

func emitCommitReports(t *testing.T, ctx context.Context, s *testSetupData, numReports int, tokenA common.Address, onRampAddress common.Address) uint64 {
func emitCommitReports(ctx context.Context, t *testing.T, s *testSetupData, numReports int, tokenA common.Address, onRampAddress common.Address) uint64 {
var firstReportTs uint64
for i := 0; i < numReports; i++ {
_, err := s.contract.EmitCommitReportAccepted(s.auth, ccip_reader_tester.OffRampCommitReport{
Expand Down Expand Up @@ -151,12 +151,12 @@ func emitCommitReports(t *testing.T, ctx context.Context, s *testSetupData, numR
func TestCCIPReader_CommitReportsGTETimestamp(t *testing.T) {
t.Parallel()
ctx := tests.Context(t)
s, _, onRampAddress := setupGetCommitGTETimestampTest(t, ctx, 0)
s, _, onRampAddress := setupGetCommitGTETimestampTest(ctx, t, 0)

tokenA := common.HexToAddress("123")
const numReports = 5

firstReportTs := emitCommitReports(t, ctx, s, numReports, tokenA, onRampAddress)
firstReportTs := emitCommitReports(ctx, t, s, numReports, tokenA, onRampAddress)

// Need to replay as sometimes the logs are not picked up by the log poller (?)
// Maybe another situation where chain reader doesn't register filters as expected.
Expand Down Expand Up @@ -195,12 +195,12 @@ func TestCCIPReader_CommitReportsGTETimestamp_RespectsFinality(t *testing.T) {
t.Parallel()
ctx := tests.Context(t)
var finalityDepth int64 = 10
s, _, onRampAddress := setupGetCommitGTETimestampTest(t, ctx, finalityDepth)
s, _, onRampAddress := setupGetCommitGTETimestampTest(ctx, t, finalityDepth)

tokenA := common.HexToAddress("123")
const numReports = 5

firstReportTs := emitCommitReports(t, ctx, s, numReports, tokenA, onRampAddress)
firstReportTs := emitCommitReports(ctx, t, s, numReports, tokenA, onRampAddress)

// Need to replay as sometimes the logs are not picked up by the log poller (?)
// Maybe another situation where chain reader doesn't register filters as expected.
Expand Down Expand Up @@ -589,8 +589,9 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) {
env,
)

maxExpectedSeqNum := 10
for i := 1; i < maxExpectedSeqNum; i++ {
maxExpectedSeqNum := uint64(10)
var i uint64
for i = 1; i < maxExpectedSeqNum; i++ {
msg := changeset.DefaultRouterMessage(state.Chains[destChain].Receiver.Address())
msgSentEvent := changeset.TestSendRequest(t, env.Env, state, srcChain, destChain, false, msg)
require.Equal(t, uint64(i), msgSentEvent.SequenceNumber)
Expand Down Expand Up @@ -693,6 +694,7 @@ func Test_GetChainFeePriceUpdates(t *testing.T) {
},
},
)
require.NoError(t, err)
be := env.Env.Chains[chain1].Client.(*memory.Backend)
be.Commit()

Expand Down
1 change: 1 addition & 0 deletions integration-tests/utils/pgtest/txdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func (c *conn) Close() (err error) {
return
}

//nolint:revive
func (c *conn) close() bool {
c.Lock()
defer c.Unlock()
Expand Down

0 comments on commit a73ede0

Please sign in to comment.