Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/utils/scripts/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func CreatePegoutContract(
}
return rootstock.NewPegoutContractImpl(
rskClient,
env.Rsk.PeginContractAddress,
env.Rsk.PegoutContractAddress,
rootstock.NewPegoutContractAdapter(pegoutContract),
Comment on lines 95 to 98
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current tests for CreatePegoutContract pass an env with PegoutContractAddress unset, so they won’t fail if the wrong env field is used (as happened previously). Consider updating the test to set a distinct PegoutContractAddress and assert contract.GetAddress() matches it, to prevent regressions.

Copilot uses AI. Check for mistakes.
rskWallet,
rootstock.RetryParams{Retries: 0, Sleep: 0},
Expand Down Expand Up @@ -123,7 +123,7 @@ func CreateDiscoveryContract(
}
return rootstock.NewDiscoveryContractImpl(
rskClient,
env.Rsk.PeginContractAddress,
env.Rsk.DiscoveryAddress,
discoveryContract,
Comment on lines 124 to 127
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current tests for CreateDiscoveryContract don’t set DiscoveryAddress, so they won’t catch regressions where the wrong env field is wired. Consider setting a non-empty DiscoveryAddress in the test and asserting contract.GetAddress() equals it.

Copilot uses AI. Check for mistakes.
rskWallet,
rootstock.RetryParams{Retries: 0, Sleep: 0},
Expand Down
15 changes: 11 additions & 4 deletions cmd/utils/scripts/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/rsksmart/liquidity-provider-server/cmd/utils/scripts"
"github.com/rsksmart/liquidity-provider-server/internal/adapters/dataproviders/rootstock"
"github.com/rsksmart/liquidity-provider-server/internal/configuration/environment"
"github.com/rsksmart/liquidity-provider-server/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"io"
Expand Down Expand Up @@ -56,8 +57,9 @@ func TestCreatePeginContract(t *testing.T) {
SecretSource: "env",
WalletManagement: "native",
Rsk: environment.RskEnv{
KeystoreFile: keystorePath,
KeystorePassword: "test",
KeystoreFile: keystorePath,
KeystorePassword: "test",
PeginContractAddress: test.AnyRskAddress,
},
Btc: environment.BtcEnv{Network: "regtest"},
}
Expand All @@ -67,6 +69,7 @@ func TestCreatePeginContract(t *testing.T) {
contract, err := scripts.CreatePeginContract(context.Background(), factoryMock, env, environment.DefaultTimeouts())
require.NoError(t, err)
require.NotNil(t, contract)
require.Equal(t, env.Rsk.PeginContractAddress, contract.GetAddress())
})
}

Expand All @@ -77,8 +80,9 @@ func TestCreatePegoutContract(t *testing.T) {
SecretSource: "env",
WalletManagement: "native",
Rsk: environment.RskEnv{
KeystoreFile: keystorePath,
KeystorePassword: "test",
KeystoreFile: keystorePath,
KeystorePassword: "test",
PegoutContractAddress: test.AnyRskAddress,
},
Btc: environment.BtcEnv{Network: "regtest"},
}
Expand All @@ -88,6 +92,7 @@ func TestCreatePegoutContract(t *testing.T) {
contract, err := scripts.CreatePegoutContract(context.Background(), factoryMock, env, environment.DefaultTimeouts())
require.NoError(t, err)
require.NotNil(t, contract)
require.Equal(t, env.Rsk.PegoutContractAddress, contract.GetAddress())
})
}

Expand All @@ -100,6 +105,7 @@ func TestCreateDiscoveryContract(t *testing.T) {
Rsk: environment.RskEnv{
KeystoreFile: keystorePath,
KeystorePassword: "test",
DiscoveryAddress: test.AnyRskAddress,
},
Btc: environment.BtcEnv{Network: "regtest"},
}
Expand All @@ -109,6 +115,7 @@ func TestCreateDiscoveryContract(t *testing.T) {
contract, err := scripts.CreateDiscoveryContract(context.Background(), factoryMock, env, environment.DefaultTimeouts())
require.NoError(t, err)
require.NotNil(t, contract)
require.Equal(t, env.Rsk.DiscoveryAddress, contract.GetAddress())
})
}

Expand Down
Loading