-
Notifications
You must be signed in to change notification settings - Fork 20
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
[test] Enable storage limit for emulator backend #271
base: master
Are you sure you want to change the base?
Conversation
This will make the testing environment behave more similar to a development/testnet/mainnet environment.
14f69ba
to
1c6bc19
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to set the storage limit for tests? Or does it use a default value always?
The default value is taken from here: https://github.com/onflow/flow-go/blob/47e239c3b505d75b41c3cb92666eba56d541c8a0/fvm/bootstrap.go#L26-L28, when using |
test/test_framework_test.go
Outdated
@@ -735,7 +735,7 @@ func TestImportContract(t *testing.T) { | |||
Test.assert(blockHeight > 1) | |||
|
|||
mintFlow(to: admin, amount: 500.0) | |||
Test.assertEqual(500.0, getFlowBalance(account: admin)) | |||
Test.assertEqual(500.001, getFlowBalance(account: admin)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel these small value differences in account balances could be annoying for users when writing tests.
(Also not sure why it changes the account balances when the storage limit is enabled).
So maybe we should have this disabled by default (to make the simple use-cases simple), and allow developers to enable it only if they need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel these small value differences in account balances could be annoying for users when writing tests.
That' a good point 👍
(Also not sure why it changes the account balances when the storage limit is enabled).
The emulator.WithStorageLimitEnabled(true)
means that every account has to be created with the minimum storage reservation (0.001
FLOW), otherwise the account would break the storage limit constraint.
So maybe we should have this disabled by default (to make the simple use-cases simple), and allow developers to enable it only if they need it.
Sounds good, I will try the approach where this is enabled per test file, with a pragma directive (#storageLimitEnabled
).
@SupunS I have reworked this to use a Cadence pragma directive, instead of enabling it by default. Take a look when you can, and let me know what you think 🙏 |
Description
This will make the testing environment behave more similar to a development/testnet/mainnet environment.
master
branchFiles changed
in the Github PR explorer