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

feat: third party service contract for pallet-smart-contract #522

Merged
merged 16 commits into from
Dec 23, 2022

Conversation

renauter
Copy link
Collaborator

@renauter renauter commented Nov 25, 2022

Gather changes from #513 and #495

Related to

See specs here:
#445 (comment)

To complete:

Copy link
Contributor

@brandonpille brandonpille left a comment

Choose a reason for hiding this comment

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

Nice work! Great code coverage too with the tests! Some small comments though.

substrate-node/pallets/pallet-smart-contract/src/lib.rs Outdated Show resolved Hide resolved
substrate-node/pallets/pallet-smart-contract/src/lib.rs Outdated Show resolved Hide resolved
// Billing time (window) is max 1h by design
// So extra time will not be billed
// It is the service responsability to bill on right frequency
let window = elapsed_seconds_since_last_bill.min(3600);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create a const variable for the 3600? So that if it is ever changed we can quickly change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or even make it a config parameter type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or even make it a config parameter type?

I did the first option for now
Not sure if I see what you mean by the second option

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a parameter that you can set in the definition of the config of a pallet. Like here for example: https://github.com/threefoldtech/tfchain/blob/development/substrate-node/runtime/src/lib.rs#L381

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see what @DylanVerstraete thinks. Not sure if it's needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added such config parameter type here
70bfb60
@brandonpille @DylanVerstraete please check if every thing is ok because changes can be critical ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great. Although maybe ServiceContractBillingFrequency would be a better name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe ServiceContractBillingFrequency would be a better name?

Not sure because it is used in other contexts
The idea is to characterize the amount of time (is seconds) price values are set for in pricing policy / billing context
maybe PriceReferencePeriod would be better?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I didn't know that. Then the name is fine how it is.

substrate-node/pallets/pallet-smart-contract/src/lib.rs Outdated Show resolved Hide resolved
substrate-node/pallets/pallet-smart-contract/src/lib.rs Outdated Show resolved Hide resolved
substrate-node/pallets/pallet-smart-contract/src/types.rs Outdated Show resolved Hide resolved
@DylanVerstraete
Copy link
Contributor

@renauter can you rebase and add an ADR please?

@renauter
Copy link
Collaborator Author

@renauter can you rebase and add an ADR please?

@DylanVerstraete feel free to comment if need some rework

@DylanVerstraete
Copy link
Contributor

Looks good to me, let's merge

@DylanVerstraete DylanVerstraete merged commit 49a09ca into development Dec 23, 2022
@DylanVerstraete DylanVerstraete deleted the development_third_party_service_contract branch December 23, 2022 14:10
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.

3 participants