Skip to content

Commit

Permalink
fix offchain tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Nov 28, 2024
1 parent c204696 commit 9214ff3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions core/scripts/ccip/liquiditymanager/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func deployTokenPoolAndRebalancer(
transactor,
client,
tokenAddress,
18,
[]common.Address{},
armProxyAddress,
true,
Expand Down
22 changes: 14 additions & 8 deletions core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ var (
SourceChainSelector = uint64(11787463284727550157)
DestChainID = uint64(1337)
DestChainSelector = uint64(3379446385462418246)

TokenDecimals = uint8(18)
)

// Backwards compat, in principle these statuses are version dependent
Expand Down Expand Up @@ -785,6 +787,7 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
sourceUser,
sourceChain,
sourceLinkTokenAddress,
TokenDecimals,
[]common.Address{},
armProxySourceAddress,
true,
Expand All @@ -801,6 +804,7 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
sourceUser,
sourceChain,
sourceWeth9addr,
TokenDecimals,
[]common.Address{},
armProxySourceAddress,
true,
Expand All @@ -819,6 +823,7 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
destUser,
destChain,
destLinkTokenAddress,
TokenDecimals,
[]common.Address{},
armProxyDestAddress,
true,
Expand Down Expand Up @@ -848,6 +853,7 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
destUser,
destChain,
destWeth9addr,
TokenDecimals,
[]common.Address{},
armProxyDestAddress,
true,
Expand Down Expand Up @@ -882,11 +888,11 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
require.NoError(t, err)
_, err = sourceLinkPool.ApplyChainUpdates(
sourceUser,
[]uint64{},
[]lock_release_token_pool.TokenPoolChainUpdate{{
RemoteChainSelector: DestChainSelector,
RemotePoolAddress: abiEncodedDestLinkPool,
RemotePoolAddresses: [][]byte{abiEncodedDestLinkPool},
RemoteTokenAddress: abiEncodedDestLinkTokenAddress,
Allowed: true,
OutboundRateLimiterConfig: lock_release_token_pool.RateLimiterConfig{
IsEnabled: true,
Capacity: HundredLink,
Expand All @@ -907,11 +913,11 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
require.NoError(t, err)
_, err = sourceWeth9Pool.ApplyChainUpdates(
sourceUser,
[]uint64{},
[]lock_release_token_pool.TokenPoolChainUpdate{{
RemoteChainSelector: DestChainSelector,
RemotePoolAddress: abiEncodedDestWrappedPool,
RemotePoolAddresses: [][]byte{abiEncodedDestWrappedPool},
RemoteTokenAddress: abiEncodedDestWrappedTokenAddr,
Allowed: true,
OutboundRateLimiterConfig: lock_release_token_pool.RateLimiterConfig{
IsEnabled: true,
Capacity: HundredLink,
Expand All @@ -933,11 +939,11 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
require.NoError(t, err)
_, err = destLinkPool.ApplyChainUpdates(
destUser,
[]uint64{},
[]lock_release_token_pool.TokenPoolChainUpdate{{
RemoteChainSelector: SourceChainSelector,
RemotePoolAddress: abiEncodedSourceLinkPool,
RemotePoolAddresses: [][]byte{abiEncodedSourceLinkPool},
RemoteTokenAddress: abiEncodedSourceLinkTokenAddr,
Allowed: true,
OutboundRateLimiterConfig: lock_release_token_pool.RateLimiterConfig{
IsEnabled: true,
Capacity: HundredLink,
Expand All @@ -958,11 +964,11 @@ func SetupCCIPContracts(t *testing.T, sourceChainID, sourceChainSelector, destCh
require.NoError(t, err)
_, err = destWrappedPool.ApplyChainUpdates(
destUser,
[]uint64{},
[]lock_release_token_pool.TokenPoolChainUpdate{{
RemoteChainSelector: SourceChainSelector,
RemotePoolAddress: abiEncodedSourceWrappedPool,
RemotePoolAddresses: [][]byte{abiEncodedSourceWrappedPool},
RemoteTokenAddress: abiEncodedSourceWrappedTokenAddr,
Allowed: true,
OutboundRateLimiterConfig: lock_release_token_pool.RateLimiterConfig{
IsEnabled: true,
Capacity: HundredLink,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func deployContracts(

// deploy lock/release pool targeting the weth9 contract
lockReleasePoolAddress, _, _, err := lock_release_token_pool.DeployLockReleaseTokenPool(
owner, backend, wethAddress, []common.Address{}, armProxyAddress, true, routerAddress)
owner, backend, wethAddress, 18, []common.Address{}, armProxyAddress, true, routerAddress)
require.NoError(t, err, "failed to deploy LockReleaseTokenPool contract")
backend.Commit()
lockReleasePool, err := lock_release_token_pool.NewLockReleaseTokenPool(lockReleasePoolAddress, backend)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ func (e *CCIPContractsDeployer) DeployLockReleaseTokenPoolContract(tokenAddr str
auth,
wrappers.MustNewWrappedContractBackend(e.evmClient, nil),
token,
testhelpers.TokenDecimals,
[]common.Address{},
rmnProxy,
true,
Expand Down
7 changes: 3 additions & 4 deletions integration-tests/ccip-tests/contracts/contract_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,14 @@ func (w TokenPoolWrapper) IsSupportedChain(opts *bind.CallOpts, remoteChainSelec

func (w TokenPoolWrapper) ApplyChainUpdates(opts *bind.TransactOpts, update []token_pool.TokenPoolChainUpdate) (*types.Transaction, error) {
if w.Latest != nil && w.Latest.PoolInterface != nil {
return w.Latest.PoolInterface.ApplyChainUpdates(opts, update)
return w.Latest.PoolInterface.ApplyChainUpdates(opts, []uint64{}, update)
}
if w.V1_4_0 != nil && w.V1_4_0.PoolInterface != nil {
V1_4_0Updates := make([]token_pool_1_4_0.TokenPoolChainUpdate, len(update))
for i, u := range update {
V1_4_0Updates[i] = token_pool_1_4_0.TokenPoolChainUpdate{
RemoteChainSelector: u.RemoteChainSelector,
Allowed: u.Allowed,
Allowed: true,
InboundRateLimiterConfig: token_pool_1_4_0.RateLimiterConfig{
IsEnabled: u.InboundRateLimiterConfig.IsEnabled,
Capacity: u.InboundRateLimiterConfig.Capacity,
Expand Down Expand Up @@ -828,9 +828,8 @@ func (pool *TokenPool) SetRemoteChainOnPool(remoteChainSelector uint64, remotePo

selectorsToUpdate = append(selectorsToUpdate, token_pool.TokenPoolChainUpdate{
RemoteChainSelector: remoteChainSelector,
RemotePoolAddress: encodedPoolAddress,
RemotePoolAddresses: [][]byte{encodedPoolAddress},
RemoteTokenAddress: encodedTokenAddress,
Allowed: true,
InboundRateLimiterConfig: token_pool.RateLimiterConfig{
IsEnabled: true,
Capacity: new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e9)),
Expand Down

0 comments on commit 9214ff3

Please sign in to comment.