Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Merge withdraw and kton into new transfer precompile #654

Merged
merged 48 commits into from Jun 23, 2021

Conversation

boundless-forest
Copy link
Member

@boundless-forest boundless-forest commented Jun 1, 2021

In this PR, I merged the original withdraw precompile(0x15) and the kton precompile(0x16) into a new precompile contract, named transfer, which address is 0x15, the same as with the original withdraw precompile address.

Something important to notice:

I did not change the protocol of old precompiles. For application users who use kton precompile, just update the kton precompile address from 0x16 to 0x15. @hujw77 @sxlwar We should update wkton contract before this change goes to pangolin.

@boundless-forest boundless-forest linked an issue Jun 1, 2021 that may be closed by this pull request
@boundless-forest boundless-forest marked this pull request as ready for review June 1, 2021 08:52
@boundless-forest boundless-forest marked this pull request as draft June 1, 2021 09:09
@boundless-forest boundless-forest marked this pull request as ready for review June 3, 2021 06:56
@hackfisher
Copy link
Contributor

hackfisher commented Jun 3, 2021

One question, does usize have the same byte length in different platforms? @AsceticBear @AurevoirXavier

@AurevoirXavier
Copy link
Member

One question, does usize have the same byte length in different platforms? @AsceticBear @AurevoirXavier

https://matrix.to/#/!HzySYSaIhtyWrwiwEV:matrix.org/$162270534229674MqRiQ:matrix.org?via=matrix.parity.io&via=matrix.org&via=corepaper.org

@boundless-forest
Copy link
Member Author

boundless-forest commented Jun 3, 2021

One question, does usize have the same byte length in different platforms? @AsceticBear @AurevoirXavier

Good questioin.

The answer from AurevoirXavier Element:

> bear | Darwinia Network
Can i use usize type for number in pallet?
> Xavier - Darwinia.Network
Yes
But in WASM it's u32
So make sure it won't be grow up to u32::max_value + 1

I also find some examples from substrate:

  1. https://github.com/paritytech/substrate/blob/master/frame/authorship/src/lib.rs#L33
  2. https://github.com/paritytech/substrate/blob/master/frame/elections/src/lib.rs#L153

In the end, I think this usage is ok.

Copy link
Contributor

@hackfisher hackfisher left a comment

Choose a reason for hiding this comment

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

@sxlwar please ACK these changes, might require companion PR in smart-app later.

frame/dvm/src/mock.rs Outdated Show resolved Hide resolved
frame/evm/precompile/contracts/transfer/src/lib.rs Outdated Show resolved Hide resolved
@boundless-forest boundless-forest marked this pull request as ready for review June 9, 2021 09:11
@hackfisher hackfisher changed the title Merge wtithdraw and kton into new transfer precompile Merge withdraw and kton into new transfer precompile Jun 15, 2021
@boundless-forest
Copy link
Member Author

@AurevoirXavier Please review this pr again.

@hackfisher hackfisher merged commit fec1058 into master Jun 23, 2021
@hackfisher hackfisher deleted the bear-precompiles-to-one branch June 23, 2021 05:46
hujw77 added a commit to evolutionlandorg/token-contracts that referenced this pull request Jun 23, 2021
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.

Merge precompiles
4 participants