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 NewAddress public function #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mariusmihaic
Copy link
Contributor

@mariusmihaic mariusmihaic commented Jul 28, 2021

Added NewAddress function from elrond-go.

  • In elrond-go, NewAddress is a method of BlockChainHookImpl (which will be removed in the future).
  • In elrond-go, NewAddress only uses the length of pubkeyConv (structure member) from BlockChainHookImpl (structure).
  • In here(elrond-go-core) the length of pubkeyConv is used as an input parameter.

Function signature in elrond-go:
-> func (bh *BlockChainHookImpl) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)

Function signature in here(elrond-go-core):
-> func NewAddress(creatorAddress []byte, addressLength int, creatorNonce uint64, vmType []byte) ([]byte, error)

// The address is created by applied keccak256 on the appended value off creator address and nonce
// Prefix mask is applied for first 8 bytes 0, and for bytes 9-10 - VM type
// Suffix mask is applied - last 2 bytes are for the shard ID - mask is applied as suffix mask
func NewAddress(creatorAddress []byte, addressLength int, creatorNonce uint64, vmType []byte) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing unit tests.

@iulianpascalau iulianpascalau changed the base branch from development to main September 22, 2021 08:59
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.

2 participants