-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: make subnet nodes configurable and fix https outcall cost calculation #351
base: main
Are you sure you want to change the base?
Conversation
1259708
to
b4d4885
Compare
b4d4885
to
e98a9d3
Compare
f0f049d
to
dc90e48
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.
@ninegua Thanks a lot for this PR! Some small nits, otherwise LGTM!
@@ -108,6 +108,7 @@ type InstallArgs = record { | |||
manageApiKeys : opt vec principal; | |||
logFilter : opt LogFilter; | |||
overrideProvider : opt OverrideProvider; | |||
nodesInSubnet : opt nat32; |
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.
nodesInSubnet : opt nat32; | |
numNodesInSubnet : opt nat32; |
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.
There is already a method called getNodesInSubnet
, so I'm reusing the same term nodesInSubnet
to be consistent in the interface.
let nodes_in_subnet = NODES_IN_SUBNET as u128; | ||
/// See https://internetcomputer.org/docs/current/developer-docs/gas-cost/#https-outcalls | ||
pub fn get_http_request_cost( | ||
nodes_in_subnet: u32, |
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.
nit: I would use num_nodes_in_subnet
here and everywhere to be more explicit.
nodes_in_subnet: u32, | |
num_nodes_in_subnet: u32, |
@@ -1,15 +1,5 @@ | |||
// HTTP outcall cost calculation | |||
// See https://internetcomputer.org/docs/current/developer-docs/gas-cost#special-features | |||
// Constant used in HTTP outcall cost calculation | |||
pub const INGRESS_OVERHEAD_BYTES: u128 = 100; |
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 perhaps a link where this is documented? I'm not super familiar with all of this so I appreciate when there is documentation available :)
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 have no idea why this gets the value 100 in the first place. But I guess it was some heuristics?
@@ -1042,6 +1049,38 @@ fn candid_rpc_should_err_without_cycles() { | |||
); | |||
} | |||
|
|||
#[test] | |||
fn candid_rpc_should_err_with_insufficient_cycles() { |
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.
nit: I would add a test for when the number of nodes in the subnet is not specified in the install args.
XC-257
Fix the cycle computation according to the latest document on the cost for https outcalls https://internetcomputer.org/docs/current/developer-docs/gas-cost/#https-outcalls
Also add
nodesInSubnet
as an optional initialization parameter when creating the EVM RPC canister. It defaults to 34 if not set, which is also the default used previously.