-
Notifications
You must be signed in to change notification settings - Fork 426
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
[E2E] Call builders and extra gas margin option #1917
Changes from 4 commits
bc27b10
313d351
2578e5a
116caf6
024405b
e7b9c0e
da053c6
e872567
9df632f
86fab73
9e7814e
2b3260f
3bef64c
ad43cce
5109e64
9e5b311
7e7a02e
8e8713f
8cdf350
505e582
48e9543
93221db
a8ccedf
3c600b4
0c076f4
3d3e04d
f1a3228
bb332ad
975762a
714d7d8
2855db2
c091243
5f11cbc
62b1608
d96fed4
61a0fa0
6af9c46
02bb3ec
2d62be8
6be1cdc
8036919
1bebfc9
d7c6be4
7d6aafa
3d8f9ba
d3560c3
7542d5a
aef2dcd
c5b78de
c649b58
c5c1de5
ccac9ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ mod call_builder { | |
let selector = ink::selector_bytes!("get"); | ||
let call = call_builder_call.delegate_call(code_hash, selector); | ||
let call_result = client | ||
.call(&origin, &call, 0, None) | ||
.call(&origin, &call, 0, None, None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe now is the time to finally convert to a builder style API, since the default values There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is 😄 let call_result = client
.build_call(&origin, &call)
.value(100)
.storage_deposit_limit(100)
.extra_gas_portion(5)
.send()
.await()
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should do a builder API, but maybe as a separate task where we can design it properly I think a more minimal approach to this problem (applying the extra gas portion without breaking the
|
||
.await | ||
.expect("Client failed to call `call_builder::invoke`.") | ||
.return_value(); | ||
|
@@ -232,7 +232,7 @@ mod call_builder { | |
let selector = ink::selector_bytes!("get"); | ||
let call = call_builder_call.forward_call(incrementer.account_id, selector); | ||
let call_result = client | ||
.call(&origin, &call, 0, None) | ||
.call(&origin, &call, 0, None, None) | ||
.await | ||
.expect("Client failed to call `call_builder::invoke`.") | ||
.return_value(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,7 +210,9 @@ pub mod give_me { | |
// when | ||
let transfer = call.give_me(120); | ||
|
||
let call_res = client.call(&ink_e2e::bob(), &transfer, 10, None).await; | ||
let call_res = client | ||
.call(&ink_e2e::bob(), &transfer, 10, None, None) | ||
.await; | ||
|
||
// then | ||
if let Err(ink_e2e::Error::<ink::env::DefaultEnvironment>::CallDryRun( | ||
|
@@ -252,7 +254,7 @@ pub mod give_me { | |
let transfer = call.give_me(120); | ||
|
||
let call_res = client | ||
.call(&ink_e2e::eve(), &transfer, 0, None) | ||
.call(&ink_e2e::eve(), &transfer, 0, None, None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can see we are not using this API anywhere in the examples. If we are going to move to this API and have it a breaking change anyway, we can just change
|
||
.await | ||
.expect("call failed"); | ||
|
||
|
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.
This looks like a breaking change.
Not a huge problem for it to be a breaking change, just the fact that in 99% of cases the value passed will be
None
.One approach would be to have a new method e.g.
bare_call
which just passes raw arguments to (in this case)self.api.call()
. Thegas_limit
would be an absolute value and the part of adding the "portion" could just be done in the builder exec method.Then we could even keep this method as is so it is a non-breaking change if we wanted. But this is not strictly necessary since we are doing a major release...it will be just annoying for users to have to update all their tests.
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 am not fun of an idea of having 3 different ways of building a call. We are going to end up with
call()
,bare_call()
and call builder which serve similar purposes. This will just confuse peopleThere 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.
Additionally, there is no way of specifying gas limit in E2E anyway, so it will be a breaking change nonetheless