Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Generic Deposit CLI command and Generic Resources CLI fixes #283

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

Conversation

vezenovm
Copy link
Contributor

Description

There is currently no CLI deposit method for bridging with the generic handler on the EVM side of the bridge. This PR adds a deposit command to the centrifuge CLI for depositing generic data on the bridge.

Related Issue Or Context

While testing this method an error was discovered in the register-generic-resource method. Using copy(DepositSignatureBytes[:], []byte(DepositSignatureString)[:]) does not directly convert the hex string into the hex representation in bytes. Rather the string is transformed into its hex values. For example 0x00000000 will be encoded into 30783030.

On top of this, we are also currently hashing both functions when --hash is specified and not checking if one function is still its default value of bytes4(0). This results in an incorrect function signature being registered (bytes4(keccack256(00000000))).

Closes: #

How Has This Been Tested? Testing details.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

Checklist:

  • I have commented my code, particularly in hard-to-understand areas.
  • I have ensured that all acceptance criteria (or expected behavior) from issue are met
  • I have updated the documentation locally and in chainbridge-docs.
  • I have added tests to cover my changes.
  • I have ensured that all the checks are passing and green, I've signed the CLA bot

… and execute function signatures for registering a generic resource
@github-actions
Copy link

Go Test coverage is 55.7 %\ ✨ ✨ ✨

@github-actions
Copy link

Go Test coverage is 55.6 %\ ✨ ✨ ✨

@github-actions
Copy link

Go Test coverage is 55.6 %\ ✨ ✨ ✨

@vezenovm vezenovm marked this pull request as ready for review February 22, 2022 17:33
@github-actions
Copy link

Go Test coverage is 55.6 %\ ✨ ✨ ✨

} else {
copy(DepositSigBytes[:], []byte(Deposit)[:])
copy(ExecuteSigBytes[:], []byte(Execute)[:])
depositBytes, err := hex.DecodeString(Deposit)
Copy link
Contributor

Choose a reason for hiding this comment

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

You could probably use the DepositSigBytes variable here, and then omit the copy stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean substituting depositBytes with DepositSigBytes from the hex.DecodeString call? Currently DepositSigBytes is type [4]byte whereas DecodeString returns []byte and can be used to assign a value to DepositSigBytes. This could probably still be done but would require slight changes to all other places that use DepositSigBytes

}
copy(DepositSigBytes[:], depositBytes[:])

executeBytes, err := hex.DecodeString(Execute)
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as above

@github-actions
Copy link

Go Test coverage is 55.6 %\ ✨ ✨ ✨

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

Successfully merging this pull request may close these issues.

3 participants