-
Notifications
You must be signed in to change notification settings - Fork 321
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
Migrations #113
Migrations #113
Conversation
Currently, this is what a migration file is likely to look like. from populus import migrations
function a_custom_migration_fn(web3, compiled_contracts, **kwargs):
... # do whatever you want here.
class Migration(migrations.Migration):
migration_id = '0001_initial'
dependencies = []
operations = [
migrations.DeployContract('Thrower', ['some-constructor-argument']),
migrations.TransactContract('Thrower', 'transferFrom', [...some-arguments]),
migrations.SendTransaction({'from': '0xabcd1234', 'to': '0xabcd1234', 'value': 54321}),
migrations.RunPython(a_custom_migration_fn),
]
compiled_contracts = {
'Thrower': {
'code': "0x606060405260405160208060318339506080604052518015601e576002565b50600680602b6000396000f3606060405200",
'code_runtime': "0x606060405200",
'abi': [
{
"inputs": [{"name": "shouldThrow", "type": "bool"}],
"type": "constructor",
},
],
},
} |
@miohtama curious whether you have a minute to look this over and give any preliminary feedback you might have on it. |
Can you give me links to existing migration frameworks and some background story? I know the concept of database migrations from SQLAlchemy, Django, etc. and I am curious if we are using the word migration in similar context here. |
I stole the concept from truffle so you can see their implementation in the On Wed, Aug 3, 2016, 11:57 AM Mikko Ohtamaa notifications@github.com
|
Perfect! Learning registrar contracts is one thing on my TODO list. |
@miohtama this is the initial version I hammered out last night. It's really more of an immutable key/value store than a registrar. The idea is as follows. In migration
Then, future migrations could reference this value something like the following.
Then, within the execution of the |
24b1e84
to
2acf73d
Compare
04c1dcd
to
a658ac9
Compare
34486a3
to
5851b3f
Compare
Work in progress for #106
TODO list
Operation
classes so that they aren't single method giantsweb3.eth.contract.deploy()
andweb3.eth.contract.transact()
methods. (https://github.com/pipermerriam/web3.py/pull/53)populus.chain.Chain
class for use when the user wants to run their own blockchain client.populus migrate
command.populus.migrations.writer
so that it handles imports. This is likely changing the semantics of how writing works so that there is a serialization step, followed by a writing the actual migration contents.migrate
anddeploy
into a helper that is well tested. (pick chain, pick account, unlock account, write new defaults).PopulusConfig
object in the pytest plugins is necessary. I suspect that everything it does is now handled by theProject
andproject.config
stuff.populus chain run
populus.chain.Chain
objectspopulus.project.Project
objectWhat was wrong?
TODO
How was it fixed?
TODO
Cute Animal Picture
TODO