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

unify solidity interfaces #1647

Merged
merged 26 commits into from
Aug 11, 2022
Merged

unify solidity interfaces #1647

merged 26 commits into from
Aug 11, 2022

Conversation

nbaztec
Copy link
Contributor

@nbaztec nbaztec commented Jul 1, 2022

What does it do?

  • Fixes solidity interfaces with consistent naming conventions and lint. Uses @custom:... docs for declaring selectors and addresses.
  • Deprecates non-conformant function names.
  • Adds a test in each precompile to confirm that the selectors are correctly documented and Action selectors implemented on the runtime code.
  • Removes (only) from the staking solidity interface the deprecated methods from [Staking] Make exits manual, patch lack of delay for {increasing, decreasing} bonds #810

⚠️ We currently have docs that use snake_case as well, and as such, would need to be updated accordingly https://docs.moonbeam.network/builders/build/canonical-contracts/precompiles/democracy/

/cc @albertov19

CHANGELOG

The following precompiles are affected:

  • assets-erc20
    • freeze_asset() -> freezeAsset()
    • thaw_asset() -> thawAsset()
    • transfer_ownership(address) -> transferOwnership(address)
    • set_team(address,address,address) -> setTeam(address,address,address)
    • set_metadata(string,string,uint8) -> setMetadata(string,string,uint8)
    • clear_metadata() -> clearMetadata()
  • author-mapping
    • add_association(bytes32) -> addAssociation(bytes32)
    • update_association(bytes32,bytes32) -> updateAssociation(bytes32,bytes32)
    • clear_association(bytes32) -> clearAssociation(bytes32)
    • remove_keys() -> removeKeys()
    • set_keys(bytes) -> setKeys(bytes)
  • crowdloan-rewards
    • is_contributor(address) -> isContributor(address)
    • reward_info(address) -> rewardInfo(address)
    • update_reward_address(address) -> updateRewardAddress(address)
  • pallet-democracy
    • public_prop_count() -> publicPropCount()
    • deposit_of(uint256) -> depositOf(uint256)
    • lowest_unbaked() -> lowestUnbaked()
    • ongoing_referendum_info(uint256) -> ongoingReferendumInfo(uint256)
    • finished_referendum_info(uint256) -> finishedReferendumInfo(uint256)
    • standard_vote(uint256,bool,uint256,uint256) -> standardVote(uint256,bool,uint256,uint256)
    • remove_vote(uint256) -> removeVote(uint256)
    • un_delegate() -> unDelegate()
    • note_preimage(bytes) -> notePreimage(bytes)
    • note_imminent_preimage(bytes) -> noteImminentPreimage(bytes)
  • parachain-staking
    • min_delegation() -> minDelegation()
    • candidate_count() -> candidateCount()
    • candidate_delegation_count(address) -> candidateDelegationCount(address)
    • delegator_delegation_count(address) -> delegatorDelegationCount(address)
    • selected_candidates() -> selectedCandidates()
    • is_delegator(address) -> isDelegator(address)
    • is_candidate(address) -> isCandidate(address)
    • is_selected_candidate(address) -> isSelectedCandidate(address)
    • delegation_request_is_pending(address,address) -> delegationRequestIsPending(address,address)
    • candidate_exit_is_pending(address) -> candidateExitIsPending(address)
    • candidate_request_is_pending(address) -> candidateRequestIsPending(address)
    • join_candidates(uint256,uint256) -> joinCandidates(uint256,uint256)
    • leave_candidates(uint256) -> leaveCandidates(uint256)
    • schedule_leave_candidates(uint256) -> scheduleLeaveCandidates(uint256)
    • execute_leave_candidates(address,uint256) -> executeLeaveCandidates(address,uint256)
    • cancel_leave_candidates(uint256) -> cancelLeaveCandidates(uint256)
    • go_offline() -> goOffline()
    • go_online() -> goOnline()
    • schedule_candidate_bond_less(uint256) -> scheduleCandidateBondLess(uint256)
    • candidate_bond_more(uint256) -> candidateBondMore(uint256)
    • execute_candidate_bond_less(address) -> executeCandidateBondLess(address)
    • cancel_candidate_bond_less() -> cancelCandidateBondLess()
    • schedule_leave_delegators() -> scheduleLeaveDelegators()
    • execute_leave_delegators(address,uint256) -> executeLeaveDelegators(address,uint256)
    • cancel_leave_delegators() -> cancelLeaveDelegators()
    • schedule_revoke_delegation(address) -> scheduleRevokeDelegation(address)
    • schedule_delegator_bond_less(address,uint256) -> scheduleDelegatorBondLess(address,uint256)
    • delegator_bond_more(address,uint256) -> delegatorBondMore(address,uint256)
    • execute_delegation_request(address,address) -> executeDelegationRequest(address,address)
    • cancel_delegation_request(address) -> cancelDelegationRequest(address)
  • relay-encoder
    • encode_bond(uint256,uint256,bytes) -> encodeBond(uint256,uint256,bytes)
    • encode_bond_extra(uint256) -> encodeBondExtra(uint256)
    • encode_unbond(uint256) -> encodeUnbond(uint256)
    • encode_withdraw_unbonded(uint32) -> encodeWithdrawUnbonded(uint32)
    • encode_validate(uint256,bool) -> encodeValidate(uint256,bool)
    • encode_nominate(uint256[]) -> encodeNominate(uint256[])
    • encode_chill() -> encodeChill()
    • encode_set_payee(bytes) -> encodeSetPayee(bytes)
    • encode_set_controller(uint256) -> encodeSetController(uint256)
    • encode_rebond(uint256) -> encodeRebond(uint256)
  • xcm-transactor
    • index_to_account(uint16) -> indexToAccount(uint16)
    • transact_info((uint8,bytes[])) -> transactInfo((uint8,bytes[]))
    • transact_through_derivative_multilocation(uint8,uint16,(uint8,bytes[]),uint64,bytes) -> transactThroughDerivativeMultilocation(uint8,uint16,(uint8,bytes[]),uint64,bytes)
    • transact_through_derivative(uint8,uint16,address,uint64,bytes) -> transactThroughDerivative(uint8,uint16,address,uint64,bytes)
    • transact_info_with_signed((uint8,bytes[])) -> transactInfoWithSigned((uint8,bytes[]))
    • fee_per_second((uint8,bytes[])) -> feePerSecond((uint8,bytes[]))
    • transact_through_signed_multilocation((uint8,bytes[]),(uint8,bytes[]),uint64,bytes) -> transactThroughSignedMultilocation((uint8,bytes[]),(uint8,bytes[]),uint64,bytes)
    • transact_through_signed((uint8,bytes[]),address,uint64,bytes) -> transactThroughSigned((uint8,bytes[]),address,uint64,bytes)
  • xtokens
    • transfer_with_fee(address,uint256,uint256,(uint8,bytes[]),uint64) -> transferWithFee(address,uint256,uint256,(uint8,bytes[]),uint64)
    • transfer_multiasset((uint8,bytes[]),uint256,(uint8,bytes[]),uint64) -> transferMultiasset((uint8,bytes[]),uint256,(uint8,bytes[]),uint64)
    • transfer_multiasset_with_fee((uint8,bytes[]),uint256,uint256,(uint8,bytes[]),uint64) -> transferMultiassetWithFee((uint8,bytes[]),uint256,uint256,(uint8,bytes[]),uint64)
    • transfer_multi_currencies((address,uint256)[],uint32,(uint8,bytes[]),uint64) -> transferMultiCurrencies((address,uint256)[],uint32,(uint8,bytes[]),uint64)
    • transfer_multi_assets(((uint8,bytes[]),uint256)[],uint32,(uint8,bytes[]),uint64) -> transferMultiAssets(((uint8,bytes[]),uint256)[],uint32,(uint8,bytes[]),uint64)

What important points reviewers should know?

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

@nbaztec nbaztec added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Jul 6, 2022
@nbaztec nbaztec marked this pull request as ready for review July 6, 2022 09:36
/**
* Change your currently registered vote in the contract
*/
function change_vote() external {}
Copy link
Contributor Author

@nbaztec nbaztec Jul 12, 2022

Choose a reason for hiding this comment

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

This file seems to be just an example file and hence I've excluded it from Action consistency check in test.rs as the selectors do not exist on our side.

@notlesh notlesh added D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Aug 10, 2022
@nanocryk nanocryk merged commit 404d7dd into master Aug 11, 2022
@nanocryk nanocryk deleted the nish-fix-solidity branch August 11, 2022 15:14
Comment on lines -77 to -81
/// Return the deposit required to perform a request
/// @dev Each request will need a deposit.
/// Selector: fb7cfdd7
function requiredDeposit() external view returns (uint256);

Copy link
Contributor

Choose a reason for hiding this comment

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

adding this back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants