-
Notifications
You must be signed in to change notification settings - Fork 27
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
C chain integ tests #204
Conversation
docker/relayerConfigTemplate.json
Outdated
@@ -5,7 +5,7 @@ | |||
"source-subnets": [ | |||
{ | |||
"subnet-id": "11111111111111111111111111111111LpoYY", | |||
"chain-id": "<C_CHAIN_CHAIN_ID>", | |||
"blockchain-id": "<C_CHAIN_CHAIN_ID>", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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) | ||
}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this 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 👍
docker/relayerConfigTemplate.json
Outdated
@@ -5,7 +5,7 @@ | |||
"source-subnets": [ | |||
{ | |||
"subnet-id": "11111111111111111111111111111111LpoYY", | |||
"chain-id": "<C_CHAIN_CHAIN_ID>", | |||
"blockchain-id": "<C_CHAIN_CHAIN_ID>", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
nodeURIs = append(nodeURIs, n.subnetsInfo[n.subnetAID].NodeURIs...) | ||
nodeURIs = append(nodeURIs, n.subnetsInfo[n.subnetBID].NodeURIs...) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
tests/local/network.go
Outdated
subnets := n.GetSubnetsInfo() | ||
subnets = append(subnets, *n.primaryNetworkInfo) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
"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() |
There was a problem hiding this comment.
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.
Other than the small suggestions from Geoff and Matt, LGTM. |
Co-authored-by: minghinmatthewlam <[email protected]> Signed-off-by: cam-schultz <[email protected]>
…into c-chain-integ-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Why this should be merged
Fixes #193
TODO:
run.sh
to use Warp enabled C-Chain once use snapshop compatible with cchain warp avalanche-cli#1330 is merged and a release issuedAdd ethclient interface that both subnet-evm and coreth ethclient implementHow 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