-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Refactor make create contract helper function available outside of fuel core #2656
base: master
Are you sure you want to change the base?
Refactor make create contract helper function available outside of fuel core #2656
Conversation
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.
needs rustfmt and toml lint i think, lgtm
Co-authored-by: Mårten Blankfors <[email protected]>
Co-authored-by: Mårten Blankfors <[email protected]>
ebe1f20
to
4177a75
Compare
c992c98
to
1ea8e97
Compare
e6aadd5
to
6bc31c6
Compare
fn process_create_transaction(&mut self, tx: &Create) -> anyhow::Result<()> { | ||
let bytecode_witness_index = tx.bytecode_witness_index(); | ||
let witnesses = tx.witnesses(); | ||
let bytecode = witnesses[usize::from(*bytecode_witness_index)].as_vec(); |
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.
It would be nice to use getter and process the case out of bounds
let Some(Output::ContractCreated { contract_id, .. }) = tx | ||
.outputs() | ||
.iter() | ||
.filter(|output| matches!(output, Output::ContractCreated { .. })) | ||
.take(1) | ||
.collect::<Vec<&Output>>() | ||
.first() |
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.
Will this work w/o the filter?
let Some(Output::ContractCreated { contract_id, .. }) = tx | |
.outputs() | |
.iter() | |
.filter(|output| matches!(output, Output::ContractCreated { .. })) | |
.take(1) | |
.collect::<Vec<&Output>>() | |
.first() | |
let Some(Output::ContractCreated { contract_id, .. }) = tx | |
.outputs() | |
.iter() | |
.find(|output| matches!(output, Output::ContractCreated { .. })) |
Linked Issues/PRs
Closes #2654
Description
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]