-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Contract input set estimation #628
Conversation
# Conflicts: # packages/fuels-contract/Cargo.toml # packages/fuels-contract/src/contract.rs # packages/fuels-core/Cargo.toml # packages/fuels-signers/Cargo.toml # packages/fuels-signers/src/provider.rs # packages/fuels-signers/src/wallet.rs # packages/fuels-test-helpers/Cargo.toml # packages/fuels-test-helpers/src/lib.rs # packages/fuels-types/Cargo.toml # packages/fuels/Cargo.toml # packages/fuels/tests/harness.rs
# Conflicts: # packages/fuels/tests/contracts.rs
4a56309
to
13ae5b5
Compare
# Conflicts: # examples/contracts/src/lib.rs # examples/predicates/src/lib.rs # packages/fuels-contract/Cargo.toml # packages/fuels-contract/src/contract.rs # packages/fuels-contract/src/script.rs # packages/fuels-core/Cargo.toml # packages/fuels-signers/Cargo.toml # packages/fuels-signers/src/provider.rs # packages/fuels-signers/src/wallet.rs # packages/fuels-test-helpers/Cargo.toml # packages/fuels-types/Cargo.toml # packages/fuels-types/src/errors.rs # packages/fuels/Cargo.toml # packages/fuels/tests/predicates.rs # packages/fuels/tests/providers.rs
|
…bs/fuels-rs into Salka1988/contract_set_estimation � Conflicts: � packages/fuels-contract/Cargo.toml � packages/fuels-signers/Cargo.toml � packages/fuels-test-helpers/Cargo.toml � packages/fuels/Cargo.toml
ce04278
to
8cb94fe
Compare
# Conflicts: # packages/fuels/tests/contracts.rs
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.
LGTM. Good work 🎉
…n' into Salka1988/contract_set_estimation
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.
Very good work! Left one suggestion to improve error handling.
let contract_id = Bech32ContractId::from(*receipt.contract_id().unwrap()); | ||
self = self.append_contract(contract_id); | ||
} else { | ||
return Err(result.err().unwrap()); |
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 error here will be very cryptic when returned to the user.
The user will be trying to estimate_tx_dependencies
, but if it is an Error::RevertTransactionError
and for some weird reason that's out of our control, ContractCall::find_contract_not_in_inputs
returns None
, the Err
here will be very hard to understand.
So we should return this Err
with a string saying something like "Couldn't estimate tx dependencies because we couldn't find the missing contract input"
.
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.
If ~~ContractCall::find_contract_not_in_inputs
returns None
it should mean that the Error::RevertTransactionError
was due to reasons other than missing output variables or contract inputs. We should forward the original error to the user in that case since it cannot be fixed by estimating dependencies anyways.
I need to improve my reading skills
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 was the initial idea.
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.
LGTM -- great work @Salka1988!
Add
set_contracts_automatic
which automatically adds missingcontract_id
s.blocked by:
FuelLabs/fuel-core#702
In addition, we will need a new release of
fuel-core
that supportstransparent_receipt::Receipt'
as the return value of thedry_run'
function.Important:I noticed that introducing the contract_id in Panic and all the necessary logic in fuel-core drastically increases the gas_fee, which can be seen from the tests.