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

add avalanche support #1

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

add avalanche support #1

wants to merge 28 commits into from

Conversation

n0cte
Copy link
Collaborator

@n0cte n0cte commented Apr 4, 2023

No description provided.

@n0cte n0cte requested a review from ramilexe April 4, 2023 17:32
@n0cte n0cte force-pushed the avalanche-support branch 4 times, most recently from 6075ba3 to bfae7d5 Compare April 10, 2023 09:14
@n0cte n0cte force-pushed the avalanche-support branch from f8a9768 to bd5d67a Compare April 25, 2023 15:40
@ramilexe ramilexe force-pushed the avalanche-support branch from d8f8e1c to 7f2ff5a Compare April 26, 2023 07:59
agouin and others added 6 commits April 27, 2023 20:36
* add waiting bootsrapped state

* add avalanche integration and add subnet creation

* add implementation for subnet chains

* move port binding allocation

* deascrease block number for WaitForBlocks

* dont send avax if subnets list is empty

* revert image pulling
# Conflicts:
#	configuredChains.yaml
#	go.mod
#	go.sum
#	label/label.go
n0cte and others added 4 commits May 10, 2023 20:54
* add subnets info flag "track-subnets"

* fix fn for waiting network

* add subnet-evm

* add WithAssumeDecided for IssueCreateSubnetTx

* add timeout after import

* add ignoring errors

* fix err

* fix subnet-evm genesis

* add simple implementation for SendFunds

* add validators for subnet

* make 1 transaction at now

* add waiting delta

* stop container
print evm tx hash

---------

Co-authored-by: ramil <ramilexe@gmail.com>
enable image pulling
avaxAddr, _ := address.Format("X", chainId.Name, key.Address().Bytes())
allocations := []GenesisAllocation{
{
ETHAddr: "0x" + key.PublicKey().Address().Hex(),

Choose a reason for hiding this comment

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

This is a bug. These aren't ethereum addresses. Ethereum address are computed by taking the keccak256 checksum of the public key, then truncating to 20 bytes.

If you look at the code for key.PublicKey().Address(), the address function does two hashing operations. I'm not sure why but the end result is that the address is not an ethereum address.

Later in the code, during CChain genesis (node_genesis.go, NewGenesis function) the 'ETHAddr' is used in the genesis "alloc" field. So the end result, I think, is that the wrong address is put into the chain Genesis.

For comparison, if you do the following, you will get a different address than what you did here:

privateKey, err := crypto.HexToECDSA("56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027")
	if err != nil {
		return fmt.Errorf("can't parse private key: %s", err)
	}

	ethAddr := crypto.PubkeyToAddress(privateKey.PublicKey)
	addrHex = ethAddr.Hex()
	fmt.Printf("key addr: %s\n", addrHex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants