Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C chain integ tests #204

Merged
merged 43 commits into from
Dec 21, 2023
Merged

C chain integ tests #204

merged 43 commits into from
Dec 21, 2023

Conversation

cam-schultz
Copy link
Contributor

@cam-schultz cam-schultz commented Dec 18, 2023

Why this should be merged

Fixes #193

TODO:

How this works

Replaces one of the chains in each of the E2E test cases with the C-Chain.

How this was tested

E2E test modifications, CI

How is this documented

N/A

@@ -5,7 +5,7 @@
"source-subnets": [
{
"subnet-id": "11111111111111111111111111111111LpoYY",
"chain-id": "<C_CHAIN_CHAIN_ID>",
"blockchain-id": "<C_CHAIN_CHAIN_ID>",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Update the AWM Relayer version in versions.sh once ava-labs/icm-services#115 is merged and a new release created.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit, should we renaming the template variables <BLOCKCHAIN_ID> rather than <CHAIN_ID>?

@@ -16,6 +16,7 @@ BASEDIR=${BASEDIR:-"$HOME/.teleporter-deps"}

cwd=$(pwd)
# Install the avalanchego and subnet-evm binaries
rm -rf $BASEDIR/avalanchego
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A recent change is causing the network artifacts to not fully be cleaned on exit, causing errors on subsequent runs. This works around that.

Comment on lines 60 to 65
ginkgo.It("Send native tokens from subnet A to B and back", func() {
flows.NativeTokenBridge(localNetworkInstance)
flows.NativeTokenBridge(LocalNetworkInstance)
})
ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", func() {
flows.ERC20ToNativeTokenBridge(localNetworkInstance)
flows.ERC20ToNativeTokenBridge(LocalNetworkInstance)
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two test cases currently fail when using the C-Chain on one end. I need to investigate this further.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #207

@@ -54,22 +59,19 @@ const (
fundedKeyStr = "56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027"
)

func newLocalNetwork(warpGenesisFile string) *localNetwork {
func NewLocalNetwork(warpGenesisFile string) *LocalNetwork {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We export these functions so that they can be used in awm-relayer

Copy link
Collaborator

@michaelkaplan13 michaelkaplan13 left a comment

Choose a reason for hiding this comment

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

Few small suggestions, but other looking good 👍

@@ -5,7 +5,7 @@
"source-subnets": [
{
"subnet-id": "11111111111111111111111111111111LpoYY",
"chain-id": "<C_CHAIN_CHAIN_ID>",
"blockchain-id": "<C_CHAIN_CHAIN_ID>",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit, should we renaming the template variables <BLOCKCHAIN_ID> rather than <CHAIN_ID>?

subnetNodeNames map[ids.ID][]string
type LocalNetwork struct {
teleporterContractAddress common.Address
primaryNetworkInfo *interfaces.SubnetTestInfo
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think cchainInfo, etc is probably more accurate for the naming through out these tests, because the SubnetTestInfo doesn't have any value regarding the X or P chains.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While true, I'd prefer to keep the naming consistent with respect to subnet vs blockchain for all subnets, including the primary network.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, fair point. The previous naming assumption was that a given subnet will only have 1 blockchain, which is still true for the subnets, but not true for primary network.

I'm fine with it for now, but would prefer we clean it up at some point...maybe BlockchainTestInfo for the struct name, and subnetBlockchainInfo rather than subnetsInfo (along with cChainInfo) to make everything fully accurate/consistent?

I'm also curious now if we need subnetAID and subnetBID, and if so if we should also add primaryNetworkID here, but can also be deferred to later clean up IMO.

Comment on lines +173 to +174
nodeURIs = append(nodeURIs, n.subnetsInfo[n.subnetAID].NodeURIs...)
nodeURIs = append(nodeURIs, n.subnetsInfo[n.subnetBID].NodeURIs...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you know if there are any other nodes in the local primary network other than the subnet validator nodes?

If not, could you add a comment explaining that all nodes should be accounted for here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, I believe these should be all the nodes. I added a comment noting such.

For context, we only ever use the 1st element of this list, so the actual length and content is pretty arbitrary.

Comment on lines 283 to 284
subnets := n.GetSubnetsInfo()
subnets = append(subnets, *n.primaryNetworkInfo)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe worth considering something along the lines of a network.GetAllBlockchainInfo helper for cases like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, added

"github.com/ava-labs/subnet-evm/accounts/abi/bind"
"github.com/ava-labs/teleporter/tests/interfaces"
"github.com/ava-labs/teleporter/tests/utils"
. "github.com/onsi/gomega"
)

func BlockHashPublishReceive(network interfaces.Network) {
subnetAInfo, subnetBInfo, _ := utils.GetThreeSubnets(network)
subnetAInfo := network.GetPrimaryNetworkInfo()

Choose a reason for hiding this comment

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

nit: can you rename these to primarySubnetInfo or similar

Choose a reason for hiding this comment

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

same for other test cases

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better if the tests were agnostic as to which network is which, but we have to do some work to unify the interfaces between the core-eth and subnet-evm clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Primary Network" is actually the correct terminology: https://docs.avax.network/learn/avalanche/avalanche-platform

docker/run_setup.sh Outdated Show resolved Hide resolved
scripts/local/examples/basic_send_receive.sh Outdated Show resolved Hide resolved
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
"github.com/ava-labs/teleporter/tests/interfaces"
"github.com/ava-labs/teleporter/tests/utils"
. "github.com/onsi/gomega"
)

func BlockHashPublishReceive(network interfaces.Network) {
subnetAInfo, subnetBInfo, _ := utils.GetThreeSubnets(network)
subnetAInfo := network.GetPrimaryNetworkInfo()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better if the tests were agnostic as to which network is which, but we have to do some work to unify the interfaces between the core-eth and subnet-evm clients.

@michaelkaplan13
Copy link
Collaborator

Other than the small suggestions from Geoff and Matt, LGTM.

geoff-vball
geoff-vball previously approved these changes Dec 21, 2023
Copy link
Contributor

@geoff-vball geoff-vball left a comment

Choose a reason for hiding this comment

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

👍

@cam-schultz cam-schultz merged commit 9e3880d into main Dec 21, 2023
15 checks passed
@cam-schultz cam-schultz deleted the c-chain-integ-tests branch December 21, 2023 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Author C-Chain <> subnet integration tests
4 participants